wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

APCSP- Final

Total questions: 25

Worksheet time: 21mins

Name
Class
Date
1.

for (var i = 10; i > 5; i--){

console.log ("p"); }


How many times will "p" be printed?

a)

10

b)

5

c)

6

d)

infinite loop

2.
In programming, an expression that evaluates to True or False. 

a)
Abstraction
b)
Boolean Expression
c)
Aggregate Expression
d)
None of the above
3.
Any sequence of characters between quotation marks (ex: "hello", "42", "this is a string!").
a)
Selection
b)
String
c)
Summary
d)
Protocol
4.
The equality operator is used to compare two values, and returns a Boolean (true/false). 
a)
=
b)
==
c)
<=
d)
>=<
5.
Which are examples of Boolean operators?
a)
AND, OR and NOT
b)
Greater than (>), less than (<) and equal to (=)
c)
Multiplication (*), subtraction (-), addition (+) and division (/)
d)
Picking random numbers
6.

Based on the following, determine whether each expression is TRUE or FALSE


var score= 80;


(score != 90) && (score > 70)

a)

True

b)

False

7.

What is an algorithm

a)

Al Gore wasn't only a vice president, but he also mad some way cool jams too!

b)

breaking down a task into steps which, when carried out, accomplish the main task

c)

When a computer runs code through the CPU

d)

a mathematical procedure designed to complete complex tasks fast

8.

What 2 items below make your code easier to read and manage/edit later?

a)

good variable names

b)

testing your code often

c)

write perfect code the first time

d)

comments

9.

What is more important to know when first starting a program?

a)

what language to use

b)

how much the program will sell for

c)

what data the program needs and what it will do with the data

d)

how long you have to finish the program

10.

Determine what is printed by the following code.


values ⬅ [5, 6, 7, 0, 3, 3]

baz ⬅ 0

FOR EACH value IN values

{

if( value ≥ 7 )

{

baz ⬅ baz + 1

}

}

DISPLAY( baz )

a)

1

b)

0

11.

Consider the following code segment, which uses the variables r, s, and t.

r ← 1

s ← 2

t ← 3

r ← s

s ← t


DISPLAY (r)

DISPLAY (s)

a)

11

b)

12

c)

23

d)

32

12.

Determine what is printed by the following code.


numbers ⬅ [7, 4, 1, 6, 4, 11, 3]

baz ⬅ 0

FOR EACH value IN numbers

{

if( value < 3 )

{

baz ⬅ baz + 1

}

}

DISPLAY( baz )

a)

0

b)

1

c)

none of the above

13.

One data point that is stored in a list. It is a single part of a larger group.

a)

Element

b)

Index

c)

List

14.

A data structure that stores one or more similar types of values in a single value. A collection of individual values that are related.

a)

Element

b)

Index

c)

List

15.

Identifies a value’s unique position on a list. In SNAP & on the APCSP exam the first item is stored at index 1.

a)

Element

b)

Index

c)

List

16.

Performing the same operation on each item of the list, sequentially.

a)

Traverse

b)

Remove/Delete

c)

Append

17.

What is displayed from this code?

a)

1,2,3,4,5

b)

Nothing, it won't run

c)

1, 2, 4, 8

d)

1, 2, 4

18.

A student wants to create an algorithm that can determine, given any program and program input, whether or not the program will go into an infinite loop for that input. The problem the student is attempting to solve is considered an undecidable problem. Which of the following is true?

a)

It is possible to create an algorithm that will solve the problem for all programs and inputs, but the

algorithm can only be implemented in a low-level programming language.

b)

It is possible to create an algorithm that will solve the problem for all programs and inputs, but the

algorithm requires simultaneous execution on multiple CPUs.

c)

It is possible to create an algorithm that will solve the problem for all programs and inputs, but the

algorithm will not run in reasonable time.

d)

It is not possible to create an algorithm that will solve the problem for all programs and inputs.

19.
__________ means to repeat in order to achieve, or get closer to, a desired goal.
a)
Sequence
b)
Iterate
c)
Select
20.
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
21.
Putting commands in correct order so computers can read the commands is 
a)
algorithms
b)
selection
c)
sequencing
22.

An algorithm with an efficiency rating of

 2n2^n or  3n3^n  or  n!n!  

would be considered 

a)

reasonable time

b)

unreasonable time

23.

If the length of the list is 100 times longer, the search will might on average only take 7-8 times longer to complete.


This is true using a:

a)

linear search

b)

binary search

24.

If the length of the list is 100 times longer, the search will probably on average take 100 times longer to complete.


This is true using a:

a)

linear search

b)

binary search

25.

The action of doing something over and over again.

a)

Looping

b)

Bugging

c)

Programming