solutions
Which of the following are actions a programmer could take when debugging a segment of code that
could most likely lead to finding a problem and fixing it? - correct answer ✔✔Display the value of
variables at various points during the program.
Which of the following is FALSE about element IDs? - correct answer ✔✔An element with a unique ID
must always have an event handler associated with it.
What is the output to the console after the following code segment is executed?
1. var x = 10; - correct answer ✔✔13
Jose is writing a reply function for a text message app. He'd like to swap the sender and receiver so that
the value currently in variable From ends up as the value in To and To ends in From.
Which of the following code segments will correctly swap the values as described? - correct answer
✔✔var temp = from;
from = to;
to = temp:
Assume that a variable temperature is assigned like this:
var temperature = 30;
Choose the two (2) Boolean expressions that evaluate to FALSE. - correct answer ✔✔(temperature == 0)
|| (temperature > 32)
, Consider the code segment below given in pseudo code (see reference above). Assuming that variables
a, b and c already have numeric values assigned to them, what is the expected output of this code
segment?
val <- a
IF(b >= a AND b >= c){
val <- b;
}
ELSE
{
IF (c >= a AND c >= b)
{
val <- c;
}
}
DISPLAY (val); - correct answer ✔✔The code will display the largest of the three values
Which of the following images is the most likely outcome of the drawing? - correct answer ✔✔the
square, with the cursor pointed towards the top of the paper in the left corner.
A programmer wrote an essay for his history class, and realized he has confused the names of Benjamin
Franklin and Alexander Graham Bell. - correct answer ✔✔Benjamin Franklin was born 141 years before
Benjamin Franklin, so he was never able to telephone his neighbors.
Which of the following JavaScript statements will result in the following output being displayed to the
console?
Hello!
How are you? - correct answer ✔✔console.log("Hello! \nHow are you?");