Question: this is for javascript When you use the relational operators, you can compare Question 1 options: a variable with a literal value a variable with
this is for javascript
When you use the relational operators, you can compare
Question 1 options:
| a variable with a literal value | |
| a variable with another variable | |
| a variable with an arithmetic expression | |
| all of the above | |
| A and B only |
Question 2 (1 point)
The equal to (==) and not equal to (!=) operators should
Question 2 options:
| not be used to compare floating-point numbers | |
| not be used in a conditional expression | |
| not be used with the isNaN() method |
Question 3 (1 point)
What value is returned by the following expression? !isNaN("12.345")
Question 3 options:
| true | |
| false | |
| NaN | |
| undefined |
Question 4 (1 point)
Which of the following is NOT a relational operator?
Question 4 options:
| > | |
| >= | |
| != | |
| = |
Question 5 (1 point)
Which of the following will test whether a Boolean variable named isValid is true?
Question 5 options:
| isValid == true | |
| isValid | |
| !isValid == false | |
| all of the above |
Question 6 (1 point)
If you use a short-circuit operator to combine two expressions
Question 6 options:
| both expressions are always evaluated | |
| the second expression is evaluated only if it can affect the result | |
| the first expression is evaluated only if it can affect the result | |
| the result of each expression is reversed |
Question 7 (1 point)
In the following statement, which expression is evaluated first? var truth = !A || B && (C || D)
Question 7 options:
| !A | |
| B && (C || D) | |
| C || D | |
| !A || B |
Question 8 (1 point)
The condition for a while loop is tested
Question 8 options:
| before the statements in the loop are executed | |
| after the statements in the loop are executed | |
| before and after the statements in the loop are executed | |
| before or after the statements in the loop are executed, depending on how the condition is coded |
Question 9 (1 point)
If you want the block of code in a loop to be executed at least once, you would normally use
Question 9 options:
| a while loop | |
| a for loop | |
| a do-while loop | |
| either A or C |
Question 10 (1 point)
When the code that follows is executed, a message is displayed if the value the user enters var userEntry = (prompt("Enter cost:"); if (isNaN(userEntry) || userEntry > 500 ) { alert ("Message"); }
Question 10 options:
| isnt a number or the value in userEntry is more than 500 | |
| isnt a number and the value in userEntry is more than 500 | |
| is a number or the value in userEntry is more than 500 | |
| is a number and the value in userEntry is more than 500 |
Question 11 (1 point)
After the code that follows is executed, what is the value of discountAmount? var discountAmount; var orderTotal = 200; if (orderTotal > 200) { discountAmount = orderTotal * .3; } else if (orderTotal > 100) { discountAmount = orderTotal * .2; } else { discountAmount = orderTotal * .1; }
Question 11 options:
| 0.0 | |
| 20.0 | |
| 40.0 | |
| 60.0 |
Assume that the variables named entry and number have starting values of 9 and 3 respectively. What is the value of entry after the following statements are executed? if ((entry > 9) || (entry/number == 3)) { entry--; } else if (entry == 9) { entry++; } else { entry = 3; }
Question 12 options:
| 3 | |
| 8 | |
| 9 | |
| 10 |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
