A binary search will only work correctly on a list that:
Loading test…
Loading test…
15 questions
A binary search will only work correctly on a list that:
A pipeline to process data consists of three sequential stages that cannot be parallelized: Stage 1 takes 2 seconds, Stage 2 takes 8 seconds, Stage 3 takes 3 seconds. A programmer proposes splitting Stage 2 into four equal parallel tasks (each 2 seconds) running on four processors simultaneously.
What is the total pipeline time after this optimization?
A list scores ← [85, 92, 78, 90, 65] is passed to the procedure below. What value does mystery(scores) return?
PROCEDURE mystery(list)
{
best ← list[1]
FOR EACH item IN list
{
IF (item > best)
{
best ← item
}
}
RETURN best
}
The following pseudocode is intended to find and return the minimum value in a list nums (which has at least one element).
PROCEDURE findMin(nums)
{
minVal ← nums[1]
FOR EACH n IN nums
{
IF n < minVal
{
minVal ← n
}
}
RETURN minVal
}
What does findMin([8, 3, 6, 1, 5]) return?
Consider the following program development scenario:
At step 4, the student is performing which activity?
The Internet protocol stack is organized into layers, where each layer provides services to the layer above it and uses services from the layer below it. Which of the following BEST describes why this layered (abstraction) model is useful?
A data analyst trains a machine learning model to predict loan approval using historical loan data. She later discovers that the historical data reflects past discriminatory lending practices that denied loans to certain demographic groups at higher rates. The model learns from this pattern and replicates it.
This scenario BEST illustrates which concern about data?
A company hosts its website on a single server in one data center. The website goes down whenever the data center loses power. Which of the following upgrades would MOST improve the website's fault tolerance?
A social media platform's recommendation algorithm suggests content based on a user's past engagement. Over time, the user primarily sees content that reinforces their existing beliefs.
Which of the following BEST describes a potential harmful effect of this computing innovation?
A serial (sequential) version of a program takes 60 seconds to run. A parallel version uses 4 processors and contains a portion that cannot be parallelized, which takes 10 seconds. The parallelizable portion takes 50 seconds when run serially. What is the runtime of the parallel version?
A survey of 10,000 adults asks: "Do you use social media daily?" Results show 68% say yes. A researcher concludes that 68% of all humans use social media daily.
Which flaw in this data analysis is MOST significant?
What value does the following pseudocode display?
nums ← [3, 7, 2, 8, 5, 1, 9]
count ← 0
FOR EACH n IN nums
{
IF (n > 4)
{
count ← count + 1
}
}
DISPLAY count
A nonprofit creates an online platform connecting volunteers with local food banks, matching volunteer skills and schedules with food bank needs. The platform was built using donated server time and open-source software.
Which of the following BEST explains how this computing innovation addresses both a social problem AND a concern about equitable access to computing resources?
A program that reads a list of numbers and finds the maximum value contains the following bug: when all numbers are negative, it always returns 0. A developer adds a test case with the input [-5, -1, -3] expecting the output -1 but gets 0. After investigation, she realizes the maximum variable was initialized to 0 instead of the first list element.
Which of the following describes the COMPLETE process used to find and fix this bug?
Which of the following BEST describes an undecidable problem in computer science?