Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

AP CSP Review Semester 1 (22-23)

Total questions: 51

Worksheet time: 50mins

Name
Class
Date
1.
Bytes, which are represented by 8 bits, are the units used by computers to represent a character such as a letter or number. The characters in the table are shown with their decimal representations.
Which character, represented in binary as a byte, contains the most zeros?
a)
C
b)
K
c)
.
d)
p
2.
Sort the following by levels of abstraction, from lowest to highest: 
I. 
Physical Internet (wires, cables, etc.)
II. 
HTTP
III. 
TCP
IV. 
IP
a)
I, II, III, IV
b)
I, III, IV, II
c)
I, IV, II, III
d)
I, IV, III, II
3.

Lossless and lossy compression are present in many different file formats  (image, music, video, etc.). The graphic below illustrates how the two  compression formats work. Which of the following statements below is NOT true?

a)

All lossless compression is based on the idea of breaking a file into a  smaller form for transmission or storage and then being put back together in its entirety.

b)

Lossy formats are excellent to use when a file must be compressed and  rebuilt to its exact pre-compressed specifications.

c)

Scanning in a picture creates a lossy format result. The program gives you  its interpretation of the original.

d)

Moving music onto your digital music player is done in a lossless format  to reduce the size of the file.

4.
Consider an algorithm that simulates rolling two number cubes, Cubel and Cube2,  with the numbers 1-6, and then displays the sum of the two cubes’ values. If  the sum is greater than 10, “Winner!” is also displayed; otherwise, “Loser” is  displayed. Put the steps of the algorithm in order.  
Step 1: Assign random values between 1 and 6 to Cubel.
Step 2: If sum is greater than 10, display “Winner!”.
Step 3: Display sum.
Step 4: If the sum is less than or equal to 10, display “Loser”.
Step 5: Assign random values between 1 and 6 to Cube2.
Step 6: Assign the value of Cubel + Cube2 to sum.
a)
Step 1, Step 5, Step 4, Step 3, Step 6, Step 2
b)
Step 5, Step 1, Step 6, Step 3, Step 2, Step 4
c)
Step 5, Step 1, Step 2, Step 4, Step 6, Step 3
d)
Step 1, Step 5, Step 3, Step 6, Step 2, Step 4
5.
What is the main purpose of DNS?
a)
They break large chunks of information into smaller packets.
b)
They translate URLs into IP addresses.
c)
They provide a protocol to error check data in transmission.
d)
They re-arrange data once it has been transmitted across the internet.
6.
Monica is surfing the web one day after class. She types the following web  address, widgets.cs.fbhs.org, into the URL bar in her browser. Which of the  following events is most likely to take place among the DNS servers?
a)
If the first DNS server does not know the IP address of  widgets.cs.fbhs.org she will not be able to access this website
b)
All DNS servers within a predetermined radius will respond with the IP  address of widgets.cs.fbhs.org.
c)
The DNS servers will send the IP address of widgets.cs.fbhs.org
d)
The .org domain means that it can’t be handled by DNS so she will have to  use UDP instead of TCP.
7.
Without protocols the information sent and received through the Internet would  never reach its intended target and even if it did, the message would be a  jumbled mess. Review the lists below and select the one that correctly lists  each protocol with its function.
a)
TCP/IP identifies the resource requested with GET and POST.
DNS relays packet information.
HTTP translates the name of a web server to a valid IP address.
b)
DNS identifies the resource requested with GET and POST.
HTTP relays packet information.
TCP/IP translates the name of a web server to a valid IP address.
c)
TCP/IP identifies the resource requested with GET and POST.
HTTP relays packet information.
DNS translates the name of a web server to a valid IP address.
d)
HTTP identifies the resource requested with GET and POST.
TCP/IP relays packet information.
DNS translates the name of a web server to a valid IP address.
8.
Which of the following protocol standardization is NOT a function of the IETF  (Internet Engineering Task Force)?
a)
Hypertext Transfer Protocol
b)
Internet Protocol
c)
JavaScript Coding Protocol
d)
Transfer Control Protocol
9.
In computer programming, Protocol is best defined as
a)
A set of rules governing the exchange or transmission of data between devices.
b)
Pulling out specific differences to make one solution work for multiple problems.
c)
The time it takes for a bit to travel from its sender to its receiver.
d)
Transmission capacity measured by bit rate.
10.
iTunes sometimes uses a form of Lossy Compression for audio files. This means –
a)
The original audio file can be perfectly reconstructed from the compressed  data.
b)
The compressed audio file is an exact copy of the original audio  recording.
c)
The data compression method discarded some data to represent the content,  the original file cannot be completely reconstructed.
d)
The new file is actually larger than the audio file, but often sounds  better.
11.
What group develops and promotes voluntary Internet standards and protocols?
a)
American Standard Code for Information Interchange (ASCII)
b)
HyperText Transfer Protocol Service (HTTPS)
c)
Transmission Control Protocol Association (TCPA)
d)
Internet Engineering Task Force (IETF)
12.
Why are functions useful in programming?
a)
Functions are an abstraction for some behavior, which once completed and  verified, can be used repeatedly if needed.
b)
Functions ensure that programmers can’t make mistakes.
c)
Functions allow math teachers to teach computer programming.
d)
Functions provide a way for programs to be used in other languages and countries.
13.
A video-streaming Web site uses 32-bit integers to count the number of times  each video has been played. In anticipation of some videos being played more times than can be represented with 32 bits, the Web site is planning to change to 64-bit integers for the counter. Which of the following best describes the result of using 64-bit integers instead of 32-bit integers?
a)
2 times as many values can be represented.
b)
32 times as many values can be represented.
c)
2^32 times as many values can be represented.
d)
32^2 times as many values can be represented.
14.
Which of the following is NOT true about TCP/IP packets?
a)
Packets are numbered so if they arrive out of order the message can Be reassembled.
b)
TCP guarantees that packets are never dropped or lost during transmission.
c)
Packets can be routed on different paths from sender to receiver
d)
Messages are broken into packets to improve the reliability of the internet.
15.
Which of the following is NOT true about functions in programming?
a)
Functions are reusable programming abstractions.
b)
Functions help reduce the complexity of writing and maintaining programs.
c)
Functions cannot make calls to other functions within the same program.
d)
Functions help break a problem into logical chunks.
16.

Consider the following code:

var a = 0

var b = 2

var c = 6

a = a+b

b=a+c

c=a+b

What are the values of a, b, and c after this code segment has been run?

a)

a= 0 b=2 c=6

b)

a=2 b=6 c=2

c)

a=2 b=2 c=8

d)

a= 2 b=8 c=10

17.

What is displayed by the console.log statement after the following code?


var a = 2

var b = 4

var c = 10

a = b/a

b = c-a

c = b/a

console.log("value is: " + c)

a)

value is: 2

b)

value is: 4

c)

value is: 6

d)

value is: 10

18.

This is used to compare two values, and returns a Boolean (true/false)

a)

Local Variable

b)

Global Variable

c)

==

d)

=

19.
In programming, an expression that evaluates to true or false.
a)
Variable Expression
b)
Boolean Expression
c)
Algebraic Expression
d)
Global Expression
20.

Which prompt tells the computer to move to a new line for a string output.

a)

\newLine

b)

\new

c)

\n

d)

\next

21.
Which symbol represents "or" in JavaScript?
a)
||
b)
==
c)
!=
d)
$$
22.
Iteration is
a)
Used in programming to select which statements will be executed next based on a condition
b)
Two or more statements following one after the other
c)
Performing a loop in a program to repeat a number of statements
d)
Finding errors in a piece of code
23.
A store has 20 apples in inventory.How can you store this information in a JavaScript variable?
a)
var numApples == 20;
b)
20 = numApples;
c)
var numApples = 20;
d)
var num apples = 20;
24.
After running the following code, what will be the value of x?
y = 3;
x = 5 * y;
a)
3
b)
5
c)
15
d)
0
25.
The following code will:
x++;
a)
Add 1 to the previous value of x
b)
Add 1 to the previous value of y
c)
Subtract 1 from the previous value of x
d)
Give an error message
26.

list = [1,2,3,4,5]; What would the list look like if we execute the code below? list.append(6);

a)
[1,2,3,4,5,6]
b)
[6,1,2,3,4,5]
c)
[0,1,2,3,4,5]
d)
[6,5,4,3,2,1]
27.

an ordered collection of elements

a)

index

b)

element

c)

list

28.

a common method for referencing the elements in a list or string using numbers

a)

index

b)

element

c)

lists

d)

infinite loop

29.

occurs when the ending condition will never evaluate to true

a)

infinite loop

b)

element

c)

sampling

d)

overflow error

30.

process of accessing each item in a list one at a time

a)

iteration

b)

traversal

c)

lossy compression

d)

lossless compression

31.

list = [1,2,3,4,5]; What is the highest index in this list?

a)
4
b)
5
c)
0
d)
125.7
32.

Which of the following will result in all the items in list being printed to the console if placed where the program reads <INSERT CODE> and the program is run?

a)

 i < list[list.length]

b)

 i < list.length

c)

i < list[0]

d)

i < list[1]

33.

wordList is a list of words that currently contains the values ["tree", "rock", "air"]

Which of the following lines will result in the list containing the values ["air", "rock", "air"]

a)

wordList[0] = wordList[2]

b)

wordList[2] = wordList[0]

c)

insertItem(wordList, 0, "air")

d)

removeItem(wordList,0)

34.

What will be displayed in the console when this program runs?

var numList = [10,20,30];

console.log(numList[numList.length-1]);

a)

2

b)

3

c)

20

d)

30

35.

What will be displayed when this program finishes running?

var numbersList = [20, 10, 5]

appendItem(numbersList, 50)

appendItem(numbersList,100)

removeItem(numbersList,1)

insertItem(numbersList, 0, 30)

console.log(numbersList.length)

a)

3

b)

6

c)

7

d)

5

36.

What will be displayed in the console when the following program runs?

a)

0

2

4

6

b)

0

2

4

c)

2

4

6

d)

The program will result in an infinite loop

37.

What will the following program display in the console?

a)

0

1

2

3

b)

0

1

2

3

4

c)

1

2

3

d)

1

2

3

4

38.

What will the following program display in the console?

a)

0

b)

5

c)

10

d)

15

39.

The following question uses a robot in a grid of squares. The robot is represented by a triangle, which is initially facing up.

Which of the following programs will move the robot to the gray square following the path shown on the grid?

a)
b)
c)
d)
40.

If the program above is run, what will be displayed in the console?

a)

[apple, dream]

b)

[bug, car, ear]

c)

[bug, car, ear, food]

d)

[apple, dream, food]

41.

A program is designed to determine the minimum value in a list of positive numbers called numList. The following program was written. Which of the following can be used to replace <MISSING CODE> so that the program works as intended for every possible list of positive numbers?

a)

0

b)

1000000

c)

numList.length

d)

numList[0]

42.

A 2-sided coin has an equal likelihood of landing on each side. One side is called "heads" and the other is called "tails". The program below simulates randomly flipping that coin many times. Which of the following is NOT a possible combination of values of the variables in this program when it finishes running?

a)

tails has a value of 0 and heads has a value of 100

b)

tails has a value of 100 and heads has a value of 0

c)

tails has a value of 20 and heads has a value of 20

d)

tails has a value of 50 and heads has a value of 50

43.

A restaurant knows from historical data that 60 out of 100 of its customers purchase a full meal while 40 out of 100 only order a side dish. The program below is intended to simulate the orders of 1000 customers. Which of the following can be used to replace <MISSING CODE> so that the simulation works as intended?

a)

random(1,100) = 40

b)

random(1,100) = 60

c)

random(1,100) <= 40

d)

random(1,100) <= 60

44.
What is the 4-bit binary number for the decimal number Ten (10)?
a)
0010
b)
1010
c)
0110
d)
0101
45.

What does HTTP stand for?

a)

Hypertalk Talking Protocol

b)

HyperText Transmission Protocol

c)

Hypertext Transferable Protocol

d)

HyperText Transfer Protocol

46.

What is the RGB value of red?

a)

(255,0,0)

b)

(255,0,255)

c)

(255,255,0)

d)

(0,0,255)

47.

Given the above code segment, what would be displayed if age were initialized with a value of 18?

a)

group 1

b)

group 2

c)

group 1 group 2

d)

Nothing will be displayed

48.

Consider the above code.


Assuming that before this code is run, x = 1. What would be displayed at the end?

a)

210

b)

16

c)

8

d)

1

49.

What condition will make the above an infinite loop?

a)

y = -108

b)

y≠-3

c)

y ≥ 8

d)

y < -53

50.

Consider the above code segment.


Which of the following best describes the result of running the code segment?

a)

The number 0 is displayed.

b)

The number 4 is displayed.

c)

The number 10 is displayed.

d)

Nothing is displayed; the program results in an infinite loop.

51.

ASCII is a character-encoding scheme that uses 7 bits (8 bits if you are using the extended ASCII table) to represent each character. The decimal (base 10) values 65 through 90 represent the capital letters A through Z, as shown in the table above.


Which ASCII character is represented by the binary (base 2) number 1000001?

a)

A

b)

B

c)

C

d)

D