Primitive Data Types
Which of the following is NOT a primitive data type in JavaScript?
- A. string
- B. object
- C. boolean
- D. number
- E. symbol
Undefined vs Null
If a variable is declared but not assigned a value in JavaScript, what is its value?
- A. null
- B. zero
- C. undefined
- D. false
- E. empty
Undeclared Variables
In JavaScript, what does 'undeclared' mean in the context of variables?
- A. Using a variable declared with var/let/const but unassigned
- B. Using a variable that was never declared with var/let/const
- C. A variable set to undefined
- D. A variable set to null
- E. A variable declared with double equals
Variable Declaration
Which of the following are correct ways to declare a variable in JavaScript?
- A. declare x = 5;
- B. let x = 5;
- C. assign x = 5;
- D. varLet x = 5;
- E. variable x = 5;
Var, Let, and Const Differences
Which statement correctly describes the variable declared with const?
- A. Can be redeclared and updated
- B. Is globally scoped and can be reassigned
- C. Cannot be reassigned or updated once set
- D. Automatically gets undefined value
- E. Can only be used in loops
Hoisting Definition
What does 'hoisting' mean in JavaScript?
- A. Running all code twice automatically
- B. Moving all statements to the bottom of the file
- C. Moving variable and function declarations to the top of their scope
- D. A process where variables are deleted after use
- E. Sorting array elements to the top
Callback Functions
Which best describes a callback function in JavaScript?
- A. A function that runs only when an error occurs
- B. A function that is never called
- C. A function passed as an argument to another function and invoked inside
- D. A function that returns another function
- E. A function called twice in a row
Asynchronous Handling
Which is NOT a valid way to handle asynchronous operations in JavaScript?
- A. Callback functions
- B. Promises
- C. async/await
- D. Synchronous loops
- E. setTimeout
Equality Operators
What is the main difference between '==' and '===' in JavaScript?
- A. '==' compares only types, '===' compares only values
- B. '==' does type coercion, '===' checks both type and value without coercion
- C. '==' is for numbers, '===' is for strings
- D. '==' is slower than '==='
- E. They are always interchangeable
The DOM
What does the Document Object Model (DOM) represent in JavaScript?
- A. A list of all functions in a script
- B. A database of user data
- C. A programming interface for HTML and XML documents
- D. The output of the console.log function
- E. A mathematical model for algorithms