Font size
WorksheetsCP CSP Final Exam Study 2023
Total questions: 79
Worksheet time: 42mins
What is output by line 6?
(a)
What is output by line 6?
(a)
What is output by line 5?
(a)
What is output by the program?
less than 10
less than 20
less than 30
30 or more
What is output by the program?
Option A
Option B
Option C
Option D
Option E
What is needed to complete the code?
(a)
What will the value of bags be at the end of the program?
(a)
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.
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.
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.
The game's running speed cannot be improved because computers can only be programmed to find the best possible solution.
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.
What number will be output by the console.log command on line 7?
10
100
20
200
What number will be output by the console.log command on line 5?
10
11
12
13
16
What number will be output by the console.log command on line 5?
10
25
30
35
What text will be output by the program?
less than 10
less than 20
less than 30
30 or more
What text will be output by the program?
Output A
Output B
Output C
Output D
Output E
What will be the order of letters printed to the console when this program is run?
a b c
a b c b c b c
a b c b c
a b c a
"You win!" never displays. What change would fix this issue?
Line 1 - change variable name to totalScore
Line 3 - remove var
Line 4 - change conditional to score >= 5
Line 5 - change to a getText command
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?
This function chooses the screen to display based on the score. What is the correct way to call this function?
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 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 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.
What will the value of the variable bags be at the end of the flowchart shown here?
1
2
3
4
Choose the correct definition for Conditional Statement
affects the sequential flow of control by executing different statements based on the value of a Boolean expression
stores information as a number, String, or Boolean
joins together two or more strings end-to-end to make a new string
an ordered sequence of characters
Which of the following is true of functions?
Programs written with functions run more quickly
Functions can help remove repeated code from a program
Replacing repeated code with a function will reduce the number of commands the computer needs to run
Functions are called once but can be declared many times
What number will be output by the console.log command on line 7?
10
100
20
200
What number will be output by the console.log command on line 5?
10
11
12
13
16
What number will be output by the console.log command on line 5?
10
25
30
35
What text will be output by the program?
less than 10
less than 20
less than 30
30 or more
What text will be output by the program?
Output A
Output B
Output C
Output D
Output E
What will be the order of letters printed to the console when this program is run?
a b c
a b c b c b c
a b c b c
a b c a
"You win!" never displays. What change would fix this issue?
Line 1 - change variable name to totalScore
Line 3 - remove var
Line 4 - change conditional to score >= 5
Line 5 - change to a getText command
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?
This function chooses the screen to display based on the score. What is the correct way to call this function?
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 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 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.
What will the value of the variable bags be at the end of the flowchart shown here?
1
2
3
4
Choose the correct definition for Conditional Statement
affects the sequential flow of control by executing different statements based on the value of a Boolean expression
stores information as a number, String, or Boolean
joins together two or more strings end-to-end to make a new string
an ordered sequence of characters
Which of the following is true of functions?
Programs written with functions run more quickly
Functions can help remove repeated code from a program
Replacing repeated code with a function will reduce the number of commands the computer needs to run
Functions are called once but can be declared many times
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?
cart total = 1;
cartTotal + 1;
cartTotal = cartTotal +1;
var cartTotal = cartTotal + 1;
var cartTotal + 1;
What is displayed by the console.log statement after the following code segment executes?
value is: 2
value is: 2.3333333
value is: 3
value is: 4
value is: c
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 is bigger
b
5
10
Nothing will be displayed
What is the output of the following code segment?
5hello
5 + hello
error on num + str: type mismatch
result
A Boolean expression is an expression that evaluates to which of the of the following?
Yes/Maybe/No
True/False
Any Integer
Integers between 1 and 10
Any single character
If a = 10 and b = 5 which of these Boolean expressions are True?
(Select ALL that are correct.)
a > b
AND
a == 2 * b
b > a
AND
b == a / 3
a < b
AND
b = a / 2
a == 2 * b
AND
a*2 == b*4
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)
true
false
What number will be output by the console.log command on line 7?
10
100
20
200
What text will be output by the program?
less than 10
less than 20
less than 30
30 or more
What will be the order of letters printed to the console when this program is run?
a b c
a b c b c b c
a b c b c
a b c a
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.
What will the value of the variable bags be at the end of the flowchart shown here?
1
2
3
4
Evaluate:
10 / 2 evaluates to
1
0.5
2
5
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
Count = 0
Count = 19
Count = 20
Count = Undefined
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)
true
false
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)
true
false
Name the UI element that lets a user type in a small abount of text.
Button
Checkbox
Chart
Text Input
Name the UI element that could be used in a To Do list to mark when something is done.
Label
Button
Dropdown
Check Box
Name the UI element that is used to dispaly a large block of text
Screen
Button
Text Area
Label
Name the UI element that allows a user to pick between a set of options in a list.
Chart
Dropdown
Radio Button
Text Area
Name the UI element that is used for small titles and headings on an app.
Label
Image
Screen
Slider
Name the UI element that is the place where all other UI elements are placed.
Slider
Text area
Screen
Chekbox
Name the UI element that is often clicked on the go to next page of the app.
Screen
Slider
Button
Chart
Name the UI element that could be used to show a picture of an animal.
Screen
Image
Button
Dropdown
The unique name given to each UI element you include in your app.
Name
ID
Turlte
Matrix
What command do you use to change the screen?
Screen1
setScreen
getText
On Event
IDs can contain spaces
True
False
IDs can start with a number.
True
False
IDs are case sensitive.
True
False
IDs can only have letters in them.
True
False
Whick is the best ID?
button
backButton
home_backButton
home_backButton_topLeft
a new or improved idea, device, product, etc, or the development thereof.
Prototype
Program
Innovation
Codeing
The onEvent() block speifies:
an element ID
an event
code the should be run when the event occurs
all of the above
UI stands for....
User Interface
Ubiquitous Interface
User Interaction
Ubiquitous Interaction
On the circuit playground, led.off()...
Automatically turns a green LED off.
Turns off a red LED when coded as an onEvent object.
Automatically turns a red LED off.
Turns off a green LED when coded as an onEvent object.
On the circuit playground, led.on()....
Automatically turns green LED on.
Turns on a red LED when coded as an onEvent object.
Automatically turns a red LED on.
Turns on green LED when coded as an onEvent object.
In App Lab, buzzer.frequency (500) has a higher pitch than buzzer.frequency (300).
True
False
In App Lab code "frequency" refers to:
The total amount of time a buzzer players when fired.
The pitch or range of sound of the buzzer.
How many times a buzzer is fired.
A possible set of frequency values for this picture would be:
100, 200, 400
200, 100, 400
400, 200, 100
200, 400, 100
In App Lab, the buzzer.frequency() command takes which two inputs?
frequency and toggle
frequency and duration
duration and buzzer
duration and toggle
In App Lab, buzzer.frequency() command which is the optional input?
frequency
led
duration
buzzer
