Questions and Answers Latest Update
Graded A+
Which keyword is used to define a condition in JavaScript?
A) case
B) check
✔✔C) if
D) condition
What is the purpose of an `else` statement?
A) To check another condition
✔✔B) To execute code when the `if` condition is false
C) To define a loop
D) To repeat the `if` statement
Which operator is used to check both value and type in a condition?
✔✔A) ===
B) !=
1
,C) ==
D) =
How can you check multiple conditions in an `if` statement?
A) Using `!`
B) Using a `switch` statement
✔✔C) Using `&&` or `||` operators
D) Using a `for` loop
Which control structure is best suited for selecting one case out of many?
A) for loop
B) if-else
✔✔C) switch
D) while loop
What happens if a `switch` case does not have a `break` statement?
A) The program stops
B) Only that case executes
2
, C) An error occurs
✔✔D) The next case(s) execute as well
What type of loop runs at least once before checking the condition?
A) for
B) while
✔✔C) do...while
D) switch
How do you stop a loop immediately?
✔✔A) break
B) stop
C) return
D) exit
Which statement skips the rest of the current loop iteration?
A) skip
✔✔B) continue
3