DEV Community

Codeguage
Codeguage

Posted on • Originally published at codeguage.com

150+ Questions to Practice JavaScript's Foundational Concepts

JavaScript is one of the most used programming languages over the world. It has topped countless of charts and many developer surveys, time and again.

What I really like about JavaScript is that it's extremely easy to learn. Getting started is so simple that I can't even stress on it more.

You don't need to install interpreters/compilers or worry about any IDEs.

And once you start learning it, you don't even have to worry about strict typing, following any boilerplates (as in Java), or getting yourself through monotonous build/compile stages.

Really all that is needed is a browser and a simple text editor, although no one would use generic editors, like Notepad, these days, given that we have awesome editors, delivering an IDE-like experience, such as Visual Studio Code.

Anyways, coming back to the topic, given that JavaScript is so famous, it's no surprise that more and more people are learning it, or wanting to learn it.

In this regard, it's really fruitful to have a large bunch of questions to answer, related to JavaScript, in order to make sure that we know the concepts really well, once we've learnt them.

Now a while ago, I released a new feature on CodeGuage called Questions (pretty simple name, isn't it?). As the name suggests, it is meant to provide a bunch of questions related to a given course on CodeGuage.

Learners can quickly go through the questions in order to ensure that they are well-versed in the underlying topic.

For JavaScript, I currently have a collection of over 150 questions (156, to be precise) focusing on the Foundation unit of the JavaScript course at CodeGuage.

(The end goal is to exceed the limit of 1000 questions on JavaScript, Python, and PHP, and make the 'Questions' feature on CodeGuage one of its kind.)

In this article, I aim to lay out all of the questions that I currently have on CodeGuage for JavaScript so that they can possibly reach a wider audience and then those interested can get to check out the answers of the questions back on CodeGuage.

I hope there is something new in these questions for everyone to learn. 🙂

Let's begin.


All the answers can be found at JavaScript Foundation Questions - CodeGuage.


The questions

All of the questions are grouped according to the chapter that they apply to. If you go through the chapter, you'll have answers to all of the questions.

Introduction

  1. Who created JavaScript?
  2. In which year was JavaScript first released?
  3. What means when we say that JavaScript is a scripting language?
  4. What means when we say that JavaScript is a high-level language?
  5. What is meant by an implementation of JavaScript?
  6. Name one implementation of JavaScript.
  7. What programming paradigms does JavaScript support?
  8. Where do we write JavaScript code so that it could be run in the browser?
  9. What is an external JavaScript file?
  10. How is a JavaScript file linked to in a webpage?
  11. List 3 benefits of using an external JavaScript file for a webpage.

Console

  1. What is the console?
  2. What is meant when we say that the console is a REPL environment for executing JavaScript?
  3. The sole function of the console is to execute JavaScript. True or false? If false, then what else can it do?
  4. How to log anything to the console?

Basics

  1. What are integers?
  2. What are floats?
  3. JavaScript has separate types for integers and floats. True or false? If false, then give the correct explanation.
  4. Name any five basic arithmetic operators that JavaScript provides along with their symbols.
  5. What is meant when we say that the multiplication operator has a higher precedence than the addition operator in JavaScript?
  6. How can we enforce a particular operation to happen before the other?
  7. What is a string?
  8. Give the three ways to denote a string in JavaScript.
  9. What's the difference between single-quoted and double-quoted strings in JavaScript?
  10. Can a single- or double-quoted string in JavaScript span multiple lines in source code?
  11. What is an escape sequence?
  12. List any three escape sequences.
  13. How to denote new lines in single-quoted or double-quoted strings?
  14. What is string concatenation?
  15. Which symbol is used to perform string concatenation in JavaScript?
  16. What is a variable?
  17. How to create a variable in JavaScript?
  18. Define the term 'keyword' in JavaScript. Give an example of a keyword.
  19. What is variable declaration?
  20. What is variable initialization?
  21. What is variable assignment?
  22. How is variable initialization different from variable assignment?
  23. In JavaScript, a variable can hold values of any arbitary type. True or false? If false, then give the correct explanation.
  24. Name the three different kinds of dialog boxes that could be shown using JavaScript.
  25. Give the corresponding functions that can be used to show these dialogs.
  26. What kind of values does confirm() return?
  27. What does the second argument to prompt() do?
  28. prompt() always returns a string, even if the Cancel button is clicked. True or false? If false, then give the correct explanation.
  29. How to convert a string to a number?

Variables

  1. What are the different variations of declaring variables using var?
  2. Name three rules of naming variables in JavaScript.
  3. Which casing convention is commonly used to name things in JavaScript?
  4. How to check whether a given variable exists?
  5. What is variable hoisting?
  6. What is the let keyword?
  7. Give two differences between let and var.
  8. What is meant by the temporal dead zone of a variable creating using let?

Constants

  1. What are constants in programming?
  2. How to define a constant in JavaScript?
  3. A constant can be defined without an initializer. True or false? If false, then give the correct description.
  4. What is screaming snake casing and why is it commonly used to name constants in programming?
  5. What are the rules for naming constants in JavaScript?

Comments

  1. What are comments in programming?
  2. Give two uses of comments in programming.
  3. Name the two kinds of comments in JavaScript.
  4. How to write a comment of each kind?
  5. Give two tips for writing good comments.

Data types

  1. What is a data type?
  2. What are primitives and objects in JavaScript?
  3. Give one difference between primitives and objects?
  4. Name the seven primitive types of JavaScript.
  5. Take the numbers 10 and 10.5. JavaScript considers these numbers to be of distinct types. True or false? If false, then give the correct explanation.
  6. What is a number literal?
  7. What is meant by the index of a character of a string?
  8. What is the total number of characters in a string called?
  9. How to retrieve the total number of characters of a string in JavaScript?
  10. How can a primitive in JavaScript have a property available on it? Explain the phenomenon that enables this?
  11. What is a Boolean?
  12. Give the two Boolean values of JavaScript.
  13. What is the purpose of the special value undefined in JavaScript?
  14. What is the purpose of the special value null in JavaScript?
  15. What is an array?
  16. What is meant by an 'element' of an array?
  17. What is meant by the index of an element of an array?
  18. How to access the fifth element of an array stored in the variable arr?
  19. What is the total number of items in an array called?
  20. How to retrieve the total number of items of an array?
  21. In JavaScript, the items of an array all have to be of the same type. True or false? If false, then give the correct explanation.
  22. What is an array literal?
  23. What happens when we access an out-of-range index of an array in JavaScript? Do we get an error?
  24. Which method can be used to sort an array?
  25. What means when we say that a method modifies an array in-place?
  26. What is a function?
  27. Functions in JavaScript can be named or anonymous. True or false? If false, then give the correct description.
  28. Which keyword is used to define functions in JavaScript?
  29. What is the difference between function parameters and arguments?
  30. What is meant by the body of a function?
  31. What is meant by the definition of a function?
  32. What is meant by invoking a function?
  33. How to invoke a function stored in a variable func in JavaScript?
  34. How to return a given value from a function?
  35. What is an object?
  36. What is an object literal?
  37. What is meant by the property of an object?
  38. How to access the property named bar of an object stored in the variable foo?
  39. What is the purpose of the typeof keyword in JavaScript?
  40. The typeof keyword represents an expression. True or false? If false, then give the correct description.
  41. What does typeof null return?
  42. What does typeof return when used to inspect a function?
  43. JavaScript is a dynamically-typed language. What does this mean?
  44. Give an example of a statically-typed language.

Control Flow

  1. What is meant by control flow?
  2. What are conditional statements?
  3. What are iteration statements?
  4. What does the if statement do?
  5. The body of an if statement can be a block statement. True or false? If false, then give the correct description.
  6. What is a relational operation?
  7. What does the else statement do?
  8. Name any five relational operators in JavaScript along with their symbols.
  9. What does the switch statement do?
  10. What does the case keyword do?
  11. What does the default keyword do?
  12. The default keyword can be used outside switch. True or false?
  13. What is the for statement used for?
  14. Describe the typical syntax of a for statement.
  15. What is meant by a counter variable?
  16. What is the postfix increment operator?
  17. Why is the counter variable of a for loop typically initialized to 0?
  18. What is the while statement used for?
  19. What's the difference between for and while?

Functions

  1. What is a function?
  2. How to create a function in JavaScript using the function keyword?
  3. What is a function's definition?
  4. What is a function's body?
  5. What does it mean to invoke a function?
  6. How to invoke a function?
  7. What is a function parameter?
  8. What is a function argument?
  9. In JavaScript, providing more arguments than a function is meant to entertain results in an error. True or false?
  10. In JavaScript, providing less arguments than a function is meant to entertain results in an error. True or false? If false, then what happens with the parameters that aren't provided arguments?
  11. What does the return keyword do?
  12. The return keyword can be used outside functions as well. True or false?
  13. The return keyword is followed by a statement. True or false? If false, then give the correct description.
  14. What happens to the code written after a return statement?

Operators

  1. What is meant by an operator?
  2. What is meant by an operation?
  3. What is meant by an operand?
  4. What is meant by a unary, a binary, and a ternary operator?
  5. List all the arithmetic operators in JavaScript.
  6. There is only one string operator in JavaScript. True or false? If true, then which operator is it?
  7. How does JavaScript distinguish between string concatenation and arithmetic addition, given that it's denoted via the same + symbol?
  8. Name the operator used in the following expression: i++.
  9. Name the operator used in the following expression: ++i.
  10. How does the expression i++ differ from the expression ++i?
  11. What is meant by a relational operator?
  12. What type of a value does a relational operator return?
  13. List any three relational operators in JavaScript.
  14. What is meant by a logical operator?
  15. List the three logical operators in JavaScript.
  16. What does it mean when we say that || and && are both short-circuit operators in JavaScript?
  17. What is the ?? operator called and what is its purpose?

What now?

If you enjoyed going through this list of questions, and felt like you learnt something new, don't forget to ❤ the article, and give me your invaluable feedback 🙂.

And also make sure to checkout CodeGuage.com for more amazing courses on programming, all for free.

Top comments (0)