No student devices needed. Know more
33 questions
.
Jasmine is writing a shopping app. She has created a variable to keep track of the number of items in the shopping cart. Every time someone clicks the "addItemButton", she would like the variable to increase by 1.
What code should Jasmine insert where it says <missing code> in order for her app to work?
cart total = 1;
cartTotal + 1;
cartTotal = cartTotal +1;
var cartTotal = cartTotal + 1;
var cartTotal + 1;
Jose is writing a reply function for a text messaging 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 up in From
Which of the following code segments will correctly swap the values as described?
A programmer wrote an essay for his history class, and realized he has confused the names of Benjamin Franklin and Alexander Graham Bell. Instead of going through the whole paper and changing the names, he used the following incorrect algorithm in an attempt replace every occurrence of "Benjamin Franklin" with "Alexander Graham Bell" and vise versa:
First, change all occurrences of "Benjamin Franklin" to "apple" Then, change all occurrences of "apple" to "Alexander Graham Bell". Then, change all occurrences of "Alexander Graham Bell" to "Benjamin Franklin".
Here is an example of one of the sentences from the paper:
Alexander Graham Bell was born 141 years before Benjamin Franklin, so he was never able to telephone his neighbors.
Which of the following is the result of running the described incorrect algorithm on the sentence above?
Benjamin Franklin was born 141 years before Alexander Graham Bell, so he was never able to telephone his neighbors.
apple was born 141 years before Benjamin Franklin, so he was never able to telephone his neighbors.
Alexander Graham Bell was born 141 years before apple, so he was never able to telephone his neighbors.
Benjamin Franklin was born 141 years before Benjamin Franklin, so he was never able to telephone his neighbors.
Alexander Graham Bell was born 141 years before Alexander Graham Bell, so he was never able to telephone his neighbors.
Which of the following images is the most likely outcome of the drawing?
What is displayed by the console.log statement after the following code segment executes?
value is: 2
value is: 2.3333333
value is: 3
value is: 4
value is: c
A student decides to draw a series of three dots (sort of like a snowman) as shown in the diagram. She wants each dot to be half the radius of the previous dot, and for the center to be on the edge of the dot below it. She writes the following code segment to do it.
What is the output to the console after the following code segment is executed?
-2
3
5
8
Error. Unknown Identifier: x
What is the output to the console after the following code segment is executed?
5
8
10
13
Error. Cannot make a new variable x inside function increase()
Consider the following flow chart showing a process for program execution. Given that a = 5, and b = 10, what will be displayed by the program?
a is bigger
b
5
10
Nothing will be displayed
What is a possible output when the following code segment executes? The ending position of the turtle is shown in each diagram. The starting position is shown as a white triangle in cases where the turtle starts and ends in different locations.
Which of the following JavaScript statements will result in the following output being displayed to the console?
Hello!
How are you?
console.log("Hello! \tHow are you?");
console.log("Hello! \bHow are you?");
console.log("Hello! \newLineHow are you?");
console.log("Hello! \nHow are you?");
console.log("Hello! \nlHow are you?");
What is the output of the following JavaScript code segment?
5hello
5 + hello
error on num + str: type mismatch
result
What is the output of the following JavaScript code segment?
10
error on str1 + str2: type mismatch
55
result
A Boolean expression is an expression that evaluates to which of the of the following?
Yes/Maybe/No
True/False
Any Integer
Integers between 1 and 10
Any single character
What is the expected output of the given pseudo code segment? A reference for the pseudo code can be found immediately below the question
35
true
false
You are not old enough to be President.
You are old enough to be President.
Consider the following segment given in pseudo code. What will be displayed if grade is set to 70?
You passed!
Time to start studying again!
You passed! and Time to start studying again!
Nothing will be displayed
An error will occur on line 7; you cannot have an IF inside an ELSE statement
Consider the JavaScript code segment below. Which statement should be used in place of <missing code> such that the alarm is set to 9:00 am on weekends, and 6:30 am on weekdays.
day == "Saturday"
day == "Sunday"
(day == "Saturday") || (day == "Sunday")
(day == "Saturday") && (day == "Sunday")
day != "Monday"
If the above code segment is run, and "hello" is entered at the prompt, what will be displayed in the console?
Wow, big word.
Did you say something? That was so short.
Use that word on the SAT.
I have never heard that before.
Nothing will be printed.
If the above code segment is run, and "goodbye" is entered into the prompt, what will be displayed in the console?
Wow, big word.
Did you say something? That was so short.
Use that word on the SAT.
I have never heard that before.
Nothing will be printed.
Something is wrong with the logic in the program above. For which values of time will the greeting "Good Morning" be displayed?
Any time between 6 and 9
Any time between 10 and 19
Any time between 0 and 20
There is no value of time that will result in "Good Morning" being displayed
The logic error will cause the program to stop running at line 7.
30
50
75
125
200
(temperature > 0) && (temperature < 32)
(temperature == 0) || (temperature < 32)
(temperature != 0) && (temperature < 32)
(temperature == 0) || (temperature > 32)
(temperature < 0) || (temperature > 32)
Which of the following is true about while loops ?
While loops terminate after a fixed number of loops that is pre-determined
While loops terminate after a fixed number of loops that is determined after the loop executes once.
While loops run as long as a given boolean condition is true.
While loops run as long as a given boolean condition is false.
While loops are known as "forever loops" and never stop until the program is halted by the user.
Answer
4
7
9
10
ab
2
3
4
5
6
0
1
2
8
Error. Index 3 does not exist.
1
2
3
6
Error. There is no index 2.
Explore all questions with a free account