wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

AP CSP Midterm 2019

Total questions: 89

Worksheet time: 5hrs 1mins

Name
Class
Date
1.
What is the slowest type of sort
a)
Merge
b)
Selection
c)
Bubble
d)
Quick
2.
Sam wants to send an image that uses lossy compression image format, what file type should he use?
a)
gif
b)
png
c)
jpeg
d)
pik
3.
Which of the following statements are true about algorithms?
I. If an algorithm runs in reasonable time, the number of steps the algorithm takes is a polynomial function (constant, linear, squared, etc.) of the size of the input.
II. All problems can be solved using an algorithm that runs in reasonable time.
III. If a problem cannot be solved in reasonable time, a heuristic approach is helpful to solve the problem.
a)
I, II
b)
I, III
c)
I, II, III
d)
None of the options
4.
Imagine there is a programming language which uses two different data types to store integers - a 16-bit short data type and a 64-bit long data type. Then which of the following statements is true about the two data types?
a)
The long data type can store 2^48 times as many distinct values as the short data type
b)
The long data type can store 2^64 times as many distinct values as the short data type
c)
The long data type can store 2^16 times as many distinct values as the short data type
d)
The short data type can store 4 times as many distinct values as the long data type
5.
Imagine there is a programming language which uses two different data types to store integers - a 16-bit short data type and a 64-bit long data type. Then which of the following statements is true about the two data types?
a)
The long data type can store 2^48 times as many distinct values as the short data type
b)
The long data type can store 2^64 times as many distinct values as the short data type
c)
The long data type can store 2^16 times as many distinct values as the short data type
d)
The short data type can store 4 times as many distinct values as the long data type
6.
In a freezer, the temperature can be increased, but should not go above 0° C. It can, however, be exactly equal to 0° C. The unfinished code for increasing the temperature in a freezer is shown below. The variable temp represents the current temperature in degrees Celsius.
Which of the following conditional statements will allow the code to function as expected?
I. temp == 0 
II. temp > 0
III. temp < 0
IV. NOT (temp >= 0)
PROCEDURE incrementTemperature(temp) 
{
IF (<MISSING CODE>)
{
temp ← temp + 1
}
RETURN temp
}
a)
I. and II. only
b)
I. and III. only
c)
I. and IV. only
d)
III. and IV. only
7.
The Traveling Salesman Problem is a problem in theoretical computer science in which one tries to find the shortest route that passes through every point in a set, once and only once. The optimal solution to the problem for an arbitrary set of of points cannot be found in a reasonable amount of time, that is, it cannot be found in polynomial time. However, we can find an approximation to the optimal solution in a reasonable amount of time. It would be best to find the approximate solution using a
a)
The output of the circuit is always Heuristic algorithm
b)
Brute-Force algorithm
c)
Recursive algorithm
d)
Dynamic algorithm
8.
Which of the following statements is true about the output of this circuit?
a)
The output of the circuit is always true
b)
The output of the circuit is the same as the value of input A
c)
The output of the circuit is the same as the value of input B
d)
The output of the circuit is always false
9.
If the number of steps that an algorithm takes is equal to a linear function of the input size, then which of the following statements is true regarding the runtime of the algorithm?
a)
The run-time is directly proportional to the input size.
b)
The run-time is inversely proportional to the input size.
c)
The run-time of the program does not change with respect to the input size.
d)
The run-time first increases and then decreases as the input size is increased.
10.
Trace the value of an integer variable n in the following code.
i ← 1
n ← 2
REPEAT until i = 4
{
  n ← n * 2
  i ← i + 1
}
  What is n?
a)
4
b)
8
c)
16
d)
32
11.
A programmer is writing code to switch the values of two integer variables, namely a and b, using a temporary integer variable, temp. Will the pseudo-code correctly perform the required task (assume that a and b are never numerically equal)?
This is the pseudo-code that the programmer has come up with:
temp ← a  # statement 1.
b ← temp  # statement 2.
a ← b  # statement 3.
a)
Yes, the code correctly switches the values of 'a' and 'b'.
b)
No, but it will work correctly if statements 1. and 3. are switched.
c)
No, but it will work correctly if statements 2. and 3. are switched.
d)
No, but it will work correctly if statements 1. and 2. are switched.
12.
Which of the following statements about abstraction is true?
a)
Abstraction requires users to understand the low-level details of a system.
b)
Abstraction reduces information and detail to facilitate focus on relevant concepts.
c)
Abstraction increases the run-time complexity of a program.
d)
Abstraction compresses a program file to reduce file size.
13.
Which of the following statements are true regarding compressing files?
1. If lossless compression is applied, every single bit of data that was originally in the file remains after the file is uncompressed.
2. No matter what compression technique is used, once a data file is compressed, it cannot be restored to its original state.
3. The amount of data reduction possible using lossy compression is often much higher than through lossless techniques.
a)
1 and 3
b)
1, 2 and 3
c)
1 and 3
d)
2 and 3
14.
A student purchases a single-user license of an online textbook and wants to share the textbook with their classmates. Under what conditions is it acceptable for the student to share this textbook?
a)
If the student shares only three chapters of the textbook with their classmates
b)
If the textbook is only shared with people in the student’s class
c)
If the textbook is only shared with one other classmate
d)
If the student gets permission from the textbook’s copyright owner
15.
Efficiency of algorithms is most often analyzed based on which of the following characteristics?
a)
The number of lines of computer code needed to implement the algorithm.
b)
The time and memory space necessary to run the algorithm.
c)
How easy or difficult the algorithm is to understand.
d)
The size of the output obtained after running the algorithm.
16.
A red triangle is pictured below in a grid of squares. It is currently facing upward, and can only move using the MoveTriangle procedure, shown below. The triangle can move onto white and gray squares, but not onto the black squares.
PROCEDURE MoveTriangle (numMoves, numTurns)
{ 
REPEAT
numMoves TIMES   

MOVE_FORWARD() 
}
 
REPEAT numTurns TIMES 
{   
TURN_RIGHT() 
}
}
Which of the following instructions will get the red triangle to the gray square?
a)
 
MoveTriangle (1, 1) MoveTriangle (1, 1) MoveTriangle (3, 1) MoveTriangle (3, 0)
b)
MoveTriangle (4, 1)
MoveTriangle (4, 0)
c)
MoveTriangle (1, 1)
MoveTriangle (1, 3)
MoveTriangle (3, 1)
MoveTriangle (3, 0)
 
d)
MoveTriangle (1, 1)
MoveTriangle (1, 3)
MoveTriangle (3, 3)
MoveTriangle (3, 0)
17.
Consider the following numbers Binary 1001001Decimal 70Hexadecimal 4E Which of the following lists the numbers in order from least to greatest?
a)
Binary 1001001, Decimal 70, Hexadecimal 4E
b)
Decimal 70, Binary 1001001, Hexadecimal 4E
c)
Binary 1001001, Hexadecimal 4E, Decimal 70
d)
Decimal 70, Hexadecimal 4E, Binary 1001001
18.
ASCII is a character-encoding scheme that uses 7 bits to represent each character. The decimal (base 10) values 65 through 90 represent the capital letters A through Z, as shown in the table below. What ASCII character is represented by the binary (base 2) number 1010001?
a)
S
b)
R
c)
Q
d)
P
19.
A chat Website allows users to post messages to the site. When a user posts a message, the message itself is considered data. In addition to the data, the site stores the following metadata. The time the message was posted and the city from which the message was posted.
Which of the following questions can NOT be answered using only the data and metadata collected?
a)
What topics are most frequently posted about in a particular city?
b)
When is a particular city most active on the site?
c)
Which users post messages most frequently?
d)
What topics are most frequently posted about during a particular time period?
20.
Which of the following statements are true about lossless compression?
I - Lossless compression is used only to send files over the Internet
II - Sending a compressed version of a file ensures that the contents of the file cannot be intercepted by an unauthorized user.
a)
I only
b)
II only
c)
I and II
d)
Neither I nor II
21.
A photographer is manipulating a digital image and overwriting the original image. Which of the following describes a lossy transformation of the digital image?
a)
Creating the gray scale of an image by averaging the amounts of red, green, and blue in each pixel and assigning this new value to the corresponding pixel in the new image. The new value of each pixel represents a shade of gray, ranging from white to black.
b)
Creating a mirrored image by swapping the RGB values from pixels on the left side of an image with RGB values from pixels on the right side of an image.
c)
Swapping the Red and Green values of each pixel so that areas that were red now appear green and vice versa.
d)
Creating the negative of an image by creating a new RGB triplet for each pixel in which each value is calculated by subtracting the original value from 255. The negative of an image is reversed from the original; light areas appear dark, and colors are reversed.
22.
What type of variable is "help"?
a)
Integer
b)
Float
c)
String
d)
List
23.
What kind of data does a float variable contain?
a)
Whole Numbers
b)
words and letters
c)
Decimal numbers
d)
true or false
24.

If the input values are A = 0, B = 0, C = 1, D = 1, what would be the result at output E and G, respectively?

a)

Output E = 0, Output G = 0

b)

Output E = 0, Output G = 1

c)

Output E = 1, Output G = 0

d)

Output E = 1, Output G = 1

25.

If the input values are A = 1, B = 0, C = 1, what would be the result at output D and G, respectively?

a)

Output D = 0, Output G = 0

b)

Output D = 0, Output G = 1

c)

Output D = 1, Output G = 0

d)

Output D = 1, Output G = 1

26.

If the input values are A = 1, B = 0, C = 0, D = 1, what would be the result at output F and G, respectively?

a)

Output F = 0, Output G = 0

b)

Output F = 0, Output G = 1

c)

Output F = 1, Output G = 0

d)

Output F = 1, Output G = 1

27.

If the input values are A = 1, B = 0, C = 1, what would be the result at output E and F, respectively?

a)

Output E = 0, Output F = 0

b)

Output E = 0, Output F = 1

c)

Output E = 1, Output F = 0

d)

Output E = 1, Output F = 1

28.

What is expression that would represent this Boolean Gate Diagram?

a)

(A | B) (+) (C | D)

b)

(A & B) (+) (C | D)

c)

(A | B) | (C & D)

d)

(A & B) (+) (C & D)

29.

What is expression that would represent this Boolean Gate Diagram?

a)

~(A & B) | (C & D)

b)

(A & B) | (C & D)

c)

(A & B) | ~(C & D)

d)

(A & B) | ~(C | D)

30.

What is expression that would represent this Boolean Gate Diagram?

a)

~(A (+) B) & C

b)

(A (+) B) & ~C

c)

(A (+) B) & C

d)

~((A (+) B) & C)

31.

What is expression that would represent this Boolean Gate Diagram?

a)

~(A | B) & C

b)

~((A | B) & C)

c)

~((A | B) & ~C)

d)

(A | B) & C

32.
What is the number 45 as a binary number?
a)
10011111
b)
00001100
c)
00101101
d)
10101010
33.
What is 01010111 in hexadecimal? 
a)
57
b)
60
c)
5A
d)
55
34.
What is Abstraction?
a)
The use of computers to solve problems.
b)
Representing 'real world' problems in a computer using variables and symbols and removing unnecessary elements
c)
Breaking down a large problem into smaller sub-problems.
d)
Identifying the steps involved in solving a problem.
35.
The binary number 01000001 represents the letter "A" in ASCII, which of the following represents the letter "B"
a)
01000011 
b)
01000010 
c)
00100001 
d)
01000001 
36.
ASCII stands for 
a)
American Standard Code for Internet Information
b)
American Scan Codes for Internet Information
c)
American Standard Code for Information Interchange
d)
American Standard Code for Internet Interchange 
37.
Which unit is the smallest?
a)
Megabyte
b)
Kilobyte
c)
Gigabyte
d)
Terabyte
38.

Which unit is the largest?

a)

Megabyte

b)

Terabyte

c)

Gigabyte

d)

Kilobyte

39.

An artist makes an RGB raster image in which each pixel color is encoded with 12-bits --- 4 bits each for red, green and blue.Which of the following correctly shows the hexadecimal value for Red as a 12-bit representation.

a)

F00

b)

00F

c)

FF00

d)

FF0000

40.

Approximately how much bigger (how many more bytes) is a megabyte than a kilobyte?

a)

1,000 times bigger

b)

100,000 times bigger

c)

1,000,000 times bigger

d)

1,000,000,000 times bigger

41.

Approximately 1,000 ________ are equal to 1 terabyte (1 TB).

a)

jengabytes

b)

gigglebytes

c)

gigabytes

d)

megabytes

42.

Which of the following is a reason to use lossy compression?

a)

You want the compressed file to be larger than the original.

b)

You want the highest quality audio file possible, with no modifications.

c)

You want the highest quality image file possible, with no modifications.

d)

You want to save space and are not concerned if the file is the highest quality possible.

43.

a problem solving approach (algorithm) to find a satisfactory solution where finding an optimal or exact solution is impractical or impossible

a)

Lossless Compression

b)

Heuristic

c)

Lossy Compression

d)

encryption

44.

Which of the following is irreversible?

a)

lossy compression

b)

lossless compression

c)

abstraction

d)

RLI

45.

Which of the file types is an audiofile type?

a)

jpg

b)

mp3

c)

png

d)

csv

46.

An original file is 100 MB, it is compressed to 80 MB (including dictionary). What is its compression rate?

a)

90%

b)

80%

c)

20%

d)

100%

47.

Which of the following hexadecimal representations would represent dark green?

a)

#191399

b)

#00FF10

c)

#001313

d)

#001300

48.

How would you lighten the color #bcc8e1?

a)

+50 to each color component

b)

+50 to the red component

c)

-50 to each color component

d)

-50 to the red component

49.

How many bits are needed to represent 8 colors?

a)

8 bits

b)

24 bits

c)

1 hex digit

d)

3 bits

50.

How many bits are needed to represent a 3 x 3 black and white image (exclude metadata)

a)

3 bits

b)

6 bits

c)

9 bits

d)

9 x 24 bits

51.

The color widget uses 3 bytes of metadata. The first two bytes indicate the width and height of the image. The next byte indicates the number of bits that will be used to represent color. How many bits is used to represent color given the metadata (in binary) 00001000 00001000 0001001

a)

3 bits

b)

6 bits

c)

9 bits

d)

12 bits

52.

Which of the following statements is FALSE?

a)

The computer stores colors in hexadecimal

b)

Every color has 3 components. A red, green and a blue component.

c)

A bright color would be represented by a large number.

d)

A computer uses 3 bytes to store a single colored pixel.

53.

Lil’ Nibble, a local Soundcloud rapper, has recorded a new mixtape called “Half-a-byte,” produced by “Mibikibi and the Teraflops.” The mixtape has several audio files that have been compressed into a .ZIP file so they can be transferred easily and a separate .ZIP file containing album artwork and liner notes. If the mixtape .ZIP file takes up 800 MB and the artwork .ZIP file is 300 MB, what size flash drive do you need in order to transfer the files?

a)

512 MB

b)

1.0 GB

c)

4 KB

d)

2.0 GB

54.

Consider the following three binary numbers:

01010

010000

1110

Which of the following lists the numbers in order from least to greatest?

a)

010000

1110

01010


b)

01010

1110

010000


c)

01010

010000

1110


d)

1110

01010

010000


55.

A new or improved idea, device, product, etc, or the development thereof.

a)

Innovation

b)

Technology

c)

Improvement

d)

Protocol

56.

A way of representing information using only two options.

a)

BInary

b)

Doubled

c)

Algorithm

d)

Hexadecimal

57.

A contraction of "Binary Digit"; the single unit of information in a computer, typically represented as a 0 or 1

a)

Bit

b)

Character

c)

BInar

d)

BiDig

58.

Transmission capacity measure by bit rate

a)

Brandwidth

b)

Latency

c)

Bit Length

d)

Transmission Rate

59.

The number of bits that are conveyed or processed per unit of time. e.g. 8 bits/sec.

a)

Bit Rate

b)

Bit Speed

c)

Latency

d)

BPS

60.

Time it takes for a bit to travel from its sender to its receiver.

a)

Latency

b)

Bit Rate

c)

Bit Speed

d)

BPS

61.

A set of rules governing the exchange or transmission of data between devices.

a)

Protocol

b)

Guideline

c)

Packet

d)

Command

62.

American Standard Code for Information Interchange; the universally recognized raw text

a)

ASCII

b)

USACII

c)

QWERTY

d)

IETF

63.

Instructions for a computer.

a)

Code

b)

Comand

c)

Protocol

d)

Direction

64.

A group of computers and servers that are connected to each other.

a)

Internet

b)

Google

c)

Packets

d)

Online Network

65.
Convert 11111111 to decimal
a)
255
b)
245
c)
235
d)
225
66.
Convert 00100100 to decimal
a)
26
b)
36
c)
46
d)
56
67.
Convert 01000100 to decimal
a)
58
b)
68
c)
78
d)
88
68.
Convert 11001100 to decimal
a)
224
b)
134
c)
104
d)
204
69.
If a binary number ends with a 1, it must be...
a)
An odd number
b)
An even number
c)
A prime number
d)
The number 12
70.
Which of these is the correct sequence for the place values for binary numbers?
a)
1, 2, 4, 8, 16, 32, 64, 128
b)
1, 2, 4, 6, 8, 10, 12, 14, 16
c)
1, 2, 3, 4, 5, 6, 7, 8
d)
0, 1
71.
What is the point of binary?
a)
It represents how computers interpret electrical signals
b)
Because we like to make you do extra maths ;-D
c)
For the lulz
d)
Because it describes star systems
72.
Sort the following by levels of abstraction, from lowest to highest:
I.    logic gates
II.   operating systems
III.  programming language
IV.  machine language
a)
I, II, III, IV
b)
I, III, IV, II
c)
I, IV, II, III
d)
I, IV, III, II
73.
The world’s largest computer network which connects millions of computer all over the world is...
a)
the Internet
b)
Time Warner
c)
the Web
d)
the telephone
74.
Sequencing in algorithms means that each step of the algorithm is executed. 
a)
in any order the programmer chooses
b)
all at once
c)
two steps at a time
d)
in the order they are given
75.
a)
A) Input A must be true.
b)
B) Input A must be false.
c)
(C) Input A can be either true or false.
d)
 (D) There is no possible value of Input A that will cause the circuit to have the output true.
76.
What does CPU stand for?
a)
Critical Processing Unit
b)
Core Processing Unit
c)
Common Processing Unit
d)
Central Processing Unit
77.
What does the hard drive do?
a)
Stores information temporarily 
b)
Gives Instructions
c)
Stores information permanently 
d)
Drives through the computer
78.
A generic term for a type of programming statement (usually an if-statement) that uses a Boolean condition to determine, or select, whether or not to run a certain block of statements is ______.
a)
Iteration
b)
Selection
c)
Sequencing
79.

A spinner is divided into three sections. The sector labeled Red is four times as large as each of the sectors labeled Blue and Yellow, which are of equal size. Which of the following correctly simulates the spinner?

a)
b)
c)
d)
80.

Protocol

a)

A set of rules governing the exchange or transmission of data between devices.

b)

A number assigned to any item that is connected to the Internet.

c)

Having multiple backups to ensure reliability during cases of high usage or failure.

d)

A type of computer that forwards data across a network

81.
Which word defines an 'on/off ' scenario, often compared as "true" or "false" ?
a)
boolean
b)
integer
c)
iteration
d)
sectional
82.
What value will the global variable name have after Button1 is clicked?  
a)
Abe
b)
George
c)
Barack
d)
Harry
83.

A raw digital sound file samples a sound wave at some interval and measures the height of the wave at each point. Thus, raw sound is recorded as a list of numbers.

In very broad terms the MP3 audio compression algorithm identifies frequencies and volume levels - low and high - that are outside the range of human hearing and removes the data representing these frequencies from the original. This technique results in a smaller audio file that sounds exactly the same to the human ear.

This technique is an example of what type of compression?

a)

Lossy compression

b)

Lossless compression

c)

Fast Fourier Transform compression

d)

Tailored compression

84.

What is the purpose of a parity bit?

a)

Encryption

b)

Error checking

c)

Issuing a digital certificate

d)

Decryption

85.
In an odd parity scheme, what would be the correct parity bit for the binary string:
1101 0001
a)
1 1101 0001
b)
0 1101 0001
c)
0101 0001
d)
1101 0001 0
86.
01010101 is binary for which ASCII letter
a)
R
b)
S
c)
T
d)
U
87.

What letter of the alphabet would be represented by the following set of numbers representing its RLE compression?


1, 4, 2

1, 1, 3, 1, 1

1, 1, 3, 1, 1

1, 5, 1

1, 1, 4, 1

1, 1, 4, 1

1, 1, 4, 1

1, 5, 1

a)

R

b)

B

c)

C

d)

T

88.

Which of the following code options can be used to move the robot (the black triangle) to the gray square?

a)

REPEAT 2 TIMES:

{

MOVE_FORWARD ()

ROTATE_LEFT ()

MOVE_FORWARD ()

MOVE_FORWARD ()

ROTATE_LEFT ()

}

b)

REPEAT 4 TIMES:

{

ROTATE_LEFT ()

MOVE_FORWARD ()

ROTATE_RIGHT ()

MOVE_FORWARD ()

ROTATE_RIGHT ()

MOVE_FORWARD ()

ROTATE_LEFT ()

}

c)

REPEAT 3 TIMES:

{

MOVE_FORWARD ()

MOVE_FORWARD ()

ROTATE_RIGHT ()

MOVE_FORWARD ()

}

d)

REPEAT 3 TIMES:

{

MOVE_FORWARD ()

MOVE_FORWARD ()

ROTATE_LEFT ()

MOVE_FORWARD ()

}

89.

Bit

a)

A set of rules governing the exchange or transmission of data between devices.

b)

The number of bits that are conveyed or processed per unit of time. e.g. 8 bits/sec.

c)

Time it takes for a bit to travel from its sender to its receiver.

d)

A contraction of "Binary Digit"; the single unit of information in a computer, typically represented as a 0 or 1