wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Practice for Comp Prog A Quiz #5

Total questions: 18

Worksheet time: 9mins

Name
Class
Date
1.

What kind of array is grid?

a)

1d

b)

2d

c)

3d

d)

4d

2.

How many rows does grid have?

a)

1

b)

2

c)

3

d)

4

3.

How many columns does grid have?

a)

1

b)

2

c)

3

d)

4

4.

What would be returned by the call mystery([0,2,4,6])?

a)

false

b)

true

c)

undefined

5.

What is the value of grid[0][0]?

a)

false

b)

true

c)

undefined

6.

What is 17 % 19?

a)

1

b)

2

c)

17

d)

19

7.

What is the value of grid[2][0]?

a)

false

b)

true

c)

undefined

8.

What would be returned by the call mystery([3, 4])?

a)

7

b)

-1

c)

[4,3]

d)

[3,4]

9.

What is the value of grid[0][2]?

a)

false

b)

true

c)

undefined

10.

Which of the following if statements would test to see if a row number was NOT valid on a 5x5 grid because it was above the top of the grid?

a)

if(r<0)

b)

if(r<=0)

c)

if(r>0)

d)

if(r>=0)

11.

What is the output of this program?

a)

11 4

b)

36 -4

c)

8 -4

d)

7 6

12.

What is 19 % 17?

a)

1

b)

2

c)

17

d)

19

13.

Which of the following would be the best replacement for /* missing code */ for flipLight in the lights out game?

a)

true

b)

false

c)

!grid[row][col]

14.

Which of the following if statements would test to see if a row number was NOT valid on a 5x5 gird because it was below the bottom of the grid?

a)

if(r<4)

b)

if(r<=4)

c)

if(r>4)

d)

if(r>=4)

15.

What is 11 % 523496?

a)

0

b)

11

c)

523496

d)

error

16.

How many variables are in this JavaScript program?

a)

1

b)

2

c)

5

d)

11

17.

Which of the following if statements would test to see if a row number was NOT valid on a 5x5 grid because it was below the bottom of the grid?

a)

if(r<4)

b)

if(r<=4)

c)

if(r>4)

d)

if(r>=4)

18.

What is the output of this program?

a)

4 3

b)

16 15

c)

4 4

d)

-4 -3