wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Sem 1 MKPD 3 - T: AP CSP Unit 1 Test (UTeach)

Total questions: 22

Worksheet time: 12mins

Name
Class
Date
1.

Consider the following two algorithms for determining the tallest person in a group.


Algorithm A

Step 1: Everybody stands and lines up against the wall.

Step 2: One person from those who are standing steps forward.

Step 3: One person from those who are standing steps forward.

Step 4: The shorter of these two people who stepped forward sits down.

Step 5: Repeat steps 3 and 4 until only one person is standing.

Step 6: The last person standing is the tallest in the group.


Algorithm B

Step 1: Everybody stands and lines up against the wall.

Step 2: Each standing person pairs up with one other standing person.

Step 3: The shorter member of each pair sits down.

Step 4: Repeat steps 2 and 3 until only one person is standing.

Step 5: The last person standing is the tallest in the group.


Which of the following statements about these two algorithms is true when applied to a group of 32 people?

a)

Algorithm A is never faster than Algorithm B

b)

Algorithm A is rarely faster than Algorithm B

c)

Algorithm A is usually faster than Algorithm B

d)

Algorithm A is always faster than Algorithm B

2.

. Which of the following is a key factor in determining the efficiency of an algorithm?

a)

The machine on which the algorithm is running

b)

The length of the algorithm

c)

The required number of computations required in the algorithm

d)

The amount of computational resources used by the algorithm and the number of times a statement or group of statement executes

3.

Which of the following types of languages is optimized for machine processing and maybe written and expressed as a series of binary digits (e.g., ones and zeros), making it difficult for humans to read and write?

a)

Natural language

b)

Pseudocode

c)

High-level programming language

d)

Low-level programming language – machine language

4.

The local government for a newly developed community would like to begin conducting an annual census to make an accurate count of its current population and gather other relevant demographic information about its residents. The community is currently relatively small and consists of around 500 homes. However, it is growing quickly and expects to have more than 100,000 homes in the next few years.


Which of the following plans would be the most practical and most efficient solution for computing an accurate population count, no matter how large the community grows?

a)

Hire one person to go door-to-door conducting the census. This person will visit

all of the homes in the community once each year.

b)

Hire 100 people to go door-to-door conducting the census. Each of these people

will visit 1% of the homes in the community once each year.

c)

Every year, mail a copy of the census form to every home in the community and

require that each household complete the form themselves and mail it back to a

central office for processing. Then follow up with those that did not.

d)

Conduct the census once for only 100 homes and then estimate the annual

population for all later years based on the relative increase in the number of homes.

5.

Using a Vigenere Cipher with a keyphrase code of BEG, decipher the given hidden message:


kirmc hfet

a)

happy days

b)

knives jump

c)

jelly bean

d)

jumpy jack

6.

Using a Caesar Cipher with an offset of 13, decode the following ciphertext back to plaintext:


znyjner

a)

malware

b)

viruses

c)

cyphers

d)

scratch

7.

Using a Caesar cipher of shift -3, encode the following message:


elevens bench

a)

bibsbkp ybkze

b)

hohyhqv ehqfk

c)

elevens bench

d)

None of the above

8.

According to Moore’s Law, increases in technological performance should approximately double every year. If this holds true, how much can performance be expected to increase over 5 years?

a)

10 times as much

b)

100 times as much

c)

32 times as much

d)

16 times as much

9.

Algorithmic bias exists due to the following:

a)

no concerted effort was made to eliminate it

b)

programmers may intentionally or unintentionally code with personal bias

c)

data sets used exclude certain groups

d)

all of the above

10.

Every task that you deal with on a day-to-day basis, no matter how large or small, requires that you perform a specific set of actions and make a particular set of decisions in very precise ways. These sets of actions and decisions are known as what?

a)

Abstraction

b)

Algorithms

c)

Building Blocks

d)

Processes

11.

A computer programming student has a great idea to correctly calculate the total cost of tickets for a family at a football game. He designs a program that successfully outputs how much money it costs a family of adults and children to attend the game. Adults cost $7 and children cost $3. The program simply asks the family how many adults there are attending and how many children.


Based on those two inputs, with some multiplication and addition, the program then outputs the answer.


- How would we classify how this program scales as the family size increases?

a)

Constant

b)

Logarithmic

c)

Linear

d)

Quadratic

12.

What type of language is used in the below algorithm?


Prompt user for number


if number is greater than or equal to 0

Output “Positive”


else

Output “Negative”




Repeat 4 times

a)

Natural language

b)

Low-level language

c)

High-level language

d)

Pseudocode

13.

An algorithm was developed to keep track of how many baskets a student has made while playing basketball. Which of the following program structures must be added to the old algorithm to create a new algorithm that only keeps track of 3 pt. baskets and not 2 pt. baskets

a)

Iteration

b)

Searching

c)

Sequencing

d)

Selection

14.

Under which of the following conditions is it most beneficial to use a heuristic approach to solve a problem?

a)

When the problem can be solved in a reasonable time and an approximate solution is acceptable

b)

When the problem can be solved in a reasonable time and an exact solution is needed.

c)

When the problem cannot be solved in a reasonable time and an exact solution is needed.

d)

When the problem cannot be solved in a reasonable time and an approximate solution is acceptable

15.

Which of the following is NOT true about high level programming languages?

Select two answers:

a)

Easy for humans to read, write and parse

b)

It is guaranteed to be ambiguous

c)

Easy for machines to parse

d)

All languages are the same in terms of expressing different algorithms

16.

Which of the following algorithms require both selection and iteration?

Select two answers:

a)

An algorithm that, given two integers, displays the greater of the two integers.

b)

An algorithm that, given a list of integers, displays the number of even integers in

the list.

c)

An algorithm that, given a list of integers, displays only the negative integers in

the list.

d)

An algorithm that, given a list of integers, displays the sum of the integers in the

list.

17.

The algorithm below simulates rolling a regular 6-sided die twice. Consider the goal of determining if the sum of the values of the two rolls is odd or even.


Step 1: Using a random number generator, get a value between 1 - 6 inclusively

Step 2: Remember that number

Step 3: Repeat steps 1 and 2

Step 4: Add the two remembered numbers together

Step 5: Divide that sum by 2


What conclusions can be made with regard to what we are trying to determine?


Select two answers:

a)

If the value found in (step 5) is a 1, 3 or 5 then the sum is odd

b)

If the value found in (step 5) is a 1, 2, 3, 4, 5 or 6 then the sum is even

c)

If the value found in (step 5) has a decimal, then the sum is odd

d)

If the value found in (step 5) is a 2, 4, 6, 8, 10 or 12 then the sum is even

18.

In the designing phase of the Development Process, investigation is needed in order to determine a program’s requirements, identify constraints as well as concerns and interest of the people who will use the program. Which of the following are ways to investigate?

Select two answers:

a)

Collecting data through surveys

b)

Creating the program

c)

User testing

d)

Designing the user interface

19.

The table below shows the time a computer system takes to complete a specified task on the customer data of different-sized companies.
 
Based on the information in the table, which of the following tasks is likely to take the longest amount of time when scaled up for a very large company of approximately 100,000 customers?

a)

Backing up data

b)

Deleting entries from data

c)

Searching through data

d)

Sorting data

20.

. Let a = 10, b = 5 and c = 7. Based on the flowchart below, in what order will the values be outputted at the end of the flowchart?

a)

10, 5, 7

b)

7, 10, 5

c)

10, 7, 5

d)

5, 7, 10

21.

What kind of flow pattern is represented by this portion of a larger flowchart?

a)

Sequence

b)

Selection

c)

Iteration

d)

Sorting

22.

This question references a robot in a grid of squares. The robot is represented by the triangle in the bottom left-hand corner and is facing toward the top.


Based on the following algorithm, what would the robot’s final position be?


Step 1: MOVE_FORWARD

Step 2: MOVE_FORWARD

Step 3: IF (CAN_MOVE(right))

Step 4: ROTATE_RIGHT

Step 5: MOVE_FORWARD

Step 6: MOVE_FORWARD

Step 7: IF (CAN_MOVE(left))

Step 8: ROTATE_LEFT

Step 9: MOVE_FORWARD

Step 10: ROTATE_LEFT

a)
b)
c)
d)