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
- Who created JavaScript?
- In which year was JavaScript first released?
- What means when we say that JavaScript is a scripting language?
- What means when we say that JavaScript is a high-level language?
- What is meant by an implementation of JavaScript?
- Name one implementation of JavaScript.
- What programming paradigms does JavaScript support?
- Where do we write JavaScript code so that it could be run in the browser?
- What is an external JavaScript file?
- How is a JavaScript file linked to in a webpage?
- List 3 benefits of using an external JavaScript file for a webpage.
Console
- What is the console?
- What is meant when we say that the console is a REPL environment for executing JavaScript?
- The sole function of the console is to execute JavaScript. True or false? If false, then what else can it do?
- How to log anything to the console?
Basics
- What are integers?
- What are floats?
- JavaScript has separate types for integers and floats. True or false? If false, then give the correct explanation.
- Name any five basic arithmetic operators that JavaScript provides along with their symbols.
- What is meant when we say that the multiplication operator has a higher precedence than the addition operator in JavaScript?
- How can we enforce a particular operation to happen before the other?
- What is a string?
- Give the three ways to denote a string in JavaScript.
- What's the difference between single-quoted and double-quoted strings in JavaScript?
- Can a single- or double-quoted string in JavaScript span multiple lines in source code?
- What is an escape sequence?
- List any three escape sequences.
- How to denote new lines in single-quoted or double-quoted strings?
- What is string concatenation?
- Which symbol is used to perform string concatenation in JavaScript?
- What is a variable?
- How to create a variable in JavaScript?
- Define the term 'keyword' in JavaScript. Give an example of a keyword.
- What is variable declaration?
- What is variable initialization?
- What is variable assignment?
- How is variable initialization different from variable assignment?
- In JavaScript, a variable can hold values of any arbitary type. True or false? If false, then give the correct explanation.
- Name the three different kinds of dialog boxes that could be shown using JavaScript.
- Give the corresponding functions that can be used to show these dialogs.
- What kind of values does
confirm()
return? - What does the second argument to
prompt()
do? prompt()
always returns a string, even if the Cancel button is clicked. True or false? If false, then give the correct explanation.- How to convert a string to a number?
Variables
- What are the different variations of declaring variables using
var
? - Name three rules of naming variables in JavaScript.
- Which casing convention is commonly used to name things in JavaScript?
- How to check whether a given variable exists?
- What is variable hoisting?
- What is the
let
keyword? - Give two differences between
let
andvar
. - What is meant by the temporal dead zone of a variable creating using
let
?
Constants
- What are constants in programming?
- How to define a constant in JavaScript?
- A constant can be defined without an initializer. True or false? If false, then give the correct description.
- What is screaming snake casing and why is it commonly used to name constants in programming?
- What are the rules for naming constants in JavaScript?
Comments
- What are comments in programming?
- Give two uses of comments in programming.
- Name the two kinds of comments in JavaScript.
- How to write a comment of each kind?
- Give two tips for writing good comments.
Data types
- What is a data type?
- What are primitives and objects in JavaScript?
- Give one difference between primitives and objects?
- Name the seven primitive types of JavaScript.
- Take the numbers
10
and10.5
. JavaScript considers these numbers to be of distinct types. True or false? If false, then give the correct explanation. - What is a number literal?
- What is meant by the index of a character of a string?
- What is the total number of characters in a string called?
- How to retrieve the total number of characters of a string in JavaScript?
- How can a primitive in JavaScript have a property available on it? Explain the phenomenon that enables this?
- What is a Boolean?
- Give the two Boolean values of JavaScript.
- What is the purpose of the special value
undefined
in JavaScript? - What is the purpose of the special value null in JavaScript?
- What is an array?
- What is meant by an 'element' of an array?
- What is meant by the index of an element of an array?
- How to access the fifth element of an array stored in the variable
arr
? - What is the total number of items in an array called?
- How to retrieve the total number of items of an array?
- 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.
- What is an array literal?
- What happens when we access an out-of-range index of an array in JavaScript? Do we get an error?
- Which method can be used to sort an array?
- What means when we say that a method modifies an array in-place?
- What is a function?
- Functions in JavaScript can be named or anonymous. True or false? If false, then give the correct description.
- Which keyword is used to define functions in JavaScript?
- What is the difference between function parameters and arguments?
- What is meant by the body of a function?
- What is meant by the definition of a function?
- What is meant by invoking a function?
- How to invoke a function stored in a variable
func
in JavaScript? - How to return a given value from a function?
- What is an object?
- What is an object literal?
- What is meant by the property of an object?
- How to access the property named
bar
of an object stored in the variablefoo
? - What is the purpose of the
typeof
keyword in JavaScript? - The
typeof
keyword represents an expression. True or false? If false, then give the correct description. - What does
typeof null
return? - What does
typeof
return when used to inspect a function? - JavaScript is a dynamically-typed language. What does this mean?
- Give an example of a statically-typed language.
Control Flow
- What is meant by control flow?
- What are conditional statements?
- What are iteration statements?
- What does the
if
statement do? - The body of an
if
statement can be a block statement. True or false? If false, then give the correct description. - What is a relational operation?
- What does the
else
statement do? - Name any five relational operators in JavaScript along with their symbols.
- What does the
switch
statement do? - What does the
case
keyword do? - What does the
default
keyword do? - The
default
keyword can be used outsideswitch
. True or false? - What is the
for
statement used for? - Describe the typical syntax of a
for
statement. - What is meant by a counter variable?
- What is the postfix increment operator?
- Why is the counter variable of a
for
loop typically initialized to0
? - What is the
while
statement used for? - What's the difference between
for
andwhile
?
Functions
- What is a function?
- How to create a function in JavaScript using the
function
keyword? - What is a function's definition?
- What is a function's body?
- What does it mean to invoke a function?
- How to invoke a function?
- What is a function parameter?
- What is a function argument?
- In JavaScript, providing more arguments than a function is meant to entertain results in an error. True or false?
- 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?
- What does the
return
keyword do? - The
return
keyword can be used outside functions as well. True or false? - The
return
keyword is followed by a statement. True or false? If false, then give the correct description. - What happens to the code written after a
return
statement?
Operators
- What is meant by an operator?
- What is meant by an operation?
- What is meant by an operand?
- What is meant by a unary, a binary, and a ternary operator?
- List all the arithmetic operators in JavaScript.
- There is only one string operator in JavaScript. True or false? If true, then which operator is it?
- How does JavaScript distinguish between string concatenation and arithmetic addition, given that it's denoted via the same
+
symbol? - Name the operator used in the following expression:
i++
. - Name the operator used in the following expression:
++i
. - How does the expression
i++
differ from the expression++i
? - What is meant by a relational operator?
- What type of a value does a relational operator return?
- List any three relational operators in JavaScript.
- What is meant by a logical operator?
- List the three logical operators in JavaScript.
- What does it mean when we say that
||
and&&
are both short-circuit operators in JavaScript? - 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)