NEW
Font size
WorksheetsCode HS Computer SCi 114.1.1 JavaScript Final Exam Pt. 1
Total questions: 25
Worksheet time: 13mins
Evaluate the mathematical expression: 3 + 4 x 6 / 2.
12
15
21
42
If x represents the area of the number line colored blue, which inequality accurately reflects the value of x?
x < 4
x ≤ 4
x > 4
x ≥ 4
Twelve identical circles fit inside the rectangle as shown below. If the rectangle has a width of 32 units and a height of 24 units, what is the radius of each circle?
32
24
8
4
Karel the Dog is instructed to move forward two spaces. Then, if Karel is standing on a ball, Karel will turn left and move forward two spaces. Otherwise, Karel will turn around and move forward two spaces. Given the starting point below, where will Karel end up?
Which of the following describes a task effectively broken into smaller parts?
I. Making a list of your favorite colors
II. Throwing a dinner party by making a guest list, buying ingredients, and cooking food
III. Comparing the syntax of Python and JavaScript
I and II
III only
II only
All of the above
Consider the following program code, where hours is an input from the user. Of the following choices, select the value for hours that would cause this program to print “Good Afternoon!”
12
15
18
"Good afternoon"
What is the final value of the following boolean statement stored in goodNum?
true
false
6
10
Consider the following function. Which of the options below correctly picks the variable that is the return value?
xDistOff
total
xPos
MAX_Y
Which of the following statements is the best reason for why comments are important?
Comments help you break down your code into smaller pieces
Comments help programmers learn new languages
Comments help you and others read and understand your code
Comments help explain what for loops do
What will be printed from the following for loop?
0
5
10
0
5
0
0
1
2
3
4
5
6
7
8
9
Consider the picture below. There are two circles labelled A and B. Circle A is at position (100, 100). Which of the following choices most accurately describes circle B’s position? The red lines are for reference. They cross at the center of the screen.
(400, 100)
(100, 400)
(200, 200)
(100, -100)
The difference between local variables and global variables is:
Local variables can only be used in the function they are declared in, while global variables can be used anywhere in the code
Global variables can only be used in the function they are declared in, while local variables can be used anywhere in the code
Local variables are named using lower camelcase while global variables are named using all capital letters
There is no difference between local and global variables
Which of the following variables is a parameter in the function below?
c
i
b
d
Which of the following successfully switches the values of the variables x and y? The var temp may be used as a temporary variable if necessary.
x = y;
y = x;
var temp = x;
y = x;
temp = y;
var temp = y;
x = y;
y = temp;
var temp = x;
x = y;
y = temp
Eliza will wear a coat if it is raining or if it is less than 50° F outside. Otherwise,
Eliza will leave her coat at home.
In which of the following cases will Eliza leave her coat at home?
It is raining and 30°F
It is raining and 55°F
It is not raining and 45°F
It is not raining and 50°F
What is the difference between a for loop and a while loop?
A for loop repeats commands a specific number of times and a while loop repeats until a condition becomes false.
A for loop is used to make decisions between two options and a while loop is used to make decisions between 3 options or more
A for loop is used when the variable is less than 10 and a while loop is used when the variable is 10 or greater.
A for loop is used when we only need to meet one condition and a while loop is used when there are two or more conditions.
Consider the following program code:
0 is printed
1 is printed
3 is printed
6 is printed
How many times would the phrase ‘codeHS’ be printed in the following scenario:
2 times
6 times
8 times
16 times
What is the total number of times Karel moves when the code below is run?
1
5
8
10
What will the following program do when run?
The program will ask the user for a number and then will print Number is: with the number they entered
The program will ask the user for a number and then will print Number is:
The program will print Number is:
The program will print Enter a number: and then print Number is:
What would be printed to the screen when the following program is run?
2
3
5
6
What will be the output of the following program?
What is an event in JavaScript?
Something you buy tickets to and attend.
What is returned from a function.
A function that responds to a timer going off.
Something that is triggered based on the user’s action.
Choose the correct logical operator to fill in the blank in the if statement. You may assume that the variable ‘age’ has already been initialized.
&&
| |
==
!=
What is the final value of the following boolean statement stored in goodNum?
true
false
6
12
