Introduction to Algorithms
- 45Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
Which description best defines an algorithm?
Which description best defines an algorithm?
45 questions
- 1
Which description best defines an algorithm?
- A
A physical device that stores input values
- B
A mathematical result that requires no computation
- C
A computational procedure for solving a problem
- D
A collection of data that has already been computed
Correct answer
CA computational procedure for solving a problem
Explanation
An algorithm is a computational procedure: a step-by-step recipe for carrying out a computation or solving a problem.
- A
- 2
Which pattern captures the basic input-computation-output view of an algorithm?
- A
It stores an output first and then determines its inputs
- B
It accepts only text and always produces a numerical output
- C
It describes a problem without specifying any computation
- D
It receives inputs, performs computation, and produces an output
Correct answer
DIt receives inputs, performs computation, and produces an output
Explanation
An algorithm can be viewed as a procedure that accepts inputs, performs computation, and produces an output.
- A
- 3
For an algorithm that multiplies two numbers, what is the stated input-output specification?
- A
The inputs are two integers, and the output is their quotient
- B
The inputs are two products, and the output is an integer factor
- C
The inputs are two integers, and the output is their product
- D
The inputs are two integers, and the output is their sum
Correct answer
CThe inputs are two integers, and the output is their product
Explanation
For multiplication, the specified inputs are two integers, and the required output is their product.
- A
- 4
What makes the pair 121 and 234 an instance of the two-number multiplication problem?
- A
A particular input, such as the pair 121 and 234
- B
The product that results from multiplying any two integers
- C
The step-by-step procedure for multiplying two numbers
- D
The rule that multiplication must use carrying
Correct answer
AA particular input, such as the pair 121 and 234
Explanation
An instance is formed by plugging particular values into a problem's input specification. Here, 121 and 234 are the chosen inputs.
- A
- 5
After an instance of a problem is supplied, what does an algorithm provide?
- A
A general description of the problem's historical importance
- B
A list of possible outputs without instructions for obtaining one
- C
A step-by-step procedure for computing the output from the inputs
- D
A statement that identifies the input but leaves computation to intuition
Correct answer
CA step-by-step procedure for computing the output from the inputs
Explanation
Once the input values are specified, an algorithm gives a step-by-step procedure for computing the answer.
- A
- 6
What is characteristic of carrying out an algorithm once its input is fixed?
- A
The procedure produces an answer without processing its inputs
- B
The procedure is followed mechanically, step by step
- C
The procedure requires a new creative decision at every step
- D
The procedure works only if the input values are guessed
Correct answer
BThe procedure is followed mechanically, step by step
Explanation
Executing an algorithm is described as following mechanical steps, rather than relying on creativity at each step.
- A
- 7
Which description best captures the grade-school procedure for multiplying multi-digit numbers?
- A
The number of digits determines the answer without further arithmetic
- B
The digits are added first, and the resulting sum is repeatedly divided
- C
Partial products are shifted to reflect place value and then added
- D
Each digit is processed independently, and the partial products are never combined
Correct answer
CPartial products are shifted to reflect place value and then added
Explanation
In the grade-school method, each digit produces a partial product; the rows are shifted according to place value and then added.
- A
- 8
Why does grade-school multiplication count as an algorithm?
- A
It is not an algorithm because the answer is numerical
- B
It is an algorithm only if it uses a place-value number system
- C
It is an algorithm only when performed by a computer
- D
It is an algorithm because it gives a step-by-step computation
Correct answer
DIt is an algorithm because it gives a step-by-step computation
Explanation
The example illustrates that a familiar arithmetic routine—such as multiplication by digits, shifting partial products, and adding—is an algorithm because it specifies steps for computing an answer.
- A
- 9
Which statement about the history of algorithms is supported by the content?
- A
Ancient societies used mathematics but had no computational procedures
- B
Algorithms were first created after the invention of electronic computers
- C
People developed computational procedures in ancient times
- D
Algorithms became possible only after the invention of the internet
Correct answer
CPeople developed computational procedures in ancient times
Explanation
Algorithms existed long before modern computers; ancient societies developed procedures to carry out needed calculations.
- A
- 10
What was a common focus of some of the earliest known algorithms?
- A
They often provided procedures for numerical calculations
- B
They mainly described how to build computers
- C
They mainly organized written records without performing calculations
- D
They mainly assigned jobs in modern transportation systems
Correct answer
AThey often provided procedures for numerical calculations
Explanation
Early algorithms were often numerical procedures, including multiplication and other calculations needed for practical or predictive purposes.
- A
- 11
Why might people have needed an algorithm for multiplying two numbers when measuring land?
- A
Dividing one measured side by the other to find its perimeter
- B
Comparing the side lengths to determine the plot's location
- C
Multiplying the measured side lengths to calculate its area
- D
Adding the side lengths to predict the plot's harvest
Correct answer
CMultiplying the measured side lengths to calculate its area
Explanation
Measuring the sides of a rectangular plot and multiplying them provides a way to calculate its area.
- A
- 12
Which practical need helped motivate early computational procedures?
- A
To determine which number system should be used in trade
- B
To calculate how many computers would be needed for a task
- C
To decide which arithmetic operations could be taught in schools
- D
To predict events such as eclipses, full moons, and tides
Correct answer
DTo predict events such as eclipses, full moons, and tides
Explanation
Calculations were used to predict astronomical and natural events, including eclipses, full moons, and tides.
- A
- 13
Which example of an early calculation method is associated with Chinese mathematicians?
- A
Chinese mathematicians used the abacus for calculations
- B
Indian mathematicians used the abacus to define the Turing machine
- C
Greek mathematicians invented the abacus for place-value arithmetic
- D
Persian mathematicians used the abacus to calculate internet search results
Correct answer
AChinese mathematicians used the abacus for calculations
Explanation
The content gives calculations carried out on the abacus by Chinese mathematicians as an example of early algorithms.
- A
- 14
What contribution to arithmetic is attributed to ancient Indian mathematicians?
- A
They developed a place-value number system and associated arithmetic procedures
- B
They developed the first computer and its operating system
- C
They invented the Euclidean algorithm and the sieve for prime testing
- D
They developed the Church–Turing thesis for physical computers
Correct answer
AThey developed a place-value number system and associated arithmetic procedures
Explanation
Ancient Indian mathematicians developed the place-value number system and arithmetic algorithms that worked with it.
- A
- 15
What problem does the Euclidean algorithm address in the examples given?
- A
It is a procedure for calculating greatest common divisors
- B
It is a procedure for assigning planes to airport gates
- C
It is a procedure for listing all possible prime factors of a polynomial
- D
It is a procedure for finding the shortest route between two places
Correct answer
AIt is a procedure for calculating greatest common divisors
Explanation
The Euclidean algorithm is presented as a Greek mathematical procedure for calculating greatest common divisors.
- A
- 16
What is the purpose of the sieve of Eratosthenes in the historical examples?
- A
It finds a shortest path through a road network
- B
It computes the area of a rectangular piece of land
- C
It assigns residents to hospitals based on preferences
- D
It helps identify prime numbers
Correct answer
DIt helps identify prime numbers
Explanation
The sieve associated with Eratosthenes is given as an ancient algorithm for determining whether numbers are prime.
- A
- 17
How were algorithms sometimes regarded in mathematics before the advent of computers?
- A
Every algorithm had to be published before its theorem was studied
- B
Algorithms were sometimes treated as less important than theorems
- C
Mathematicians could not invent procedures before computers existed
- D
Algorithms were always considered more important than mathematical results
Correct answer
BAlgorithms were sometimes treated as less important than theorems
Explanation
Before computers, algorithms were often treated as secondary to mathematical theorems, and some procedures were not considered worth publishing.
- A
- 18
What change did computers bring to the kinds of computations people wanted to perform?
- A
They enabled very large computations impractical for people to perform reliably
- B
They made all mathematical problems solvable without algorithms
- C
They eliminated the need to consider computational efficiency
- D
They made numerical calculations unnecessary in scientific work
Correct answer
AThey enabled very large computations impractical for people to perform reliably
Explanation
Computers made it practical to pursue computations too large for people to carry out reliably, such as multiplying very long numbers or testing a million-digit number for primality.
- A
- 19
Why did the advent of computers help establish the study of algorithms as a serious field?
- A
Computers reduced interest in procedures for solving problems
- B
Computers made algorithms useful only for arithmetic education
- C
Computers caused algorithm study to become separate from computer science
- D
Computers increased demand for efficient algorithms and their systematic study
Correct answer
DComputers increased demand for efficient algorithms and their systematic study
Explanation
The demand to perform large computations efficiently led people to study algorithms as a distinct field rather than treating them as an afterthought.
- A
- 20
What makes the study of algorithms distinctively a computer science discipline in the account?
- A
Algorithms are a branch of computer science because they avoid mathematical ideas
- B
Algorithms are a computer science discipline because their procedures are meant to be implemented on computers
- C
Algorithms are a computer science discipline because computers invent them automatically
- D
Algorithms belong only to mathematics because they cannot be implemented
Correct answer
BAlgorithms are a computer science discipline because their procedures are meant to be implemented on computers
Explanation
Algorithms draw on mathematics, but the content characterizes their study as a computer science discipline because the procedures are intended for implementation on computers.
- A
- 21
What important contribution is attributed to Alan Turing in the 1930s?
- A
Don Knuth proposed a model of computation in the 1930s
- B
Alan Turing proposed a model of computation in the 1930s
- C
Eratosthenes proposed a model for modern electronic computers
- D
Alonzo Church introduced the abacus in the 1930s
Correct answer
BAlan Turing proposed a model of computation in the 1930s
Explanation
In the 1930s, Alan Turing introduced a model of computation called the Turing machine.
- A
- 22
Why is the Turing machine important to the meaning of a computational procedure?
- A
It is a model of computation that clarifies what a computational procedure is
- B
It is a device for routing aircraft between airports
- C
It is a numerical algorithm for multiplying large integers
- D
It is an index that links search terms to geographic locations
Correct answer
AIt is a model of computation that clarifies what a computational procedure is
Explanation
The Turing machine provides a formal model that helps define what counts as a computational procedure.
- A
- 23
What claim does the Church–Turing thesis make about physically realizable computers?
- A
Any physically realizable computer is as powerful as a Turing machine
- B
Any computer is more powerful than a Turing machine if it uses electronics
- C
Only computers built from silicon can carry out a computational procedure
- D
A Turing machine can perform only calculations that humans do mentally
Correct answer
AAny physically realizable computer is as powerful as a Turing machine
Explanation
The Church–Turing thesis states that any computer physically realizable under the laws of physics is as powerful as a Turing machine.
- A
- 24
How can the Turing machine be relevant to algorithm study even if its details are not taught?
- A
It is a historical idea with no connection to computational procedures
- B
It provides a formal model for computation, even when its details are not studied
- C
It shows that algorithms cannot be described precisely
- D
It is another name for a computer search index
Correct answer
BIt provides a formal model for computation, even when its details are not studied
Explanation
The Turing machine supplies a formal foundation, even though the course described in the content does not require teaching its full definition.
- A
- 25
What role is Don Knuth said to have played in modern algorithm study?
- A
His work established that no physical computer can be built
- B
His work helped make algorithm study a serious discipline
- C
He created the first airport scheduling algorithm
- D
He invented the ancient Indian place-value number system
Correct answer
BHis work helped make algorithm study a serious discipline
Explanation
The account credits Don Knuth's work with helping establish the systematic study of algorithms as a serious discipline.
- A
- 26
Why is a prebuilt index useful to a search engine?
- A
It calculates restaurant reviews only after a user visits a restaurant
- B
It builds an index beforehand to support rapid searches
- C
It waits for each search and manually creates a new map
- D
It asks the user to provide every relevant webpage directly
Correct answer
BIt builds an index beforehand to support rapid searches
Explanation
A search engine can build an index in advance so it can quickly retrieve relevant locations and information when a query arrives.
- A
- 27
How can a search engine find Greek restaurants near a user rather than in an unrelated region?
- A
It combines approximate location information with the search query
- B
It selects results randomly from locations around the world
- C
It uses the search terms but cannot consider geographic location
- D
It uses the user's location but ignores the search terms
Correct answer
AIt combines approximate location information with the search query
Explanation
A local search can use the user's approximate GPS location together with the query to find relevant nearby results.
- A
- 28
Which relationships are described as part of the search index and related services?
- A
It connects each search term only to the computer that entered it
- B
It connects geographic locations to search terms and restaurants to reviews
- C
It connects each review directly to a route's traffic conditions
- D
It connects each user's name directly to a list of travel times
Correct answer
BIt connects geographic locations to search terms and restaurants to reviews
Explanation
The described index connects geographic locations to search terms, such as Greek restaurants, and connects restaurants with their reviews.
- A
- 29
How does the described local restaurant search turn a query into useful results?
- A
It uses reviews alone to infer the user's location and query
- B
It creates a new restaurant database from scratch for every search
- C
It returns every restaurant worldwide and leaves location filtering to the user
- D
It uses location and the query to retrieve nearby relevant restaurants and their information
Correct answer
DIt uses location and the query to retrieve nearby relevant restaurants and their information
Explanation
The search system uses the user's location to identify relevant nearby places, then retrieves results for the requested kind of restaurant and associated information.
- A
- 30
Why does a search engine need to perform its search quickly?
- A
They must finish before the user enters a query
- B
They need to return results in milliseconds to seconds
- C
They are required to wait until every restaurant submits a new review
- D
They can take several days because the index is built beforehand
Correct answer
BThey need to return results in milliseconds to seconds
Explanation
Search algorithms need to return results rapidly—on the order of milliseconds to seconds—so that the service does not feel too slow.
- A
- 31
What central problem does a navigation app solve when finding a route from address A to address B?
- A
It locates both addresses on a map and solves a shortest-path problem
- B
It assigns an airplane to each address on the route
- C
It chooses a route without representing roads or locations
- D
It finds a route by sorting addresses alphabetically
Correct answer
AIt locates both addresses on a map and solves a shortest-path problem
Explanation
A navigation service represents addresses on a physical map and computes a shortest path between them.
- A
- 32
Besides a shortest path, what may a route-finding service provide?
- A
It provides only routes that pass through the same location
- B
It replaces the shortest path with a randomly selected route
- C
It can compute alternative paths in addition to a shortest path
- D
It avoids showing routes until traffic information is unavailable
Correct answer
CIt can compute alternative paths in addition to a shortest path
Explanation
The service may provide alternative routes as well as a shortest path, giving the traveler other options.
- A
- 33
How does current traffic information contribute to route guidance?
- A
It ignores traffic and reports only the physical distance
- B
It uses the number of alternative routes as the only time estimate
- C
It uses current traffic information to estimate travel time
- D
It uses restaurant reviews to estimate travel time
Correct answer
CIt uses current traffic information to estimate travel time
Explanation
Current traffic information helps a navigation service estimate how long each path will take, rather than relying only on route distance.
- A
- 34
Why do airports face scheduling problems involving runways and taxiways?
- A
Runways are assigned permanently to individual aircraft
- B
Airports have unlimited runways, so scheduling is unnecessary
- C
Limited runways and taxiways create resource-scheduling problems
- D
Taxiways are used only to calculate passenger preferences
Correct answer
CLimited runways and taxiways create resource-scheduling problems
Explanation
Airports have limited runways and taxiways, so the use of these resources must be scheduled as planes arrive or prepare to depart.
- A
- 35
What kind of problem is assigning a gate to a plane that has landed?
- A
It is an example of an assignment problem
- B
It is an example of a shortest-path problem
- C
It is an example of a place-value calculation
- D
It is an example of a primality-testing problem
Correct answer
AIt is an example of an assignment problem
Explanation
Assigning a gate to a plane after it lands is an example of an assignment problem.
- A
- 36
What kind of problem arises when planes waiting to take off must use a runway?
- A
It is an example of a restaurant-indexing problem
- B
It is an example of a scheduling problem
- C
It is an example of an integer-multiplication problem
- D
It is an example of a resident-matching problem
Correct answer
BIt is an example of a scheduling problem
Explanation
The runway must be scheduled for planes waiting to take off, making departure order a scheduling problem.
- A
- 37
How does an airline typically allocate aircraft to routes?
- A
They schedule available aircraft among the routes they need to fly
- B
They assign aircraft only after every passenger has landed
- C
They permanently reserve one aircraft for every route
- D
They choose aircraft without considering their available fleet
Correct answer
AThey schedule available aircraft among the routes they need to fly
Explanation
Airlines generally schedule the aircraft they have available across the routes they need to fly rather than reserving one particular plane for each route.
- A
- 38
What might an airline do if an aircraft is delayed or develops a technical fault?
- A
A different aircraft may be brought in to serve the route
- B
The same aircraft is assigned to every other route
- C
The route is converted into a shortest-path problem for passengers
- D
The affected route is always canceled without replacement
Correct answer
AA different aircraft may be brought in to serve the route
Explanation
When a plane is delayed or has a technical problem, another aircraft may be brought into service, which illustrates vehicle assignment or routing challenges.
- A
- 39
What transportation task might a package-delivery company use algorithms to handle?
- A
It assigns a permanent delivery truck to every package
- B
It computes a prime number for every package
- C
It finds restaurant reviews near each shipment
- D
It schedules packages on appropriate planes or other transportation
Correct answer
DIt schedules packages on appropriate planes or other transportation
Explanation
A shipping company must schedule packages onto suitable planes or other transport to move them between locations.
- A
- 40
Which delivery task matches the traveling salesperson problem described in the content?
- A
Finding a single shortest road between two addresses
- B
Scheduling aircraft to land on limited runways
- C
Visiting multiple delivery addresses and returning to the starting depot
- D
Assigning one package to one aircraft without considering other packages
Correct answer
CVisiting multiple delivery addresses and returning to the starting depot
Explanation
The described delivery truck must visit multiple addresses and then return to its starting depot, matching the traveling salesperson problem setup.
- A
- 41
Why might improving solutions to the traveling salesperson problem matter to a delivery company?
- A
It is difficult because a truck cannot return to its starting depot
- B
It is easy, and solving it has little practical economic effect
- C
It is difficult, and efficient solutions could produce large cost savings
- D
It applies only to airplane takeoffs and cannot affect delivery costs
Correct answer
CIt is difficult, and efficient solutions could produce large cost savings
Explanation
The traveling salesperson problem is described as difficult to solve, but improvements in solving it efficiently could save companies substantial money.
- A
- 42
Which type of algorithm is described as supporting the residency matching program?
- A
It uses a stable marriage algorithm to match students with residency positions
- B
It uses the sieve of Eratosthenes to select residency applicants
- C
It uses the Euclidean algorithm to assign hospitals to locations
- D
It uses a shortest-path algorithm to rank medical schools
Correct answer
AIt uses a stable marriage algorithm to match students with residency positions
Explanation
The residency match program is described as using a stable marriage algorithm to match medical students with residency positions.
- A
- 43
What allocation problem does the residency match program address?
- A
It finds the shortest route between hospitals and medical schools
- B
It matches residents seeking positions with hospitals seeking trainees
- C
It assigns each medical student to a different delivery route
- D
It calculates how many aircraft each hospital should receive
Correct answer
BIt matches residents seeking positions with hospitals seeking trainees
Explanation
The matching program helps connect residents seeking training positions with hospitals seeking trainees, filling positions on both sides.
- A
- 44
Which additional application of matching algorithms is mentioned?
- A
Matching aircraft with mathematical theorems
- B
Matching airport runways with restaurant search terms
- C
Matching kidney donors with kidney patients
- D
Matching delivery trucks with prime numbers
Correct answer
CMatching kidney donors with kidney patients
Explanation
The content also identifies matching kidney donors with kidney patients as an application of algorithms.
- A
- 45
What broad practical benefit do the logistics examples illustrate?
- A
They help schedule and assign resources efficiently and reduce waste
- B
They eliminate the need for people to make every operational decision
- C
They ensure that every problem has only one possible solution
- D
They replace all physical resources with computational procedures
Correct answer
AThey help schedule and assign resources efficiently and reduce waste
Explanation
Across the examples, algorithms help schedule scarce resources, make assignments, and reduce wasted time or resources.
- A

Ask anything
We've read this whole study set, so questions about it get the best answers.