wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Coding Pre Test

Total questions: 15

Worksheet time: 30mins

Name
Class
Date
1.

Evaluate the mathematical expression: 18 ÷ 3 + 3 × 3 – 8

a)

2

b)

4

c)

5

d)

7

2.

If x represents the area of the number line colored blue, which inequality accurately reflects the value of x?

a)

x < 8

b)

x > 8

c)

x ≥ 8

d)

x ≤ 8

3.

Melissa will only drink a cup of coffee if she has slept less than 8 hours or she had to wake up before 6 am.

In which of the following cases does Melissa not drink a cup of coffee?

a)

Melissa sleeps for 8 hours and wakes up at 7 am

b)

Melissa sleeps for 7 hours and wakes up at 8 am

c)

Melissa sleeps for 9 hours and wakes up at 5:30 am

d)

Melissa sleeps for 7 hours and wakes up at 6 am

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 move forward two spaces. Given the starting point below, where will Karel end up?

Starting Point:

a)
b)
c)
d)
5.
a)

II only

b)

I only

c)

I and III only

d)

I, II and IIIAnswered I, II and III

6.

a)

x has a value of y

y has a value of temp

b)

x has a value of 5

y has a value of 8

c)

x has a value of 8

y has a value of 5

d)

x and y have a value of 5

7.

You’re building an e-commerce website. You create a class called Transaction to represent a single purchase on the site.

Which of these would not make sense as an instance variable in the Transaction class?

a)

private int totalTransactionsToday

b)

private double price

c)

private String purchaserEmail

d)

private String productName

8.

Which for loop will properly print “good luck” 10 times?

a)

A

b)

B

c)

C

d)

D

9.

What are parameters?

a)

The value that a method returns.

b)

The formal names given to the data that gets passed into a method.

c)

The values that a method prints to the screen.

d)

The type that is given to a variable

10.
a)

10

b)

5

c)

This method is improperly written.

d)

This method returns nothing.

11.

a)

The program does not compile.

b)

dog

c)

The program does not produce any output.

d)

cat

12.

a)

Shape Rectangle Rectangle Oval

b)

Shape Rectangle Square Circle

c)

This code will error

d)

Shape Rectangle Rectangle Circle

13.

a)

II only

b)

III only

c)

I and II

d)

I only

e)

I and III

14.

What value will be held in mysteryNumber when this code finishes running?

a)

17

b)

0

c)

1

d)

16

15.

Given this array:

1 2 4 5 6 7 8 12 14 21 22 42 53

How many comparisons are required to find 42 using the Binary Search?

a)

2

b)

10

c)

3

d)

5