WorksheetsBank AP CSP Midterm 2025
Total questions: 120
Worksheet time: 3600secs
Name
Class
Date
1.
What is a conditional statement used for in programming?
a)
To create loops
b)
To evaluate a boolean expression in order to execute a particular section of code
c)
To define variables
d)
To create functions
2.
In the context of conditionals, what is a boolean expression?
a)
A mathematical equation
b)
A text string
c)
An expression that is evaluated to either TRUE or FALSE
d)
A programming error
3.
Which of the following is the correct symbol for the logical AND operator in many programming languages?
a)
||
b)
!!
c)
&&
d)
++
4.
For a logical AND operation (X && Y), when will the result be TRUE?
a)
When either X or Y is true
b)
When both X and Y are true
c)
When neither X nor Y is true
d)
When X is true and Y is false
5.
For a logical OR operation (X || Y), when will the result be FALSE?
a)
When both X and Y are false
b)
When X is true and Y is false
c)
When X is false and Y is true
d)
When both X and Y are true
6.
What does the logical NOT operator (!X) do?
a)
It multiplies X by -1
b)
It returns the opposite boolean value of X
c)
It checks if X is equal to 0
d)
It divides 1 by X
7.
In the compound boolean expression "IF I pass all my classes AND do all my chores THEN I get a reward", which logical operator is being used?
a)
NOT
b)
OR
c)
XOR
d)
AND
8.
What is the result of TRUE && FALSE?
a)
TRUE
b)
FALSE
c)
NULL
d)
ERROR
9.
What is the result of FALSE || TRUE?
a)
FALSE
b)
TRUE
c)
NULL
d)
ERROR
10.
What is the result of !TRUE?
a)
TRUE
b)
FALSE
c)
NULL
d)
ERROR
11.
What is another term for a list in many programming languages?
a)
Variable
b)
Function
c)
Array
d)
Boolean
12.
What is the index of the first element in a JavaScript array?
a)
1
b)
0
c)
-1
d)
Depends on the array
13.
Which method is used to add an element to the end of a list in JavaScript?
a)
Array.pop()
b)
Array.push()
c)
Array.concat()
d)
Array.length()
14.
Which method is used to remove the last element from a list in JavaScript?
a)
Array.pop()
b)
Array.push()
c)
Array.splice()
d)
Array.shift()
15.
What does the Array.length property do?
a)
It returns the value of the last element in the array
b)
It returns the index of the last element
c)
It sets or returns the number of elements in the array
d)
It calculates the sum of all elements
16.
What method would you use to insert an element at a specific index in a JavaScript array?
a)
Array.insert()
b)
Array.add()
c)
Array.splice()
d)
Array.push()
17.
What is data abstraction in the context of programming?
a)
The process of writing complex code
b)
The separation between the abstract properties of a data type and the concrete details of its representation
c)
The method of creating visual representations of data
d)
The process of converting data from one type to another
18.
What does it mean to traverse a list?
a)
To sort the elements of the list
b)
To access each element in a list and perform some operation on that element
c)
To combine two lists together
d)
To remove all elements from a list
19.
In the context of EarSketch, what would the compound boolean expression evaluate to if the user answered "piano" to the instrument question and "sad" to the mood question?
a)
TRUE because both conditions are met
b)
FALSE because only one condition is met
c)
TRUE because at least one condition is met
d)
FALSE because the condition checks for "piano" AND "happy"
20.
If you have a list called drumKit and want to access the third element, which index would you use?
a)
drumKit[3]
b)
drumKit[2]
c)
drumKit[1]
d)
drumKit[0]
21.
Which statement best describes how computer science impacts our daily lives?
a)
It only affects people working in technology
b)
It has minimal impact on traditional industries
c)
It changes everything from communication to healthcare
d)
It's limited to social media applications
22.
What is the purpose of a function with parameters in programming?
a)
It makes the program run more efficiently
b)
It allows for automatic code documentation
c)
It makes the function reusable with different inputs
d)
It prevents bugs from occurring in the code
23.
Which of the following best describes abstraction in programming?
a)
Making code execute faster
b)
Dividing code into smaller sections
c)
Hiding complex details by simplifying code into reusable parts
d)
Converting code from one language to another
24.
What is the main benefit of using loops in programming?
a)
They make debugging easier
b)
They allow for storing multiple values
c)
They repeat sections of code multiple times
d)
They improve program security
25.
In JavaScript, which symbol is used to begin a single-line comment?
a)
//
b)
/*
c)
#
d)
--
26.
What does the fitMedia() function do in EarSketch?
a)
It adjusts audio volume levels
b)
It synchronizes multiple tracks
c)
It places a sound clip on the digital audio workstation
d)
It converts audio files to different formats
27.
Which of the following is an example of a conditional statement in JavaScript?
a)
let x = 5;
b)
function playSound() { }
c)
if (measure > 8) { }
d)
for (let i = 0; i < 3; i++) { }
28.
What is the primary purpose of comments in code?
a)
To make the program run faster
b)
To tell the computer what to execute next
c)
To explain code to human readers without affecting program execution
d)
To identify errors in the program
29.
In the EarSketch function fitMedia(DRUMS_1, 1, 1, 5), what does the number 5 represent?
a)
The volume level
b)
The track number
c)
The ending measure
d)
The tempo in beats per minute
30.
Which of the following would create a loop that runs exactly 5 times in JavaScript?
a)
while (x < 5) { }
b)
repeat(5);
c)
for (let i = 0; i < 5; i++) { }
d)
loop 5 times { }
31.
What is a bug in programming?
a)
A security feature
b)
A type of loop
c)
An error in the code
d)
A special variable
32.
Which of the following best defines a function in programming?
a)
A value that can change during program execution
b)
A collection of related data items
c)
A block of reusable code that performs a specific task
d)
A decision-making structure
33.
What happens when you call a function in your code?
a)
The function is stored for later use
b)
The function's code is executed
c)
The function is deleted from memory
d)
The function is checked for errors
34.
When designing music with code, what is most important to consider for the audience?
a)
The complexity of the code
b)
The number of functions used
c)
The mood or emotion intended in the song
d)
The programming language being used
35.
Why should variable names be meaningful in programming?
a)
To make the program run faster
b)
To use more memory
c)
To make the code clearer and easier to understand
d)
To impress other programmers
36.
What happens if a condition in an if statement evaluates to false?
a)
The program stops running
b)
An error message appears
c)
The code inside the if block is skipped
d)
The condition is automatically changed to true
37.
Which keyword is used to define a function in JavaScript?
a)
method
b)
procedure
c)
function
d)
def
38.
What is a variable in JavaScript?
a)
A piece of code that runs repeatedly
b)
A mathematical operation
c)
A named container for storing data
d)
A type of function
39.
Which is an example of procedural abstraction?
a)
A for loop
b)
A variable declaration
c)
A custom reusable function
d)
A conditional statement
40.
What does a for loop do in JavaScript?
a)
Checks if a condition is true
b)
Executes a section of code repeatedly
c)
Defines a new function
d)
Creates a new variable
41.
Which programming concept is most helpful when coding repetitive music patterns?
a)
Variables
b)
Functions
c)
Loops
d)
Comments
42.
What does the following code accomplish?
for (let i = 0; i < 3; i++) {
fitMedia(DRUMS_1, 1, i * 4, (i + 1) * 4);
}
a)
Plays DRUMS_1 from beat 0 to 12
b)
Creates three identical overlapping drum patterns
c)
Generates an infinite loop
d)
Causes a syntax error
43.
In programming, what is a function parameter best described as?
a)
A comment explaining the function's purpose
b)
A value that controls how many times a function runs
c)
A value passed into a function
d)
A special data type for music programming
44.
Why is adding comments to code considered a best practice?
a)
To make the program run faster
b)
To improve readability for humans
c)
To prevent errors in the code execution
d)
To reduce the file size
45.
What debugging approach is recommended for efficient problem-solving?
a)
Making multiple changes simultaneously
b)
Rewriting the entire program
c)
Testing one change at a time
d)
Ignoring minor errors
46.
Why is abstraction considered an important concept in programming?
a)
It helps manage complexity
b)
It automatically fixes syntax errors
c)
It increases program execution speed
d)
It reduces the need for variables
47.
What is the result of executing this function?
function playIntro() {
fitMedia(INTRO_BEAT, 1, 1, 5);
}
a)
Deletes the intro beat from the track
b)
Places a sound clip from measures 1 to 5
c)
Changes the tempo of the entire composition
d)
Creates a continuous loop of the intro beat
48.
Which is NOT considered a benefit of abstraction in programming?
a)
Improved code reusability
b)
Simplified code structure
c)
Increased code duplication
d)
More efficient debugging
49.
What is the outcome of the following code?
if (volume > 5) {
println("Too loud!");
}
a)
The message "Too loud!" always displays
b)
The volume is automatically reduced to 5
c)
The message displays only if volume exceeds 5
d)
The program terminates with an error
50.
Which EarSketch function is specifically designed to modify audio properties like volume or pitch?
a)
fitMedia()
b)
println()
c)
setEffect()
d)
init()
51.
In programming terminology, what does "debugging" refer to?
a)
Adding detailed comments to explain complex code
b)
Finding and fixing errors in code
c)
Creating backup copies of important functions
d)
Optimizing code for faster performance
52.
Why should programmers avoid repeating code?
a)
Repeated code uses more memory
b)
Modern programming languages don't support repetition
c)
Repetition increases bugs and complexity
d)
Repeated code always runs slower
53.
What happens when a function is called twice in a program?
a)
The second call is ignored
b)
The function's code runs twice
c)
An error message is generated
d)
The function automatically optimizes the second execution
54.
What does this loop accomplish?
for (let i = 0; i < 2; i++) {
fitMedia(SNARE_1, 1, i * 2, (i + 1) * 2);
}
a)
Plays SNARE_1 continuously throughout the track
b)
Plays SNARE_1 from beats 0-2 and 2-4
c)
Creates a single snare sound at beat 0
d)
Generates a random snare pattern
55.
What is the primary purpose of the println() function?
a)
Plays a specific sound at a specified beat
b)
Displays a value in the console
c)
Creates a new track in the composition
d)
Ends the current function execution
56.
In JavaScript, what is the purpose of the else statement?
a)
It provides an alternative to loops
b)
It executes code when the if condition is false
c)
It terminates the program execution
d)
It creates a backup of variables
57.
Which statement correctly calls a function in JavaScript?
a)
myFunction[];
b)
function myFunction();
c)
call myFunction();
d)
myFunction();
58.
In EarSketch, which function is used to set the tempo of a song?
a)
changeSpeed()
b)
setBPM()
c)
setTempo()
d)
adjustTempo()
59.
Why is frequent testing important during code development?
a)
To make the code run faster
b)
To identify and fix errors early
c)
To add more comments automatically
d)
To increase the file size
60.
In JavaScript, what data type is represented by "EarSketch is fun"?
a)
Array
b)
String
c)
Number
d)
Boolean
61.
Which is a valid JavaScript conditional statement?
a)
if [x == 5] then {}
b)
when (x == 5) do {}
c)
if x equals 5:
d)
if (x == 5) {}
62.
How do you create a loop that runs 5 times in JavaScript?
a)
repeat(5) {}
b)
while (count < 5) {}
c)
for (let i = 0; i < 5; i++) {}
d)
loop 5 times {}
63.
What benefit do comments provide in collaborative programming?
a)
They make the code execute faster
b)
They help explain the code's purpose to others
c)
They automatically fix bugs
d)
They increase the file size
64.
What will the following code output?
for (let i = 1; i <= 3; i++) {
console.log(i*2);
}
a)
1, 2, 3
b)
2, 4, 6
c)
0, 2, 4
d)
2, 3, 4
65.
Why is creative programming valuable in music production?
a)
It requires less computer memory
b)
It allows for personal expression and emotional content
c)
It produces shorter code
d)
It automatically corrects timing errors
66.
What could happen if you omit a semicolon in JavaScript?
a)
Nothing, semicolons are optional
b)
The program will crash immediately
c)
You might encounter syntax errors or unexpected behavior
d)
The code will run twice as fast
67.
Which symbol represents the logical AND operator in JavaScript?
a)
||
b)
&
c)
++
d)
&&
68.
What advantage does placing a function inside a loop provide?
a)
It prevents the loop from running
b)
It repeats a specific task multiple times efficiently
c)
It automatically optimizes memory usage
d)
It converts numbers to strings
69.
What does the following function accomplish?
function createPattern(track, measure) {
fitMedia(DRUMS_1, track, measure, measure + 2);
}
createPattern(2, 5);
a)
Places DRUMS_1 on track 2 from measures 5 to 7
b)
Creates a pattern on all tracks
c)
Plays DRUMS_1 for the entire song
d)
Deletes content from measure 5
70.
What is the result when using the || (OR) operator in a conditional statement?
a)
The condition is true only if all expressions are true
b)
The condition is true if any expression is true
c)
The condition is always false
d)
The condition alternates between true and false
71.
What is the main benefit of using functions in music programming?
a)
They make the code harder to understand
b)
They prevent errors from occurring
c)
They organize code and allow for reusability
d)
They automatically create harmony
72.
What is the relationship between personal interests and computer science innovation?
a)
They must be kept completely separate
b)
Personal interests can inspire technological solutions
c)
Only technical interests matter in computer science
d)
Innovation comes solely from technical knowledge
73.
When developing a technological innovation, what is the first step?
a)
Building a complete product
b)
Writing complex code
c)
Recognizing a problem that needs solving
d)
Selling the idea to investors
74.
What makes a good technological innovation?
a)
It must be completely original
b)
It solves a problem or improves something existing
c)
It must use advanced technology
d)
It has to be expensive to develop
75.
How can different perspectives benefit computer science solutions?
a)
They don't affect computer science
b)
They only matter for design elements
c)
They bring unique insights to problem-solving
d)
They complicate the development process
76.
What role does creativity play in computer science?
a)
It's not important in technical fields
b)
It's only needed for visual design
c)
It's essential for innovative problem-solving
d)
It's only used in gaming applications
77.
What is the purpose of prototyping in innovation?
a)
To create a perfect final product
b)
To quickly visualize and share ideas
c)
To impress potential investors
d)
To complete the development process
78.
How can technology be improved?
a)
Only through major breakthroughs
b)
By expert programmers only
c)
Through small changes that make things better or easier
d)
By completely replacing existing systems
79.
What is the relationship between computing innovations and everyday activities?
a)
They are completely separate
b)
Only experts can connect them
c)
Computing can enhance any area of interest
d)
They only relate to digital activities
80.
In a three-place value pattern using circles and squares, how many unique patterns are possible?
a)
4 patterns
b)
6 patterns
c)
8 patterns
d)
16 patterns
81.
Which aspect of the circle-square system demonstrates a similarity to our decimal number system?
a)
Using only two symbols to represent values
b)
The patterns follow a systematic order
c)
The shapes have mathematical meaning
d)
Each place value represents a different power of ten
82.
What changes in the circle-square system when moving from three place values to four place values?
a)
The fundamental rules remain exactly the same
b)
The number of possible patterns doubles
c)
The shapes must be different
d)
The ordering system becomes completely different
83.
How does the circle-square system relate to modern computer science?
a)
It teaches about computer graphics
b)
It introduces binary representation
c)
It shows how computers draw shapes
d)
It demonstrates computer memory storage
84.
What is a bit in computer science?
a)
A unit of 8 binary numbers
b)
A base-10 number system
c)
A binary digit that can be either 0 or 1
d)
A collection of bytes
85.
How many unique patterns can be represented with 3 binary place values?
a)
4 patterns
b)
2 patterns
c)
6 patterns
d)
8 patterns
86.
A byte consists of how many bits?
a)
16 bits
b)
4 bits
c)
8 bits
d)
2 bits
87.
What is the decimal equivalent of the binary number 0001 0010?
a)
12
b)
18
c)
21
d)
16
88.
In binary number systems, what makes it different from decimal systems?
a)
It uses ten different digits
b)
It uses only the digits 0 and 1
c)
It uses letters instead of numbers
d)
It uses eight different digits
89.
The decimal number 7 in binary is:
a)
1000
b)
0110
c)
0111
d)
1001
90.
What is the range of decimal numbers that can be represented by one byte?
a)
0 to 127
b)
0 to 512
c)
0 to 255
d)
0 to 1024
91.
The binary number 0001 1111 converts to which decimal number?
a)
29
b)
31
c)
15
d)
30
92.
What is the significance of starting to count at 0 in computer science?
a)
It makes calculations easier
b)
It's just a random convention
c)
It allows for more efficient memory usage
d)
It represents the first binary state
93.
In the context of computer memory, a byte is:
a)
Any group of binary numbers
b)
The largest unit of memory
c)
The smallest addressable unit of memory in many computer architectures
d)
A group of 16 bits
94.
What is the primary purpose of ASCII (American Standard Code for Information Interchange)?
a)
To convert binary numbers into decimal numbers
b)
To represent text characters using standardized numerical codes
c)
To compress text messages for faster transmission
d)
To encrypt confidential messages
95.
How many bits are currently used to represent each character in the ASCII system shown in the lesson?
a)
6 bits
b)
7 bits
c)
8 bits
d)
16 bits
96.
In the ASCII table shown, what decimal number represents the uppercase letter 'A'?
a)
97
b)
41
c)
65
d)
32
97.
What concept is demonstrated when we can send text messages without thinking about the underlying binary representation?
a)
Encryption
b)
Compression
c)
Abstraction
d)
Digitization
98.
When converting the text message "how's it going?" to ASCII, what is the first number in the sequence?
a)
111
b)
104
c)
115
d)
32
99.
What symbol is represented by the decimal number 63 in the ASCII table?
a)
>
b)
=
c)
/
d)
?
100.
In the ASCII system, what pattern exists between uppercase and lowercase letters?
a)
Lowercase letters are 32 decimal values higher than their uppercase counterparts
b)
Uppercase letters are 32 decimal values higher than their lowercase counterparts
c)
The difference varies depending on the letter
d)
There is no consistent pattern
101.
What decimal number represents the space character in ASCII?
a)
0
b)
64
c)
32
d)
20
102.
Which range of decimal numbers in ASCII represents numeric digits (0-9)?
a)
30-39
b)
48-57
c)
60-69
d)
40-49
103.
What is binary overflow?
a)
When a binary number becomes negative
b)
When a binary number exceeds the maximum value that can be stored in a fixed number of bits
c)
When a binary number is converted to decimal
d)
When a binary number contains only zeros
104.
In a 4-bit binary system, what happens when you add 1 to 1111?
a)
The result is 11111
b)
The result becomes 1112
c)
The result becomes 0000
d)
The result is 1110
105.
What is the maximum value that can be stored in a 3-bit binary number?
a)
8
b)
6
c)
3
d)
7
106.
Which formula correctly calculates the maximum value for n bits?
a)
2n + 1
b)
2^n - 1
c)
2^n + 1
d)
n^2 - 1
107.
Why does 0.1 + 0.2 result in 0.30000000000000004 in binary?
a)
Due to a programming error
b)
Because of binary representation limitations
c)
Only in specific programming languages
d)
Due to incorrect addition methods
108.
In which real-world application is handling binary overflow particularly crucial?
a)
Word processing software
b)
Image editing programs
c)
Financial software
d)
Music players
109.
What type of numbers cannot be precisely represented in binary?
a)
Whole numbers
b)
Some decimal numbers
c)
Negative numbers
d)
Powers of two
110.
Which real-world example demonstrates binary overflow?
a)
A computer virus
b)
A digital odometer rolling over to zeros
c)
A computer freezing
d)
A printer error
111.
What is the main purpose of EarSketch?
a)
To teach basic music theory
b)
To create professional music albums
c)
To learn computer programming through music creation
d)
To record live instruments
112.
In EarSketch, what does the setEffect function with track 0 do?
a)
Applies an effect to a specific instrument
b)
Applies an effect to the entire song
c)
Removes all effects from the track
d)
Creates a new audio track
113.
How many beats are in one measure in EarSketch?
a)
2 beats
b)
3 beats
c)
4 beats
d)
6 beats
114.
What does debugging refer to in programming?
a)
Adding new features to code
b)
Finding and fixing errors in code
c)
Creating backup copies of code
d)
Sharing code with others
115.
How do you indicate a comment in EarSketch code?
a)
Use two forward slashes (//)
b)
Use an asterisk (*)
c)
Use a hashtag (#)
d)
Use parentheses ()
116.
What is the correct format for the fitMedia function?
a)
fitMedia(sound,track, start, end)
b)
fitMedia(sound, track, end, start)
c)
fitMedia(start, end, sound, track)
d)
fitMedia(end, start, track, sound)
117.
What happens when you use the VOLUME GAIN effect with a negative value?
a)
The volume increases
b)
The volume decreases
c)
The track speeds up
d)
The track slows down
118.
What is the purpose of autocomplete in EarSketch?
a)
To automatically debug code
b)
To predict and suggest code completions
c)
To play music automatically
d)
To save code automatically
119.
What does the setEffect function's GAIN parameter control?
a)
The speed of the track
b)
The volume level
c)
The pitch of the sound
d)
The echo effect
120.
How can you share your EarSketch code with others?
a)
Only through email
b)
By copying the link or entering a username
c)
Only through social media
d)
Only through USB drives
100 %
