Log in
Sign up for FREE
arrow_back
Library

CSP Final Review - FLHS

star
star
star
star
star
Last updated over 3 years ago
90 questions
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
7
4
4
6
1
5
9
2
4
1
1
15
1
1
1
1
1
3
1
1
1
1
1
1
1
1
1
1
1
3
5
8
1
1
1
1
1
1
1
1
1
4
1
1
1
1
1
1
1
Question 1
1.

Question 2
2.

Question 3
3.

Question 4
4.

Question 5
5.

Question 6
6.

Question 7
7.

Question 8
8.

Question 9
9.

Question 10
10.

Question 11
11.

Question 12
12.

Question 13
13.

Question 14
14.

Question 15
15.

Question 16
16.

Question 17
17.

Question 18
18.

Question 19
19.

Question 20
20.

Question 21
21.

Question 22
22.

Question 23
23.

Question 24
24.

Question 25
25.

Question 26
26.

Question 27
27.

Question 28
28.

Question 29
29.

Question 30
30.

Question 31
31.

Question 32
32.

Question 33
33.

Question 34
34.

Question 35
35.

Question 36
36.

Question 37
37.

Question 38
38.

Question 39
39.

Question 40
40.

Question 41
41.

Draggable itemarrow_right_altCorresponding Item
arrow_right_alt
arrow_right_alt
Question 42
42.
Know what operations the following symbols represent.

+ ⇛ _______
- ⇛ _______
* ⇛ _______
/ ⇛ _______
** ⇛ _______
% ⇛ _______
- ⇛_______ (unary operator)
// ⇛ _______
Question 43
43.

Question 44
44.

Question 45
45.

Question 46
46.

Question 47
47.

Question 48
48.

Question 49
49.
- _______ is the character(s) used to start an in-line Python Comment

- _______ is the character(s) used to start a multiline Python Comment
Question 50
50.

Question 51
51.

Question 52
52.

What would be the proper way to name a variable in Python that stores the users ID number

Question 53
53.

Answer the following questions about the program below

students = int(input("Number of students: ")
size_of_groups = int(input("How many in a group: ")
num_per_group = students // size_of_groups
students_remaining = students % size_of_groups

print("Each group will be " + str(num_per_group) + " students with one group of " + str(students_remaining))

What does the Python program do?
What is the purpose of // in this program?
What is the % operator doing in this program?

Question 54
54.

Question 55
55.

Question 56
56.

Question 57
57.

Question 58
58.

Question 59
59.
A company decided to give bonus of 5% to employee if his/her year of service is more than 5 years. Ask user for their salary and year of service and print the net bonus amount. Fill in the blanks to complete the below code.

salary = _______"Enter salary: ") ) yos = _______"Enter year of service")) if _______>5: print "Bonus is",.05*salary else: print "No bonus"
Question 60
60.

Question 61
61.

Question 62
62.

Question 63
63.

Question 64
64.

Question 65
65.

Question 66
66.

Question 67
67.

Question 68
68.

Question 69
69.

Question 70
70.

Question 71
71.

Write a program that does the following:

Assign 10 to x. If x is bigger than 0, print "x is a positive number".

Question 72
72.

Write a program that does the following:

Assign -50 to y. If y is bigger than 0, print "y is a positive number". Else, print "y is a negative number".

Question 73
73.

Write a program that does the following:

Assign 0 to z. If z is bigger than 0, print "z is a positive number". Else if z is zero, print "z is 0". Else, print "z is a negative number".

Question 74
74.

Question 75
75.

Question 76
76.

Question 77
77.

Question 78
78.

Question 79
79.

Question 80
80.

Question 81
81.

Question 82
82.

Question 83
83.

Write an if statement that asks for the user's name via input() function. If the name is "Bond" make it print "Welcome on board 007." Otherwise make it print "Good morning NAME". (Replace Name with user's name)

Question 84
84.

Question 85
85.

Question 86
86.

Question 87
87.

Question 88
88.

Question 89
89.

Question 90
90.

What would be the output of the following code?
Which of the following statements is true about control structures?
If/else statements can be used inside for loops.
User input must always be turned into an integer value in order to be used to control commands
For loops and while loops cannot be used in the same function
Placing a for loop inside another for loop will create an infinite loop.
Which of the following does the clear command do?
A. Clears the screen of any markings left by Tracy
B. Turns Tracy to face right
C. Sends Tracy to position (0,0)
A only
A, B, and C
A and C
A and B
What will the output of the following code be?
An infinite loop will be created.
Tracy will draw 20 circles with a radius of 50.
An infinite loop will occur.
Tracy will draw 50 circles with a radius of 20.
Tracy will draw 1 circle with a radius of 20.
How is an infinite loop created?
By using an infinite value in a while loop
By using a condition that will never become false in a while loop
By using a condition that will never become false in a for loop
By using an infinite value in a for loop
Why do we use while loops?
To repeat code a specific number of times
To repeat code when the number of times to repeat is unknown
To repeat code a specific number of times
To repeat code when the number of times to repeat is unknown
What would be the radius of the circle output from the following code?

30 pixels
40 pixels
20 pixels
10 pixels
Which of the following if/else statements using a variable called ‘count’ are written correctly?
What is the limit of conditions that can be used in an if/else statement?
2
1
4
unlimited
Which of the following is an example of an if/else statement scenario?
If it is raining, bring an umbrella.
If it is cold out wear a coat. If it is raining, wear a hat.
If it is not cold out, don’t wear a coat.
If it is raining, bring an umbrella. If not, wear sunglasses.
If the following code was run, how far would Tracy move?
0 pixels
25 pixels
100 pixels
50 pixels
Which comparison operator means ‘is not equal to’?
==
!=
=#
%
How would we write an if statement where Tracy will put the pen down if a variable called count was positive?
If we write an if statement and the condition is false, what does Tracy do?
Tracy completes the indented code
The code stops running
Tracy skips the commands under the if statement
Tracy gives us an error
Why do we use if statements?
To tell Tracy to stop our code if there’s an error
To tell Tracy to do something if we run our code
To have Tracy complete one function at a time
To have Tracy make decisions based on conditional statements
What is the default starting value of i in a for loop?
0
10
2
1
Variables allow us to:
Use english words to communicate with Tracy
Store information to use in our programs
Change the words Tracy recognizes
Name different parts of our programs
Which of the following is NOT an example of using Top Down Design?
Using descriptive names for variables
Separating a large problems into smaller ones
Breaking a large code up into functions
Writing code for one part of a function before tackling the whole thing
Top Down Design makes it easier to solve a problem by:
Starting with the biggest function and then moving to smaller ones
Starting your code from the first command
Breaking the problem down into smaller parts
Making each function hold only one command
What punctuation is needed to begin a multi-line comment?
"""
"
#
*
What symbol is used at the beginning of an in-line comment?
!
#
"
:
Comments are:
Always blue when Python recognizes them
Commands performed by the computer
Only needed when a program is over 50 lines
Written for humans to read and understand
What are the dimensions of Tracy’s world?
200 pixels x 200 pixels
400 pixels x 200 pixels
200 pixels x 400 pixels
400 pixels x 400 pixels
When Tracy is facing right, from what location does she start drawing her circle?
The top of the circle
The middle of the circle
The bottom of the circle
The left side of the circle
When using the circle() command, what value do we put inside the parentheses?
The width of the circle
The radius of the circle
The diameter of the circle
The center of the circle
Which of the following statements is true? I. Computers have only been around since the 1940’s II. One reason computers were first developed was to do mathematical computations faster III. Some modern computers include laptops, cell phones, and tablets IV. Computers are able to perform tasks by using logic
II, III, IV
I, II, III, IV
I, III
III, IV
Which of the following statements is the simplest and most accurate definition of a computer?
A computer is something that runs applications and accesses the internet.
A computer is something that performs calculations by following and executing specific instructions to solve a problem.
A computer is a machine that is able to solve any problem.
A computer is a machine that can be programmed.
Which of the following choices correctly orders the early types of computers from earliest to most recent?
IBM Laptop, ENIAC, Analytical Engine, Abacus
Abacus, Analytical Engine, ENIAC, IBM Laptop
ENIAC, Analytical Engine, Abacus, IBM Laptop
Analytical Engine, Abacus, IBM Laptop, ENIAC
What is the purpose of an output device?
To allow the user to give data or information to the computer.
To allow the computer to store information or programs.
To allow the computer to display or communicate the result of a computation
To allow computers to connect and communicate with other computers.
What is the purpose of an input device?
To allow computers to connect and communicate with other computers.
To allow the computer to store information or programs.
To allow the computer to display or communicate the result of a computation
To allow the user to give data or information to the computer.
What is the purpose of a network device?
To allow the computer to store information or programs.
To allow the computer to display or communicate the result of a computation
To allow computers to connect and communicate with other computers.
To allow the user to give data or information to the computer.
What is the purpose of a storage device?
To allow the computer to display or communicate the result of a computation
To allow the computer to store information or programs.
To allow the user to give data or information to the computer.
To allow computers to connect and communicate with other computers.
Which of the following statements is something the operating system of a computer is responsible for doing?
Allowing the user to write programs.
Providing a way for the user to create text documents.
Allowing the user to access the internet.
Managing memory allocation for all applications.
Which of the following items is an example of a user application?

I. Browser II. Text editor III. Games IV. File Explorer
II, III
I, II, IV
I, II
I, II, III, IV
Which of the following choices lists the three main components of a computer’s hardware?
Input devices, Output devices, Motherboard
CPU, Memory, Motherboard
CPU, Flash memory, Processor
Processor, Binary, RAM
What does CPU stand for?
Computer’s Plug-in Unit
Central Processing Unit
Computer’s Processing Unit
Central Pushing Unit
Which of the following devices is the device that connects all of the physical components of a computer together?
Memory
Motherboard
Logic
CPU
Which of the following fields use computers?
I. Computer Science II. Medicine III. Video Gaming IV. Automotive (Cars)
I, II, III, IV
I, III
I
I, II, III
Which of the following is an application of Artificial Intelligence?
All of the above
Foreign language translation
Game AI’s
Recognizing handwriting
Match the term to the definition
Unary Operators
Operators that occur between two things
Binary Operators
Operators that only apply to one thing
In the following equation, in what order do you complete the operations in Python? (drag to reorder)

6 - 3 ** 2 / (1 + 1)
2/
1 + 1
3 ** 2
6 - 3
In the following equation, in what order do you complete the operations in Python? (drag to reorder)

(6 + (3 - 2 * 2)) ** 2
6 + (_____)
2 * 2
3 - 2
(______) ** 2
Which of the following statements will cause an error assuming age has the value 15 and student the value Billy-Bob
print(student+ ": " + age)
print(student + ":")
print(age)
print(student + ": " + int(age))
print(int(student) + " : " + str(age))
print(student + "is " + "age " + "years old"
print(student + ": " + str(age))
Which one of the statements below will cause an error?
foo = "bar" * 6
foo = "bar" + "bar" + "bar"
foo = "bar" + 11
foo = ("h" * 6) + "j"
What type the variable on the left getting in each line
z = x * y
b = x + y
y = 4
x = "bar"
a = y + .9
str
int
float
This line will cause a crash
I detify the value that would be stored in each type
-3.14
6
"5.6"
7.0
"elephant"
0.9
"user"
"name"
-15
String
Integer
Float
Reorder the statements to put them in the order to get input from the user and print out the result
confirm = input("Is that correct? (Yes or No)")
print("You have chosen " + confirm)
user_color = input("What is your favorite color? ")
print("Your favorite color is " + user_color)
What is the output of the following program? Assume the user enters "Will Smith", then "Wild Wild West"?

favorite_actor = input ("What is your favorite Actor? ")
best_movie = input ("What is your favorite move that actor is in? ")
fav_movie_actor = favorite_actor + best_movie
Will SmithWild Wild West
WildWillWildSmithWest
Will Smith Wild Wild West
WillWild
Will Wild
Wild Wild West Will Smith
Is there any limit of statement that can appear under an if block.
Question doesn't apply to if statements
Yes
No
Depends on the application
What print statement will run if the user enters 19 when prompted?

age=int(input("Enter your age"))
if age >=18:
print("Eligible for voting")
else:
print("not eligible for voting")
print("Eligible for voting")
print("Eligible for voting")
print("not eligible for voting")
print("not eligible for voting")
Nothing will print
The if...elif...else executes only one block of code among several blocks
False
True
It depends on exprssion used.
There is no elif statement in Python
How would you round the number held in the variable e to 2.718?
round(e)
round(e, 3)
round(4, e)
round(e, 4)
How would you round the number 10.758321 held in the variable num1 to 10.76?
round(num1, 4)
round(num1, 2)
round(4, num1)
round(3, num1)
round(num1, 3)
round(num1)
round(2, num1)
What will print to the screen when the following program is run?

number = 10
greater_than_pi = number > 3.14
print(type(number)
10
True
<type 'bool'>
<type 'int'>
What will print to the screen when the following program is run?

number = 10
greater_than_pi = number > 3.14
print(type(greater_than_pi)
<type 'int'>
True
10
<type 'bool'>
What will print to the screen when the following program is run?

value = -7.52
less_than_zero = value < 0
print(type(less_than_zero)
-7.52
<type 'bool'>
True
<type 'int'>
What will print to the screen when the following program is run?

value = -7.52
less_than_zero = value < 0
print(less_than_zero)
-7.52
<type 'bool'>
<type 'int'>
True
What will the results be of the following statement
5 == 5
True
False
What will the results be of the following statement
3 == 5
True
False
What will the results be of the following statement
5 == 5.0
True
False
What will the results be of the following statement
"eric" == "eric"
True
False
What will the results be of the following statement
"Eric" == "eric"
True
False
What will the results be of the following statement
"5" == 5
True
False
What will the results be of the following statement
num1 = 5
"5" == str(num1)
True
False
Given the nested if-else structure below, what will be the value of x after code execution completes

x = 0 a = 0 b = -5 if a > 0: if b < 0: x = x + 5 elif a > 5: x = x + 4 else: x = x + 3 else: x = x + 2 print(x)
0
2
4
3
Given the nested if-else below, what will be the value x when the code executed successfully

x = 0 a = 5 b = 5 if a > 0: if b < 0: x = x + 5 elif a > 5: x = x + 4 else: x = x + 3 else: x = x + 2 print(x)
4
2
3
0
What does the following code print to the console?
if 5 > 10: print("fan") elif 8 != 9: print("glass") else: print("cream")
Nothing is printed
"cream"
"fan"
"glass"
What does the following code print to the console?
name = "maria" if name == "melissa": print("usa") elif name == "mary": print("ireland") else: print("colombia")
"mary"
Nothing is printed
"melissa"
"colombia"
hair_color = "blue" if 3 > 2: if hair_color == "black": print("You rock!") else: print("Boring")
"You rock!"
Nothing is printed
Program contains an error and will not run
"Boring"
What does the following code print to the console?
if True: print(101) else: print(202)
Program contains an error and will not run
101
202
Nothing is printed
What does the following code print to the console?
if False: print("Nissan") elif True: print("Ford") elif True: print("BMW") else: print("Audi")
"Audi"
"Ford"
"BMW"
"Audi"
Nothing will print
"Ford"
"BMW"
"Ford"
"BMW"
"Nissan"
In a Python program, a control structure:
Directs the order of execution of the statements in the program
Manages the input and output of control characters
Defines program-specific data structures
Dictates what happens before the program starts and after it terminates
What signifies the end of a statement block or suite in Python?
}
A line that is indented less than the previous line
A comment
end
The break statement causes what?
Skip current and start the next iteration
Restarting the loop
Terminating loop
Infinite loop
The continue statement causes what?
Skip current and start the next iteration
Terminating loop
Infinite loop
Restarting the loop
What is the result of executing the following code?
number = 5 while number <= 5: if number < 5: number = number + 1 print(number)
The value of number will be printed exactly 5 times
The program will loop indefinitely
The while loop will never get executed
The value of number will be printed exactly 1 time
What will the following code print?
counter = 1 sum = 0 while counter <= 6: sum = sum + counter counter = counter + 2 print(sum)
7
9
8
12
What is the last thing printed when the following code is run?
number = 0 while number <= 10: print("Number: ", number) number = number + 1
Number: number
Number: 0
Number: 10
Number: 11
What does the following code print?
output = "" x = -5 while x < 0: x = x + 1 output = output + str(x) + " " print(output)
-5 -4 -3 -2 -1
-4 -3 -2 -1 0
This is an infinite loop, so nothing will be printed
5 4 3 2 1
The following code contains an infinite loop. Which is the best explanation for why the loop does not terminate?
n = 10 answer = 1 while n > 0: answer = answer + n n = n + 1 print(answer)
answer starts at 1 and is incremented by n each time, so it will always be positive.
In the while loop body, we must set n to False, and this code does not do that.
n starts at 10 and is incremented by 1 each time through the loop, so it will always be positive.
You cannot compare n to 0 in the while loop. You must compare it to another variable.