What is the purpose of the 'do-while' loop in JavaScript?
To declare a function.
To execute a block of code only if a condition is true.
To skip the current iteration of a loop.
To execute a block of code at least once, and then repeatedly as long as a condition is true.
Which block of code is executed regardless of whether an error is thrown or caught?
finally
throw
try
catch
Is it possible to have multiple 'catch' blocks associated with a single 'try' block?
Yes, to handle different error types specifically
No, you can only have one 'catch' per 'try'
Only if you re-throw the error inside the first 'catch'
Only if the 'try' block is nested inside another 'try'
How do you access the value associated with the key 'name' in the object person = {name: 'John', age: 30}?
person = {name: 'John', age: 30}
person['name']
person.get('name')
person[0]
person.name
Which method is used to select an HTML element with a specific ID?
querySelector()
getElementById()
getElementbyId()
querySelectorAll()
Which data type represents a sequence of characters in JavaScript?
string
boolean
object
number
Which of these is a valid way to embed JavaScript in an HTML file?
<javascript> alert('Hello!'); </javascript>
<js> alert('Hello!'); </js>
What is the result of the expression: 10 % 3?
10 % 3
1
3
0
10
How do you access the value entered into a text input field in a form?
inputElement.text
inputElement.getValue()
inputElement.data
inputElement.value
How many times will the following loop iterate?
for (let i = 1; i <= 10; i += 2) { console.log(i); }
6
5
infinite