Worksheets[AP CSP] Programming: Conditionals
Total questions: 10
Worksheet time: 20mins
When the code is ran, an error occurs due to line 4. What type of error exists in line 4?
Syntax Error
Type Error
Indentation Error
Concatenation Error
Given the following set of code, what would be the output?
you earned nothing :/
You earned 5 points!
You earned 10 points!
You earned 15 points!
Syntax Error
There's syntax error in lines 2 and 4. What is the proper correction?
use the == comparing operater
use parenthesis around the condition
use .lower() function for line 1
using str() function for the conditions
Given the code, what would be the output if the inputs were 8 and 60?
You can not ride the roller coaster
You can ride the roller coaster
Syntax Error
None
Given the following code, which line(s) of code would be skipped if the initial input for tentacles was "n" ?
Lines 3-7
Lines 2-7
Line 2
Line 5 & 7
When this code is ran with the input: y, 64, what is the resulting output?
Your price is $20, Your price is $15
Your price is $20
Your price is $15
Your price is $12.5, Your price is 12.50
For the given code, which line(s) of code would be read if the inputs were: n, 65 ?
Your price is $7.50
Your price is $15
Your price is $12.50
Your price is $20
There's a syntax error for this program code. What line is it one?
Line 14
Line 1
Line 17
Line 2
The code utilizes the randint() fuction. What line of code should be at the top to be able to use the randint() in line 2?
from random import randint
import randint from random
import randint
import random
What is the error in this code?
the input for age should be casted into an integer
the else condition should be an elif
there should quotations around the "8" and "60
There should be a str() function used in line 2.
