Font size
WorksheetsAP CSP EOS Exam Practice
Total questions: 87
Worksheet time: 46mins
A work or invention that is the result of creativity, such as a piece of writing or a design, to which one has rights and for which one may apply for a patent, copyright, trademark, etc.
Creative Commons
Digital Data
Intellectual Property
Sampling
A contraction of "Binary Digit"; the single unit of information in a computer, typically represented as a 0 or 1
Digital Data
Byte
Binary
Bit
A process for reducing the number of bits needed to represent something without losing any information. This process is reversible.
Lossless Compression
Sampling
Lossy Compression
Overflow Error
Error from attempting to represent a number that is too large.
Round-off Error
Sampling
Overflow Error
Analog Data
A way of representing information using only two options.
Byte
Binary
Bit
Lossy Compression
Data with values that change continuously, or smoothly, over time. Some examples include music, colors of a painting, or position of a sprinter during a race.
Digital Data
Lossy Compression
Byte
Analog Data
Data that changes discretely through a finite set of possible values
Digital Data
Analog Data
Sampling
Lossless Compression
A collection of public copyright licenses that enable the free distribution of an otherwise copyrighted work, used when an author wants to give people the right to share, use, and build upon a work that they have created
Intellectual Property
Sampling
Digital Data
Creative Commons
Error from attempting to represent a number that is too precise.
Round-off Error
Overflow Error
Analog Data
Lossless Compression
8 bits
Binary
Digital Data
Byte
Analog Data
What Python command lets the user enter an answer to a question?
answer()
open()
print()
input()
What is Python named after?
The television show Monty Python's Flying Circus
A Snake
The name of the guy who created it, "Guido Python"
The snake game, "Python".
What Python command is used to output text to the screen?
input()
print()
int()
display()
What is the purpose of comment lines in code?
To compliment your work so you feel better about it.
To explain the code that follows it.
To make the code compile.
To make your code longer so you get more points.
Which symbol is used to make a comment line in Python?
&
//
#
'
Which is the correct way to declare and initialize a variable in Python?
my_variable: 10
my_variable == 10
my_variable = 10
my_variable is 10
A data type consisting of letters, numbers and symbols enclosed in quotation marks.
integer
float
string
boolean
A data type consisting of numbers with decimals.
integer
float
string
boolean
Code that decides whether or not to skip a section of code.
Conditional
For Loop
While Loop
Then Block
What will be the output from the following code?
print("Hello" + "World")
Hello, World
"Hello" + "World"
Hello World
HelloWorld
What will be the output from the following code?
print(17%5)
3
3.4
2
12
What is the assignment operator?
+=
=
->
==
What is the increment operator
+=
-=
==
=
Which symbol means "not equal"?
>=
!=
==
+=
Which statement correctly assigns the string "Tanner" to the variable name?
name = print( "Tanner")
input("Tanner")
name = "Tanner"
name = input("Tanner")
What will be the output of this code?
x = 13
y = 14
if x!=y:
print("Hello")
else:
print("Hi")
Hello
Hi
14
13
Which of the following is NOT possible using the RANDOM(a, b) and DISPLAY(expression) abstractions?
DISPLAY(RANDOM(0, 4) + RANDOM(2, 8)
13
5
7
9
Order the following programming languages from low-level language to high-level language.
COBOL
Python
Machine code
Machine code, COBOL, and Python
Machine code, Python, and COBOL
COBOL, machine code, and Python
Python, COBOL, and machine code
A while loop can be used in which of the following situations?
Repeat a set of statements till a condition remains True.
Repeat a set of statements a finite or an infinite number of times.
Iterate through a string, list, and tuple.
All of the above
What is a variable?
a type of graphics
A box(memory location) where you store values
Data type
a type of memory
A syntax error means your code has a 'grammar' mistake or you used symbols/operations incorrectly
True
False
How do you identify the statements that belong to the body of a function?
Indent those statement the same amount underneath the function "def" statement
Add opening and closing curly braces { and } to mark the start and stop of the function body
Add the "def" keyword to the beginning of each statement
Add the same comment (#) to the right of each statement within the body
What character should be placed at the end of the function "def" line, after the parentheses?
Hashtag (#)
Colon(:)
Exclamation (!)
Dash (-)
Which of the following best describes where you should define your function in your code?
Near the bottom of the source file, after that function is called by any main program code
Always place functions in a separate source file
Near the top of the source file, before that function is called by any main program code
The location is not important, so place the function wherever you like
23 == 32
True
False
4 == 4.0
True
False
Error
What is an example of a boolean?
"Hello!"
56
True/False
46.7
What is the purpose of a loop in programming?
The purpose of a loop in programming is to repeat a block of code.
The purpose of a loop in programming is to randomly select a block of code.
The purpose of a loop in programming is to skip a block of code.
The purpose of a loop in programming is to execute code only once.
What is the purpose of import random in Python?
To send emails
To get random numbers
To store data in a file
To create websites
What does random.randint(1, 10) do?
Picks any number
Picks a decimal between 1 and 10
Picks a random number from 1 to 10 (inclusive)
Picks only 10
To make the turtle move forward, which command is used?
turtle.penup()
turtle.forward()
turtle.left()
turtle.backward()
In order to move the turtle 120 forward without drawing on the screen, which order is correct?
turtle.forward(120)
turtle.penup()
turtle.pendown()
turtle.pendown()
turtle.forward(120)
turtle.penup()
turtle.penup()
turtle.forward(120)
turtle.pendown()
Which of these commands would create a turtle named Alice?
Alice = turtle.pen()
Alice = Turtle.pen()
Alice = Turtle.turtle()
Alice = turtle.Turtle()
How many times will this code loop?
50
90
0
4
Look at this code, what shape will it make?
Square
Triangle
Rectangle
Hexagon
To move the turtle to a specific position on the drawing canvas you need to use which of the following commands?
set_pos( )
setpos( ):
setpos
setposition( )
How do you tell that Python that you are going to use the turtle library?
import turtle
turtle import
from turtle import *
from turtle import
What do you put at the end of a turtle program?
import turtle
wn.mainloop()
hunter = turtle.Turtle()
wn = turtle.Screen()
What is the keyword needed to repeat code (iterate) in Python?
for
if
input
What does this code do?
hunter.color("yellow")
hunter.begin_fill()
hunter.circle(100)
hunter.end_fill()
Makes a yellow-filled circle
Makes a yellow circle that is not filled in
Makes a black circle that is not filled in
Makes a white (invisible) circle
Why are comments important in programming?
Comments are ignored by the compiler while running the code.
Lazy programmers (who do not comment the code properly) forget their own implemented logics and waste much more time solving the issue when they see their code later.
In Python we can write a single line comment by using #.
Comments are helpful to other programmers to understand the code better. They can easily understand the logic behind solving any problem.
What is a library in coding?
Place to store the code you have written
Collection of code from outside of the program
Location to find books to help you learn coding
The list of examples for coding
What is the random library used for?
Used to find errors in your code
Used to add sound to your code
Used to add graphics to your code
Used to add randomness to your code
Which is the correct statement to use the random library in your program?
import random
random import
random.randint( )
random = import
What is a function?
an action within your code, print and input are examples of functions
an action defined in one location but used somewhere else in your code, print and input are examples of functions
Pieces of information that you need to give a function in order for it to run.
Data
Function
Argument
Editor
Which is the correct syntax for keying a Boolean?
has_dog = true
has_dog = "true"
has_dog = True
has_dog = TRUE
What best defines an IF statement in Python?
An embedded string with a variable
Checks to see if a statement is true or false and then does one of two things depending on the result.
In programming, what is iteration?
The repetition of steps within a program
A decision point in a program
The order in which instructions are carried out
Testing a program to make sure it works
The condition for a while loop to continue could include which of the following?
while something equals something
while something is true
while something is greater than something
All of these
while loops are ___.
loops which run an unknown number of times
the same as if statements
loops which run for a specific number of times
not a part of programming
The output of the following code is either 1 or 2.
True
False
Error
Which of the following is not a valid variable name in Python?
1_variable
variable_1
_variable
variable1
In Python, what does the "==" operator do?
Assigns the value on the right to the variable on the left
Checks if two values are not equal
Checks if two values are equal
Converts the value on the left to the type of the value on the right
Which data structure in Python is mutable AND ordered?
Dictionary
Tuple
Set
List
What will be the output of the following code snippet?
apple
apple
banana
apple
banana
cherry
Error
What is the output of the following code?
Syntax Error
5
3
Parameter Error
An ordered set of values between a known start and end value is the
radius
loop
range
expression
What output is produced by:
x = 19.29428347
x = x * 100
num = int(x)
print(num)
19.2943
19
1929
19.29
Consider the following code:
c = 100
c = c + 1
c = c + 1
print(c)
(a)
To create a random number between -20 and 20 you would use:
print (random.random(-20))
print (random.randint(-20,20))
print (random.randint(20) -20)
print(random.random() -20)
What is a packet and why does the Internet break messages into packets?
A packet is any e-mail attachment; smaller pieces bypass censorship filters.
A packet is a small chunk of data tagged with addressing info so it can be routed independently and reassembled, improving reliability and efficiency.
A packet is an error signal; splitting data lets routers detect hackers.
A packet is a video frame; dividing frames saves hard-drive space.
Which statement correctly contrasts IP and TCP?
IP guarantees perfect delivery; TCP is “best effort.”
IP handles addressing/routing, while TCP adds reliable, ordered delivery with error recovery.
IP encrypts data; TCP assigns domain names.
IP compresses packets; TCP splits them into bits.
What problem does the Domain Name System (DNS) solve?
It authenticates users before login.
It measures network latency.
It translates human-readable web names into numeric IP addresses.
It prevents duplicate packets on a network.
Which ordered list best describes what happens when you visit `www.code.org`?
TCP handshake → HTTP request → DNS lookup.
HTTP request → TCP handshake → DNS lookup.
DNS lookup → TCP handshake → HTTP request.
DNS lookup → HTTP request → TCP handshake.
Why does redundancy among routers increase Internet reliability?
Extra routers lower ISP bills.
If one path fails, packets can automatically reroute through alternate paths.
Redundancy keeps DNS servers synchronized.
Routers remove malicious code from duplicate packets.
HTTPS differs from HTTP because HTTPS …
uses TLS/SSL to encrypt traffic, adding a security layer beneath the application protocol.
bypasses DNS entirely.
compresses webpages for faster load times only on mobile.
requires IPv6 addresses instead of IPv4.
A website feels sluggish but `ping` times remain normal. Which network metric most likely worsened?
Latency, due to satellite routing.
Bandwidth, perhaps throttled by your ISP or heavy local traffic.
IP addressing, due to DHCP renewal.
DNS resolution time, caused by spoofing.
Which of the devices in the network are considered computing devices?
A smart temperature sensor: It runs a program that checks whether the temperature is above or below the target range for that time of day and then triggers the heating or cooling system when needed.
A security camera: It uses a machine learning algorithm to detect non-plant motion and sends video footage to a computer.
A desktop computer: It generates a graph of the temperature based on data from the temperature sensor and stores video footage from the camera.
A wireless router: It uses networking software to enable the sensor, computer, and camera to send data to each other.
Just the desktop computer
Just the desktop computer and wireless router
The desktop computer, security camera, and router
All of them (the computer, router, camera, and sensor)
A small part of the data is sent over the network.
Data packet
Router
File
IP address
(a)
(b)
(c)
(d)
my_turtle.right(90)
(e)
wn.mainloop()
