PDF Download
FREE AND STUDY GAMES ABOUT JAVASCRIPT VOCAB
EXAM QUESTIONS
Actual Qs and Ans Expert-Verified Explanation
This Exam contains:
-Guarantee passing score -42 Questions and Answers -format set of multiple-choice -Expert-Verified Explanation
Question 1: Boolean
Answer:
______ are a primitive data type. They can be either true or false.
Question 2: Math.floor()
Answer:
This function returns the largest integer less than or equal to the given number.
console.log(Math.floor(5.95));
// Prints: 5
Question 3: Numbers
Answer:
_______ are a primitive data type. They include the set of all integers and floating point numbers.
let amount = 6; let price = 4.99;
Question 4: Null
Answer:
is a primitive data type. It represents the intentional absence of value.
let x = null;
Question 5: If Else
Answer:
If condition is truthy = executes. If falsy, another state can be executed.
function testNum(a) { let result; if (a > 0) { result = 'positive'; } else { result = 'NOT positive'; } return result; }
console.log(testNum(-5));
Question 6: Return
Answer:
Specifies the value to be returned by a function.
Question 7: Function Expression
Answer:
The function keyword can be used to define a function inside an expression.
const getRectArea = function(width, height) { return width * height; };
console.log(getRectArea(3, 4));
// expected output: 12
Question 8: Method .pop()
Answer:
This method removes the last element from an array and returns that element.
const ingredients = ['eggs', 'flour', 'chocolate'];
const poppedIngredient = ingredients.pop(); // 'chocolate' console.log(ingredients); // ['eggs', 'flour']
Question 9: Method .push()
Answer:
Adding one or more elements to the end of an array.
// Adding multiple elements:
const numbers = [1, 2]; numbers.push(3, 4, 5);
console.log(numbers)
// [1, 2, 3, 4, 5 ]
Question 10: Function Declaration
Answer:
This (function statement) defines a function with the specified parameters.
function calcRectArea(width, height) { return width * height; }
console.log(calcRectArea(5, 6));
// expected output: 30
Question 11: Relational Operators
Answer:
in instanceof < > <= >=
Question 12: Const
Answer:
______ are block-scoped, much like variables defined using the let keyword. The value of a constant can't be changed through reassignment, and it can't be redeclared.
Question 13: String Concatenation
Answer:
Multiple strings can be put together using the + operator.
let service = 'credit card'; let month = 'May 30th'; let displayText = 'Your ' + service + ' bill is due on ' + month + '.';
Question 14: Mutable
Answer:
JavaScript arrays are _____ meaning that the values they contain can be changed.
Question 15: Object
Answer:
This class represents one of JavaScript's data types. It is used to store various keyed collections and more complex entities.
Question 16: Class
Answer:
Declares a class.
Question 17: string.length
Answer:
The .length property of a string returns the number of characters that make up the string.
Question 18: Arithmetic Operators
Answer:
- addition
- subtraction
- multiplication
/ division % modulo ** exponents