JavaScript PreTest
JavaScript PreTest
Name:
Date:
Class:
A. 13
B. 29
C. 33
D. 44
2. If x represents the area of the number line colored blue, which inequality accurately reflects the value of x?
A. x < 6
B. x > 6
C. x ≥ 6
D. x ≤ 6
3. Six identical circles fit inside the rectangle as shown below. If the rectangle has a width of 15 units and a height of 10
units, what is the radius of each circle?
A. 15 units
B. 10 units
C. 5 units
D. 2.5 units
https://codehs.com/quiz/463243/print 1/6
8/24/2018 JavaScript Knowledge & Skills | CodeHS
4. Karel the Dog is instructed to move forward three spaces. Then, if Karel is standing on a ball, Karel will turn right 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?
Starting Point:
A.
B.
C.
D.
https://codehs.com/quiz/463243/print 2/6
8/24/2018 JavaScript Knowledge & Skills | CodeHS
5. Which of the following describes a task effectively broken into smaller parts?
I. Looking for similarities between different bicycles
II. Ignoring unnecessary details in a math problem
III. Getting ready for school by getting dressed and eating breakfast
A. I and II
B. III only
C. II and III
D. All of the above
A. 0 is printed
B. 15 is printed
C. 10 is printed
D. The program results in an infinite loop
A. x has a value of y
y has a value of temp
B. x has a value of 4
y has a value of 6
C. x has a value of 6
y has a value of 4
8. John will buy school lunch if they are serving pizza or grilled cheese and he has more than $10 in his wallet.
Otherwise, John will bring lunch.
In which of the following cases will John buy lunch?
https://codehs.com/quiz/463243/print 3/6
8/24/2018 JavaScript Knowledge & Skills | CodeHS
9. What is the difference between a for loop and a while loop?
A. A for loop repeats commands a specific number of times and a while loop repeats until a condition becomes false.
B. 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.
C. 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.
D. 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.
10. How many times would the phrase ‘codeHS’ be printed in the following scenario:
repeat 3 times {
repeat 2 times {
println("codeHS");
}
}
A. 3 times
B. 6 times
C. 15 times
D. 5 times
11. What is the total number of times Karel moves when the code below is run?
function moveForward() {
for(var i = 0; i < 5; i++) {
move();
}
}
moveForward();
moveForward();
A. 5
B. 10
C. 20
D. 100
A. The program will ask the user for their name and then will print Name is: with the name they entered
B. The program will ask the user for their name and then will print Name is:
https://codehs.com/quiz/463243/print 4/6
8/24/2018 JavaScript Knowledge & Skills | CodeHS
13. What would be printed to the screen when the following program is run?
function returnNumber(x) {
return x *5;
}
println(returnNumber(2));
A. 2
B. 5
C. 10
D. 25
A.
B.
C.
D.
https://codehs.com/quiz/463243/print 5/6
8/24/2018 JavaScript Knowledge & Skills | CodeHS
15. What would be the output of the following code?
var number = 6;
if (number < 5) {
println("Hi");
} else {
println("Hello");
}
A. Hi
B. Hello
C. Hi
Hello
D. No output will be printed to the screen
https://codehs.com/quiz/463243/print 6/6