wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

CS Principles Unit 6 Assessment

Total questions: 22

Worksheet time: 16mins

Name
Class
Date
1.

What is the third step using Binary Search to look for the number 32 in this list:

[1, 2, 3, 4, 10, 11, 16, 25, 32, 33, 45, 47, 51, 69, 75]

a)

Compare the number 25 to the given number.

b)

Compare the number 4 to the given number.

c)

Compare the number 33 to the given number.

d)

Compare the number 47 to the given number.

2.

Which of the following is true of two algorithms designed to solve the same problem?

a)

If two algorithms solve the same problem they must have the same efficiency

b)

If two algorithms solve the same problem they must have different efficiency

c)

For any given problem there is a single algorithm that can solve it with a single efficiency

d)

It is possible for two algorithms with different efficiencies to solve the same problem

3.

Which of the follow efficiencies would be considered unreasonable?

a)

2^n

b)

2n

c)

n^2

d)

n^20

4.

A team of programmers is trying to determine the efficiency of a piece of code. They run the code with inputs of different sizes and also record the number of iterations through the core block of code. The data is recorded in the table below.

Based on the data provided, does this algorithm run in a reasonable or unreasonable time? Explain your answer

4 lines
5.

In which of the following situations is it most appropriate to use a heuristic solution?

a)

The only algorithms that provide exact solutions run in linear time

b)

The problem has been identified as undecidable

c)

The only algorithms that provide exact solutions run in unreasonable time but exact solutions are not necessary

d)

Two different algorithms have been identified that solve the problem in reasonable time

6.

Problems that are undecidable and algorithms that are unreasonable both touch on the limits of the kinds of computing that a computer can accomplish. In your own words, explain the difference between undecidable problems and unreasonable time algorithms.

4 lines
7.

An algorithm was initially written sequentially. Later it was determined that a parallel solution was possible and so the algorithm rewritten. The times to run each version of the algorithm are included in the table below.

What is the speedup of this parallel solution?

a)

2

b)

3

c)

20 mins

d)

10 mins

8.

Which of the following is true of algorithms?

a)

Algorithms may have an infinite set of instructions

b)

Algorithms must be expressed using a programming language

c)

Every algorithm can be constructed using combinations of sequencing, selection, and iteration

d)

Every problem can be solved with an algorithm

9.

The following algorithm is followed by a person every morning when they get up from bed to go to school. Which concept does this algorithm BEST demonstrate?

a)

Sequencing

b)

Selection

c)

Iteration

d)

Execution

10.

Which of these algorithms will move the robot along the same path as the algorithm below?

a)
b)
c)
d)
11.

A town government is designing a new bus system and are deciding where to put the different bus stops. They want to pick the collection of locations that minimizes the distance anyone needs to walk in order to get to at least one bus stop. What term best defines the kind of problem?

a)

A decision problem

b)

An optimization problem

c)

An undecidable problem

d)

An efficiency problem

12.

The algorithm below is used to find the largest element in a list of numbers.

By modifying one of the lines in the program it is possible to make the algorithm find the SMALLEST element. Which line would need to be modified and how?

a)

Line 01 becomes

target <- list[2]

b)

Line 04 becomes

IF (num < target)

c)

Line 04 becomes

IF (num = target)

d)

Line 01 becomes

list[0] <- target

13.

Which of the following algorithms is the same as the following flowchart?

a)
b)
c)
d)
14.

This graph shows the efficiencies of two different algorithms that solve the same problem. Which of the following is most efficient?

a)

These algorithms are equally efficient

b)

Algorithm A is more efficient than algorithm B

c)

Algorithm B is more efficient than algorithm A

d)

The algorithms have different efficiencies depending on the input size

15.

A school is creating class schedules for its students. The students submit their requested courses and then a program will be designed to find the optimal schedule for all students.

The school has determined that finding the absolute best schedule cannot be solved in a reasonable time. Instead they have decided to use a simpler algorithm that produces a good but non-optimal schedule in a more reasonable amount of time.

Which principle does this decision best demonstrate?

a)

Unreasonable algorithms may sometimes also be undecidable

b)

Heuristics can be used to solve some problems for which no reasonable algorithm exists

c)

Two algorithms that solve the same problem must also have the same efficiency

d)

Approximate solutions are often identical to optimal solutions

16.

Which of the following algorithmic efficiencies would be considered LEAST efficient?

a)

Linear

b)

Constant

c)

Polynomial

d)

Exponential

17.

Which of the following best describes the existence of undecidable problems?

a)

Undecidable problems are problems for which more than one algorithm solves the problem and computer scientists have not yet chosen the algorithm they believe is best

b)

Undecidable problems are problems for which an algorithm can be written that will produce the same output for at least two possible inputs

c)

Undecidable problems are problems for which an algorithm can be written that produces a correct output for all inputs but in an unreasonable time

d)

An undecidable problem is a problem for which no algorithm can be constructed that always produces a correct output

18.

A group of students writes their names and unique student ID numbers on sheets of paper. The sheets are then randomly placed in a stack.

Their teacher is looking to see if a specific ID number is included in the stack. Which of the following best describes whether their teacher should use a linear or a binary search?

a)

The teacher could use either type of search though the linear search is likely to be faster

b)

The teacher could use either type of search though the binary search is likely to be faster

c)

Neither type of search will work since the data is numeric

d)

Only the linear search will work since the data has not been sorted

19.

A computer is performing a binary search on the sorted list of 7 numbers below. What is the maximum number of iterations needed to find the item?

[1, 5, 20, 50, 51, 80, 99]

a)

1

b)

3

c)

6

d)

7

20.

Which of the following are benefits of parallel and distributed computing?

I. Distributed computing improves the speed at which an individual computer executes a program

II. Parallel computing scales more effectively than sequential computing

III. Distributed computing allows larger problems to be solved quicker

a)

I only

b)

I and II

c)

II and III

d)

I, II, and III

21.

A software company used to run an algorithm sequentially on one server. As more users start using their app, the company decided to rewrite the program to be parallel. It is now run on four separate servers instead of one Thanks to the use of a parallel algorithm, the same process that used to take 40 minutes to run now only requires 20 minutes.

The company is considering purchasing additional computers to decrease the time the program runs even further. Which of the following best describes the impacts of running the parallel algorithm on an even larger number of computers

a)

The algorithm will likely require more time since it is now being run sequentially on more computers.

b)

The algorithm will likely require the same amount of time to run because it is processing the same amount of data

c)

The algorithm will likely require less time to run though the improvements in efficiency will not be as significant as before.

d)

The algorithm is unlikely to still run since parallel algorithms are not designed to scale to additional computers

22.

A sequential algorithm is broken into three stages

Sequential Algorithm Time

Download stage: 1 minute

Sorting stage: 6 minutes

Upload stage: 1 minute

A parallel version of the algorithm completes the sorting stage in parallel leading to a new set of times

Parallel Algorithm Time

Download stage: 1 minute

Sorting stage: 2 minutes

Upload stage: 1 minute

What is the speedup of the parallel solution?

a)

6 minutes

b)

4 minutes

c)

2

d)

3