wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Semester 2 (Units 5-7 & 9)

Total questions: 60

Worksheet time: 33mins

Name
Class
Date
1.

A school is developing a program to keep track of information about students and their class schedules. In which of the following instances would a data abstraction be most helpful?

a)

The program includes individual variables to store the names of each student rather than a single list of students.

b)

A program includes multiple comments that could be combined into a single comment

c)

  A program includes repeated programming statements that could be moved inside a loop

d)

A program includes repeated code that could be moved inside a function.

2.

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

a)
b)
c)
d)
3.

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)

4.

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

a)

2

b)

3

c)

20

d)

30

5.

What will be displayed when this program finishes running?

a)

3

b)

6

c)

7

d)

5

6.

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

7.

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

8.

What will the following program display in the console?

a)

0

b)

5

c)

10

d)

15

9.

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)
10.

ageList and gradeList contain information about students in a classroom. A programmer has already written the following code with that information.

a)
b)
c)
d)
11.

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

a)
b)
c)
d)
12.

A program is designed to determine the minimum value in a list of positive numbers called numList. The following program was written as shown. 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)
b)
c)
d)
13.

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 shown 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

14.

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 shown 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)
b)
c)
d)
15.

A job placement agency helps match job seekers with potential employers. The agency would like to design a simulation in order to help predict the likely job placement outcomes for job seekers based on historical trends and patterns. Which of the following is most likely to be a benefit of the simulation?

a)

The computer simulation will be able to include more details and complexity than the real-world job placement process.

b)

The computer simulation could be used to test hypotheses about patterns in the job placement process that are costly or time consuming to observe in reality.

c)

The computer simulation will be able to precisely predict the real-world outcomes for each job seeker.

d)

The computer simulation will remove the bias that may arise in the real-world job placement process.

16.
a)
b)
c)
d)
17.

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

18.

The following algorithm is followed by a person every morning when they get up from bed to go to school

Wake up

Brush teeth

Put on shirt

Put on pants

Put on socks

Put on shoes

Tie shoes

Which concept does this algorithm BEST demonstrate?

a)

Sequencing

b)

Selection

c)

Iteration

d)

Execution

19.

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

20.

The algorithm shown in the image 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

21.

Which of the following algorithms is the same as the flowchart shown in the image?

a)
b)
c)
d)
22.

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

23.

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

24.

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

a)

Linear

b)

Constant

c)

Polynomial

d)

Exponential

25.

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

26.

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

27.

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

28.

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

29.

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)

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

b)

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

c)

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

30.

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

a)

6 minutes

b)

4 minutes

c)

2

d)

3

31.

Which code segment results in "true" being returned if a number is even? Replace "MISSING CONDITION" with the correct code segment.

a)

num % 2 == 0;

b)

num % 0 == 2;

c)

num % 1 == 0;

d)

num % 1 == 2;

32.
a)
b)
c)
d)
33.
a)

[2, 5, 3, 1, 6]

b)

[0, 3, 6, -1, 9]

c)

[-1, 2, 6, -2, 8]

d)

[5, 2, 6, 3, 9]

34.

Which function calls would provide the most helpful test of this function?

a)
b)
c)
d)
35.

You have imported a library with the birthMonth() function. Based on the API, how many strings are inputed to calculate the birth month?

a)

1

b)

4

c)

0

d)

3

36.

listAverage() returns the average number in a list. Which of these functions does this correctly?

a)
b)
c)
d)
37.

What is printed to the console?

a)

2

b)

3

c)

4

d)

1

38.

Which term refers to a solution to a large problem that is based on the solutions of smaller subproblems.

a)

procedural abstraction

b)

API

c)

parameter

d)

library

39.

This function checks if a character is a vowel. If it is, it returns true. Otherwise, it returns false.

Where should return false; be written in the code?

a)

OPTION A

b)

OPTION B

c)

OPTION C

d)

OPTION D

40.

This function finds the minimum number in a list. What should <MISSING CODE SEGMENT> be replaced with in order for this function to operate as expected?

a)

numList[i] = min;

b)

min = numList[i];

c)

min = numList;

d)

numList = min;

41.

Algorithms can be created in all the following ways EXCEPT:

a)

creating from an idea

b)

combining existing algorithms

c)

removing sequencing, selection, and iteration from an algorithm

d)

modifying existing algorithms

42.

Using existing algorithms as building blocks for new algorithms has all the following benefits EXCEPT:

a)

reduces development time

b)

reduces testing

c)

simplifies debugging

d)

removes procedural abstraction

43.

What is one of the benefits of using a library in a program?

a)

simplifies creating a complex program

b)

increases development time

c)

removes all testing

d)

reduces abstractions in the program

44.

Which call of the function correctly follows the instructions laid out in the API?

a)

moveElement("button1", 2, 23);

b)

moveElement("button1", "left", "thirty");

c)

moveElement("button1", 30, "two");

d)

moveElement("button1", "down", 25);

45.

Dividing a program into separate subprograms (such as libraries) is known as:

a)

modularity

b)

iteration

c)

API

d)

documentation

46.

A photographer stores digital photographs on her computer. In this case the photographs are considered the data. Each photograph also includes multiple pieces of metadata including:

Date: The date the photograph was taken

Time: The time the photograph was taken

Location: The location where the photograph was taken

Device: Which camera the photo was taken with

Which of the following could the photographer NOT do based on this metadata?

a)

Filter photos to those taken in the last week

b)

Filter photos to those taken in a particular country

c)

Filter photos to those taken of buildings

d)

Filter photos to those taken with her favorite camera

47.

A photographer stores digital photographs on her computer. In this case the photographs are considered the data. Each photograph also includes multiple pieces of metadata including:

Date: The date the photograph was taken

Time: The time the photograph was taken

Location: The location where the photograph was taken

Device: Which camera the photo was taken with

Due to a computer error, the Time metadata for all of the photographs is accidentally set to the same time of day. The other pieces of metadata and the data itself are not affected by the error. Which of the following is MOST likely to be the result of this problem?

a)

The photographer will not be able to view any of the images

b)

The photographer will not be able to sort images by the date they were taken

c)

The photographer will not be able to filter to photographs taken in the morning

d)

The photographer will not be able to find images taken on the same date

48.

The next three questions all refer to the same dataset described below.

A school is conducting a survey of students to learn more about how they get to school. Students were asked how they travel to school, how long it takes them to get to school, what time they arrive at school, and for a description of their most significant challenges when traveling to school. Several rows of the data collected are shown in the table below.

Which column is data that will likely be most difficult to visualize or analyze?

a)

How Travel

b)

How Long

c)

Time Arrive

d)

Biggest Challenges

49.

This question refers to the same table of data described above.

Which column of data might be able to be visualized or analyzed but first would need to be cleaned?

a)

How Travel

b)

How Long

c)

Time Arrive

d)

Biggest Challenges

50.

This question refers to the same table of data described above.

Which information could likely NOT be found with the data collected?

a)

Whether students who are new to the school take longer to get to school than other students

b)

The average time it takes students to get to school

c)

The most common travel mode students use to get to school

d)

Whether students who arrive to school later take longer to get to school

51.

The chart above shows the frequency of searches for the words "pencil" and "pen" over a 5 year period. Which of the following is the best interpretation of the chart above?

a)

Pens are a better writing tool than pencils

b)

More people use pens than pencils

c)

The number of pens sold has increased slowly over time

d)

At any point in time there are typically more people searching for the word "pen" than "pencil"

52.

The mayor of a city is interested in learning what goals are most important for residents of the city. Members of her staff visit one of the many neighborhoods in the city and ask 20 residents to fill out a survey. The mayor is concerned that the survey may be biased and not accurately reflect the overall interests in her town. Which of the following strategies is MOST likely to address concerns about the data being biased or inaccurate

a)

Finding the same people surveyed previously to ask more detailed questions.

b)

Visiting the same neighborhood to collect more survey responses

c)

Visiting multiple new neighborhoods to collect more survey responses

d)

Having her staff collect the data using an app rather than paper surveys

53.

In which of the following situations would parallel systems MOST likely be used to help analyze data?

a)

Data analysis involving two or more columns of data

b)

Data analysis involving both string and numeric data

c)

Data analysis involving large datasets

d)

Data analysis that could result in two or more different types of visualizations

54.

The chart has a single point for every breed of dog. Each point indicates the maximum weight of that breed and the maximum number of years that breed of dog lives to.

Which of the following conclusions is BEST supported by the scatter plot?

a)

Dog breeds with a higher maximum weight tend to have shorter maximum lifespans

b)

Dog breeds with a higher maximum weight tend to have longer maximum lifespans

c)

All dog breeds tend to have the same average lifespan

d)

Older dogs weigh more than younger dogs

55.

Which of the following conclusions is BEST supported by the scatter plot?

a)

Most dogs breeds have a maximum weight of 100 lbs or more

b)

Most dog breeds have a maximum life span of 10 or fewer years

c)

All dog breeds that weigh less than 50 pounds have a maximum lifespan of more than 10 years

d)

No dog breeds that weigh more than 150 pounds are expected to live more than 10 years.

56.

The histogram chart below has a single bar for every state in the United States. Each state is placed in a bucket, or range, based on its area in square miles.

Which of the following conclusions is BEST supported by the histogram chart?

a)

More than half of all states are larger than 100,000 square miles

b)

More than half of all states are smaller than 50,000 square miles

c)

Some states are larger than 200,000 square miles

d)

The most common size of states is between 50,000 and 100,000 square miles

57.

A bank is developing an algorithm that will help them decide who to make loans to. As input the algorithm will consider information about the person applying for the loan and the amount of money requested, and as output the algorithm will decide whether the bank should give that loan.

The bank intends to develop the algorithm using machine learning techniques. The algorithm will be trained using data from past loan decisions made by human bankers.

Which of the following best describes whether this algorithm will include bias?

a)

The algorithm will not be biased because using machine learning eliminates human biases

b)

While the algorithm may be biased, the eventual decision made by the algorithm will not be

c)

The algorithm will likely reflect the human biases in the data used to train it

d)

Machine learning algorithms cannot be developed using biased data so if there is bias in the data it will be impossible to develop the algorithm

58.

A restaurant is interested in learning about the food preferences of people living nearby to the restaurant and intends to use survey data to help decide which new items to add to the menu. Which of the following is LEAST likely to be part of the process used to analyze the data?

a)

Cleaning a data visualization to remove unwanted patterns

b)

Iteratively creating visualizations to ask and answer new questions

c)

Cleaning data to remove inconsistencies

d)

Filtering the data to look at the responses from only certain groups

59.

A researcher is interested in learning more about the different kinds of plants growing in different areas of the state she lives in. The researcher creates an app that allows residents of the town to photograph plants in their area using a smartphone and record date, time, and location of the photograph. Afterwards the researcher will analyze the data to try to determine where different kinds of plants grow in the state.

Which of the following does this situation best demonstrate?

a)

Citizen science

b)

Crowdfunding

c)

Open data

d)

Machine Learning

60.

A town decides to publicize data it has collected about electricity usage around the city. The data is freely available for all to use and analyze in the hopes that it is possible to identify more efficient energy usage strategies.

Which of the following does this situation best demonstrate?

a)

Citizen science

b)

Crowdfunding

c)

Open data

d)

Machine Learning