wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

CP CSP Final Exam Study 2023

Total questions: 79

Worksheet time: 42mins

Name
Class
Date
1.

What is output by line 6?

(a)  

2.

What is output by line 6?

(a)  

3.

What is output by line 5?

(a)  

4.

What is output by the program?

a)

less than 10

b)

less than 20

c)

less than 30

d)

30 or more

5.

What is output by the program?

a)

Option A

b)

Option B

c)

Option C

d)

Option D

e)

Option E

6.

What is needed to complete the code?

(a)  

7.

What will the value of bags be at the end of the program?

(a)  

8.

A certain computer game is played between a human player and a computer-controlled player. Every time the computer-controlled player has a turn, the game runs slowly because the computer evaluates all potential moves and selects the best one. Which of the following best describes the possibility of improving the running speed of the game.

a)

The game's running speed can only be improved if the game is played between two human players instead of with the computer-controlled player.

b)

The game's running speed might be improved by using a process that finds approximate solutions every time the computer-controlled player has a turn.

c)

The game's running speed cannot be improved because computers can only be programmed to find the best possible solution.

d)

The game's running speed cannot be improved because the game is an example of an algorithm that does not run in a reasonable time.

9.

What number will be output by the console.log command on line 7?

a)

10

b)

100

c)

20

d)

200

10.

What number will be output by the console.log command on line 5?

a)

10

b)

11

c)

12

d)

13

e)

16

11.

What number will be output by the console.log command on line 5?

a)

10

b)

25

c)

30

d)

35

12.

What text will be output by the program?

a)

less than 10

b)

less than 20

c)

less than 30

d)

30 or more

13.

What text will be output by the program?

a)

Output A

b)

Output B

c)

Output C

d)

Output D

e)

Output E

14.

What will be the order of letters printed to the console when this program is run?

a)

a b c

b)

a b c b c b c

c)

a b c b c

d)

a b c a

15.

"You win!" never displays. What change would fix this issue?

a)

Line 1 - change variable name to totalScore

b)

Line 3 - remove var

c)

Line 4 - change conditional to score >= 5

d)

Line 5 - change to a getText command

16.

When this function is called, the smaller of two numbers is displayed. What Boolean expression would not work in line 12 in order to accomplish this goal?

a)

b)

c)

d)

17.

This function chooses the screen to display based on the score. What is the correct way to call this function?

a)

b)

c)

d)

18.

There is repeated code in these onEvent blocks. Choose the correct code for the updateScreen() function which would be called in each of the onEvent blocks.

a)

b)

c)

d)

19.

A movie theater charges different ticket prices based on a customer's age. The prices are shown in the table below.

The customer's age is stored in the variable age and the price is stored in the variable price. Which piece of code will correctly decide the price for each ticket.

a)

b)

c)

d)

20.

A museum charges different prices based on the day of the week and age of the visitor. The pricing rules are shown below.

On Tuesday and Thursday children 10 and under get in free ($ 0).

For all other days and ages the cost is ten dollars ($ 10).

The visitor's age is stored in the variable age, the day of the week is stored in a variable day, and the price in dollars is stored in the variable price. Which piece of code will correctly decide the price for each ticket.

a)

b)

c)

d)

21.

What will the value of the variable bags be at the end of the flowchart shown here?

a)

1

b)

2

c)

3

d)

4

22.

Choose the correct definition for Conditional Statement

a)

affects the sequential flow of control by executing different statements based on the value of a Boolean expression

b)

stores information as a number, String, or Boolean

c)

joins together two or more strings end-to-end to make a new string

d)

an ordered sequence of characters

23.

Which of the following is true of functions?

a)

Programs written with functions run more quickly

b)

  Functions can help remove repeated code from a program

c)

Replacing repeated code with a function will reduce the number of commands the computer needs to run

d)

Functions are called once but can be declared many times

24.

What number will be output by the console.log command on line 7?

a)

10

b)

100

c)

20

d)

200

25.

What number will be output by the console.log command on line 5?

a)

10

b)

11

c)

12

d)

13

e)

16

26.

What number will be output by the console.log command on line 5?

a)

10

b)

25

c)

30

d)

35

27.

What text will be output by the program?

a)

less than 10

b)

less than 20

c)

less than 30

d)

30 or more

28.

What text will be output by the program?

a)

Output A

b)

Output B

c)

Output C

d)

Output D

e)

Output E

29.

What will be the order of letters printed to the console when this program is run?

a)

a b c

b)

a b c b c b c

c)

a b c b c

d)

a b c a

30.

"You win!" never displays. What change would fix this issue?

a)

Line 1 - change variable name to totalScore

b)

Line 3 - remove var

c)

Line 4 - change conditional to score >= 5

d)

Line 5 - change to a getText command

31.

When this function is called, the smaller of two numbers is displayed. What Boolean expression would not work in line 12 in order to accomplish this goal?

a)

b)

c)

d)

32.

This function chooses the screen to display based on the score. What is the correct way to call this function?

a)

b)

c)

d)

33.

There is repeated code in these onEvent blocks. Choose the correct code for the updateScreen() function which would be called in each of the onEvent blocks.

a)

b)

c)

d)

34.

A movie theater charges different ticket prices based on a customer's age. The prices are shown in the table below.

The customer's age is stored in the variable age and the price is stored in the variable price. Which piece of code will correctly decide the price for each ticket.

a)

b)

c)

d)

35.

A museum charges different prices based on the day of the week and age of the visitor. The pricing rules are shown below.

On Tuesday and Thursday children 10 and under get in free ($ 0).

For all other days and ages the cost is ten dollars ($ 10).

The visitor's age is stored in the variable age, the day of the week is stored in a variable day, and the price in dollars is stored in the variable price. Which piece of code will correctly decide the price for each ticket.

a)

b)

c)

d)

36.

What will the value of the variable bags be at the end of the flowchart shown here?

a)

1

b)

2

c)

3

d)

4

37.

Choose the correct definition for Conditional Statement

a)

affects the sequential flow of control by executing different statements based on the value of a Boolean expression

b)

stores information as a number, String, or Boolean

c)

joins together two or more strings end-to-end to make a new string

d)

an ordered sequence of characters

38.

Which of the following is true of functions?

a)

Programs written with functions run more quickly

b)

  Functions can help remove repeated code from a program

c)

Replacing repeated code with a function will reduce the number of commands the computer needs to run

d)

Functions are called once but can be declared many times

39.

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?

a)

cart total = 1;

b)

cartTotal + 1;

c)

cartTotal = cartTotal +1;

d)

var cartTotal = cartTotal + 1;

e)

var cartTotal + 1;

40.

What is displayed by the console.log statement after the following code segment executes?

a)

value is: 2

b)

value is: 2.3333333

c)

value is: 3

d)

value is: 4

e)

value is: c

41.

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)

a is bigger

b)

b

c)

5

d)

10

e)

Nothing will be displayed

42.

What is the output of the following code segment?

a)

5hello

b)

5 + hello

c)

error on num + str: type mismatch

d)

result

43.

A Boolean expression is an expression that evaluates to which of the of the following?

a)

Yes/Maybe/No

b)

True/False

c)

Any Integer

d)

Integers between 1 and 10

e)

Any single character

44.

If a = 10 and b = 5 which of these Boolean expressions are True?

(Select ALL that are correct.)

a)

a > b

AND

a == 2 * b

b)

b > a

AND

b == a / 3

c)

a < b

AND

b = a / 2

d)

a == 2 * b

AND

a*2 == b*4

45.

Assume that the two variables age and day have been initialized with the values shown.

var age = 16;

var day = "Monday";


Determine if the following statement evaluates to true or false.

(age > 10) && (age < 20)

a)

true

b)

false

46.

What number will be output by the console.log command on line 7?

a)

10

b)

100

c)

20

d)

200

47.

What text will be output by the program?

a)

less than 10

b)

less than 20

c)

less than 30

d)

30 or more

48.

What will be the order of letters printed to the console when this program is run?

a)

a b c

b)

a b c b c b c

c)

a b c b c

d)

a b c a

49.

A movie theater charges different ticket prices based on a customer's age. The prices are shown in the table below.

The customer's age is stored in the variable age and the price is stored in the variable price. Which piece of code will correctly decide the price for each ticket.

a)

b)

c)

d)

50.

What will the value of the variable bags be at the end of the flowchart shown here?

a)

1

b)

2

c)

3

d)

4

51.

Evaluate:


10 / 2 evaluates to

a)

1

b)

0.5

c)

2

d)

5

52.

What is the result of running this program and clicking on a buttonUp button 20 times?

00 var Count

01 Count = 0

02 onevent(buttonUp, Click), Count = Count + 1

a)

Count = 0

b)

Count = 19

c)

Count = 20

d)

Count = Undefined

53.

Assume that the two variables age and day have been initialized with the values shown.

var age = 16;

var day = "Monday";


Determine if the following statement evaluates to true or false.

(age > 10) && (age < 20)

a)

true

b)

false

54.

Assume that the two variables age and day have been initialized as shown below.


var age = 16;

var day = "Monday";


Determine if the following statement evaluates to true or false.


(day == "Tuesday") || (age < 12)

a)

true

b)

false

55.

Name the UI element that lets a user type in a small abount of text.

a)

Button

b)

Checkbox

c)

Chart

d)

Text Input

56.

Name the UI element that could be used in a To Do list to mark when something is done.

a)

Label

b)

Button

c)

Dropdown

d)

Check Box

57.

Name the UI element that is used to dispaly a large block of text

a)

Screen

b)

Button

c)

Text Area

d)

Label

58.

Name the UI element that allows a user to pick between a set of options in a list.

a)

Chart

b)

Dropdown

c)

Radio Button

d)

Text Area

59.

Name the UI element that is used for small titles and headings on an app.

a)

Label

b)

Image

c)

Screen

d)

Slider

60.

Name the UI element that is the place where all other UI elements are placed.

a)

Slider

b)

Text area

c)

Screen

d)

Chekbox

61.

Name the UI element that is often clicked on the go to next page of the app.

a)

Screen

b)

Slider

c)

Button

d)

Chart

62.

Name the UI element that could be used to show a picture of an animal.

a)

Screen

b)

Image

c)

Button

d)

Dropdown

63.

The unique name given to each UI element you include in your app.

a)

Name

b)

ID

c)

Turlte

d)

Matrix

64.

What command do you use to change the screen?

a)

Screen1

b)

setScreen

c)

getText

d)

On Event

65.

IDs can contain spaces

a)

True

b)

False

66.

IDs can start with a number.

a)

True

b)

False

67.

IDs are case sensitive.

a)

True

b)

False

68.

IDs can only have letters in them.

a)

True

b)

False

69.

Whick is the best ID?

a)

button

b)

backButton

c)

home_backButton

d)

home_backButton_topLeft

70.

a new or improved idea, device, product, etc, or the development thereof.

a)

Prototype

b)

Program

c)

Innovation

d)

Codeing

71.

The onEvent() block speifies:

a)

an element ID

b)

an event

c)

code the should be run when the event occurs

d)

all of the above

72.

UI stands for....

a)

User Interface

b)

Ubiquitous Interface

c)

User Interaction

d)

Ubiquitous Interaction

73.

On the circuit playground, led.off()...

a)

Automatically turns a green LED off.

b)

Turns off a red LED when coded as an onEvent object.

c)

Automatically turns a red LED off.

d)

Turns off a green LED when coded as an onEvent object.

74.

On the circuit playground, led.on()....

a)

Automatically turns green LED on.

b)

Turns on a red LED when coded as an onEvent object.

c)

Automatically turns a red LED on.

d)

Turns on green LED when coded as an onEvent object.

75.

In App Lab, buzzer.frequency (500) has a higher pitch than buzzer.frequency (300).

a)

True

b)

False

76.

In App Lab code "frequency" refers to:

a)

The total amount of time a buzzer players when fired.

b)

The pitch or range of sound of the buzzer.

c)

How many times a buzzer is fired.

77.

A possible set of frequency values for this picture would be:

a)

100, 200, 400

b)

200, 100, 400

c)

400, 200, 100

d)

200, 400, 100

78.

In App Lab, the buzzer.frequency() command takes which two inputs?

a)

frequency and toggle

b)

frequency and duration

c)

duration and buzzer

d)

duration and toggle

79.

In App Lab, buzzer.frequency() command which is the optional input?

a)

frequency

b)

led

c)

duration

d)

buzzer