JAVASCRIPT MAIN EXAM MANUAL 2026/2027 QUESTIONS
AND SOLUTIONS RATED A+
✔✔Which of these options does NOT require the use of parentheses?
A. console.log
B. prompt
C. alert
D. document.write
E. innerHTML - ✔✔E
✔✔Which of the following does not generate output directly to the screen?
A. console.log(message);
B. document.write(message);
C. element.innerHTML = message; - ✔✔A
✔✔How does prompt differ from alert?
A. Only alert uses parentheses.
B. The alert will return a value, prompt does not.
C. Only prompt uses parentheses.
D. The prompt will return a value, alert does not. - ✔✔D
✔✔Variables allow you to save data. ( T/F ) - ✔✔T
✔✔In JavaScript the keyword ___________ is used to declare a variable. - ✔✔var
✔✔What does it mean that variables are case-sensitive?
A. That all variables must use uppercase letters
B. That all variables must use lowercase letters
C. That the computer does not think that the variables name and Name are the same
thing. - ✔✔C
✔✔Which of the following is not a valid variable name?
A. variableOne
B. oneVariable
C. variable1
D. 1variable - ✔✔D
✔✔Which of the following is not a valid variable name?
A. variable-2
B. variable_2
C. variable$2 - ✔✔A
✔✔What does mnemonic mean?
A. That variable names should help describe the value being stored.
, B. That variable names should be as short as possible, preferably with no more than
two or three characters.
C. That variable names should start with lowercase letters and use uppercase letters if
the variable has multiple parts, e.g. firstName. - ✔✔A
✔✔What is wrong with this code?
var name = "Mike";
"Colleen" = name;
A. It is illegal to change the value stored in a variable
B. This code is illegal and it doesn't make sense to have a non-variable ( also called a
constant) in the left-hand side (LHS) of an assignment statement
C. The variable declaration is illegal - ✔✔B
✔✔What value is stored in name if the person hits the Cancel button on a prompt?
var name = prompt("What is your name?"); - ✔✔null
✔✔What value is stored in name if the person hits the Okay button on a prompt before
entering anything?
var name = prompt("What is your name?");
A. an empty string("")
B. undefined
C. exception - ✔✔A
✔✔To create a String variable, use quotes around the value you want to save. ( T/F ) -
✔✔T
✔✔Boolean variables store either true or false. ( T/ F) - ✔✔T
✔✔When a function returns a node from the DOM, it is of type
A. Number
B. Object
C. String
D. Boolean - ✔✔B
✔✔A function that wants to return multiple values at once (such as
document.getElementsByTagName) will return a/an
A. Number
B. Array
C. String - ✔✔B
AND SOLUTIONS RATED A+
✔✔Which of these options does NOT require the use of parentheses?
A. console.log
B. prompt
C. alert
D. document.write
E. innerHTML - ✔✔E
✔✔Which of the following does not generate output directly to the screen?
A. console.log(message);
B. document.write(message);
C. element.innerHTML = message; - ✔✔A
✔✔How does prompt differ from alert?
A. Only alert uses parentheses.
B. The alert will return a value, prompt does not.
C. Only prompt uses parentheses.
D. The prompt will return a value, alert does not. - ✔✔D
✔✔Variables allow you to save data. ( T/F ) - ✔✔T
✔✔In JavaScript the keyword ___________ is used to declare a variable. - ✔✔var
✔✔What does it mean that variables are case-sensitive?
A. That all variables must use uppercase letters
B. That all variables must use lowercase letters
C. That the computer does not think that the variables name and Name are the same
thing. - ✔✔C
✔✔Which of the following is not a valid variable name?
A. variableOne
B. oneVariable
C. variable1
D. 1variable - ✔✔D
✔✔Which of the following is not a valid variable name?
A. variable-2
B. variable_2
C. variable$2 - ✔✔A
✔✔What does mnemonic mean?
A. That variable names should help describe the value being stored.
, B. That variable names should be as short as possible, preferably with no more than
two or three characters.
C. That variable names should start with lowercase letters and use uppercase letters if
the variable has multiple parts, e.g. firstName. - ✔✔A
✔✔What is wrong with this code?
var name = "Mike";
"Colleen" = name;
A. It is illegal to change the value stored in a variable
B. This code is illegal and it doesn't make sense to have a non-variable ( also called a
constant) in the left-hand side (LHS) of an assignment statement
C. The variable declaration is illegal - ✔✔B
✔✔What value is stored in name if the person hits the Cancel button on a prompt?
var name = prompt("What is your name?"); - ✔✔null
✔✔What value is stored in name if the person hits the Okay button on a prompt before
entering anything?
var name = prompt("What is your name?");
A. an empty string("")
B. undefined
C. exception - ✔✔A
✔✔To create a String variable, use quotes around the value you want to save. ( T/F ) -
✔✔T
✔✔Boolean variables store either true or false. ( T/ F) - ✔✔T
✔✔When a function returns a node from the DOM, it is of type
A. Number
B. Object
C. String
D. Boolean - ✔✔B
✔✔A function that wants to return multiple values at once (such as
document.getElementsByTagName) will return a/an
A. Number
B. Array
C. String - ✔✔B