NEW
Font size
WorksheetsSemester 2 (Units 5-7 & 9)
Total questions: 60
Worksheet time: 33mins
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?
The program includes individual variables to store the names of each student rather than a single list of students.
A program includes multiple comments that could be combined into a single comment
A program includes repeated programming statements that could be moved inside a loop
A program includes repeated code that could be moved inside a function.
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?
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"]
wordList[0] = wordList[2]
wordList[2] = wordList[0]
insertItem(wordList, 0, "air")
removeItem(wordList,0)
What will be displayed in the console when this program runs?
2
3
20
30
What will be displayed when this program finishes running?
3
6
7
5
What will be displayed in the console when the following program runs?
0
2
4
6
0
2
4
2
4
6
The program will result in an infinite loop
What will the following program display in the console?
0
1
2
3
0
1
2
3
4
1
2
3
1
2
3
4
What will the following program display in the console?
0
5
10
15
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?
ageList and gradeList contain information about students in a classroom. A programmer has already written the following code with that information.
If the program above is run, what will be displayed in the console?
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 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?
tails has a value of 0 and heads has a value of 100
tails has a value of 100 and heads has a value of 0
tails has a value of 20 and heads has a value of 20
tails has a value of 50 and heads has a value of 50
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 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?
The computer simulation will be able to include more details and complexity than the real-world job placement process.
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.
The computer simulation will be able to precisely predict the real-world outcomes for each job seeker.
The computer simulation will remove the bias that may arise in the real-world job placement process.
Which of the following is true of algorithms?
Algorithms may have an infinite set of instructions
Algorithms must be expressed using a programming language
Every algorithm can be constructed using combinations of sequencing, selection, and iteration
Every problem can be solved with an algorithm
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?
Sequencing
Selection
Iteration
Execution
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 decision problem
An optimization problem
An undecidable problem
An efficiency problem
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?
Line 01 becomes target <- list[2]
Line 04 becomes IF (num < target)
Line 04 becomes IF (num = target)
Line 01 becomes list[0] <- target
Which of the following algorithms is the same as the flowchart shown in the image?
This graph shows the efficiencies of two different algorithms that solve the same problem. Which of the following is most efficient?
These algorithms are equally efficient
Algorithm A is more efficient than algorithm B
Algorithm B is more efficient than algorithm A
The algorithms have different efficiencies depending on the input size
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?
Unreasonable algorithms may sometimes also be undecidable
Heuristics can be used to solve some problems for which no reasonable algorithm exists
Two algorithms that solve the same problem must also have the same efficiency
Approximate solutions are often identical to optimal solutions
Which of the following algorithmic efficiencies would be considered LEAST efficient?
Linear
Constant
Polynomial
Exponential
Which of the following best describes the existence of undecidable problems?
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
Undecidable problems are problems for which an algorithm can be written that will produce the same output for at least two possible inputs
Undecidable problems are problems for which an algorithm can be written that produces a correct output for all inputs but in an unreasonable time
An undecidable problem is a problem for which no algorithm can be constructed that always produces a correct output
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?
The teacher could use either type of search though the linear search is likely to be faster
The teacher could use either type of search though the binary search is likely to be faster
Neither type of search will work since the data is numeric
Only the linear search will work since the data has not been sorted
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]
1
3
6
7
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
I only
I and II
II and III
I, II, and III
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
The algorithm will likely require less time to run though the improvements in efficiency will not be as significant as before.
The algorithm is unlikely to still run since parallel algorithms are not designed to scale to additional computers
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
6 minutes
4 minutes
2
3
Which code segment results in "true" being returned if a number is even? Replace "MISSING CONDITION" with the correct code segment.
num % 2 == 0;
num % 0 == 2;
num % 1 == 0;
num % 1 == 2;
[2, 5, 3, 1, 6]
[0, 3, 6, -1, 9]
[-1, 2, 6, -2, 8]
[5, 2, 6, 3, 9]
Which function calls would provide the most helpful test of this function?
You have imported a library with the birthMonth() function. Based on the API, how many strings are inputed to calculate the birth month?
1
4
0
3
listAverage() returns the average number in a list. Which of these functions does this correctly?
What is printed to the console?
2
3
4
1
Which term refers to a solution to a large problem that is based on the solutions of smaller subproblems.
procedural abstraction
API
parameter
library
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?
OPTION A
OPTION B
OPTION C
OPTION D
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?
numList[i] = min;
min = numList[i];
min = numList;
numList = min;
Algorithms can be created in all the following ways EXCEPT:
creating from an idea
combining existing algorithms
removing sequencing, selection, and iteration from an algorithm
modifying existing algorithms
Using existing algorithms as building blocks for new algorithms has all the following benefits EXCEPT:
reduces development time
reduces testing
simplifies debugging
removes procedural abstraction
What is one of the benefits of using a library in a program?
simplifies creating a complex program
increases development time
removes all testing
reduces abstractions in the program
Which call of the function correctly follows the instructions laid out in the API?
moveElement("button1", 2, 23);
moveElement("button1", "left", "thirty");
moveElement("button1", 30, "two");
moveElement("button1", "down", 25);
Dividing a program into separate subprograms (such as libraries) is known as:
modularity
iteration
API
documentation
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?
Filter photos to those taken in the last week
Filter photos to those taken in a particular country
Filter photos to those taken of buildings
Filter photos to those taken with her favorite camera
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?
The photographer will not be able to view any of the images
The photographer will not be able to sort images by the date they were taken
The photographer will not be able to filter to photographs taken in the morning
The photographer will not be able to find images taken on the same date
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?
How Travel
How Long
Time Arrive
Biggest Challenges
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?
How Travel
How Long
Time Arrive
Biggest Challenges
This question refers to the same table of data described above.
Which information could likely NOT be found with the data collected?
Whether students who are new to the school take longer to get to school than other students
The average time it takes students to get to school
The most common travel mode students use to get to school
Whether students who arrive to school later take longer to get to school
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?
Pens are a better writing tool than pencils
More people use pens than pencils
The number of pens sold has increased slowly over time
At any point in time there are typically more people searching for the word "pen" than "pencil"
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
Finding the same people surveyed previously to ask more detailed questions.
Visiting the same neighborhood to collect more survey responses
Visiting multiple new neighborhoods to collect more survey responses
Having her staff collect the data using an app rather than paper surveys
In which of the following situations would parallel systems MOST likely be used to help analyze data?
Data analysis involving two or more columns of data
Data analysis involving both string and numeric data
Data analysis involving large datasets
Data analysis that could result in two or more different types of visualizations
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?
Dog breeds with a higher maximum weight tend to have shorter maximum lifespans
Dog breeds with a higher maximum weight tend to have longer maximum lifespans
All dog breeds tend to have the same average lifespan
Older dogs weigh more than younger dogs
Which of the following conclusions is BEST supported by the scatter plot?
Most dogs breeds have a maximum weight of 100 lbs or more
Most dog breeds have a maximum life span of 10 or fewer years
All dog breeds that weigh less than 50 pounds have a maximum lifespan of more than 10 years
No dog breeds that weigh more than 150 pounds are expected to live more than 10 years.
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?
More than half of all states are larger than 100,000 square miles
More than half of all states are smaller than 50,000 square miles
Some states are larger than 200,000 square miles
The most common size of states is between 50,000 and 100,000 square miles
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?
The algorithm will not be biased because using machine learning eliminates human biases
While the algorithm may be biased, the eventual decision made by the algorithm will not be
The algorithm will likely reflect the human biases in the data used to train it
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
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?
Cleaning a data visualization to remove unwanted patterns
Iteratively creating visualizations to ask and answer new questions
Cleaning data to remove inconsistencies
Filtering the data to look at the responses from only certain groups
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?
Citizen science
Crowdfunding
Open data
Machine Learning
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?
Citizen science
Crowdfunding
Open data
Machine Learning
