1
WGU C949 DATA STRUCTURES AND ALGORITHMS I
OBJECTIVE ASSESSMENT EXAM 200 QUESTIONS AND
CORRECT DETAILED ANSWERS WITH RATIONALES
(VERIFIED ANSWERS) |AGRADE.
.
1.
A software developer is designing a program that must repeatedly
examine a collection of student identification numbers to determine
whether a particular identifier exists. The collection is stored in an array,
but the identifiers are not maintained in any particular order. The
developer wants to use the simplest searching technique possible and is
not concerned with improving the search beyond checking elements
sequentially until the desired identifier is found or the entire collection
has been examined. Which searching algorithm is most appropriate for
this requirement?
A. Binary search
B. Linear search
C. Hash search
D. Interpolation search
Answer: B. Linear search
2.
A programmer has an array containing 10,000 values that have already
been sorted in ascending order. The program must locate a specific value
as efficiently as possible, and the programmer understands that the
search algorithm can eliminate approximately half of the remaining
search space after every comparison. Assuming the array remains sorted
while the searches are performed, which algorithm should the
programmer select?
,2
A. Linear search
B. Binary search
C. Depth-first search
D. Breadth-first search
Answer: B. Binary search
3.
A developer is comparing two algorithms for processing increasingly
large datasets. Algorithm A requires approximately 5n operations for an
input of size n, while Algorithm B requires approximately n² operations.
For very large values of n, the developer wants to select the algorithm
whose growth rate remains substantially smaller as the input size
increases. Which algorithm has the better asymptotic growth rate?
A. Algorithm A
B. Algorithm B
C. Both algorithms have the same growth rate
D. The growth rate cannot be determined from the information given
Answer: A. Algorithm A
4.
A computer science student is analyzing an algorithm that performs a
constant number of operations regardless of whether the input contains
10 elements, 1,000 elements, or 1,000,000 elements. The student wants
to express the algorithm's asymptotic time complexity using Big-O
notation. Which notation most accurately describes this algorithm?
A. O(log n)
B. O(n)
C. O(n²)
D. O(1)
Answer: D. O(1)
,3
5.
A program processes every element in an input array exactly once,
performing a fixed amount of work for each element and not using
nested loops or recursion that repeatedly processes the same elements. If
the array contains n elements, how should the running time of this
algorithm generally be classified using Big-O notation?
A. O(1)
B. O(log n)
C. O(n)
D. O(n²)
Answer: C. O(n)
6.
A developer writes an algorithm containing two nested loops. The outer
loop executes n times, and for every iteration of the outer loop, the inner
loop also executes n times. Each inner-loop iteration performs constant-
time work. Assuming no early termination occurs, which Big-O
classification best describes the algorithm's time complexity?
A. O(1)
B. O(log n)
C. O(n)
D. O(n²)
Answer: D. O(n²)
7.
A sorted array contains one million elements, and a program uses binary
search to locate a requested value. During each comparison, the
algorithm determines whether the target is smaller or larger than the
middle element and then discards approximately half of the remaining
, 4
elements. Which Big-O complexity best describes the worst-case
running time of the search?
A. O(1)
B. O(log n)
C. O(n)
D. O(n²)
Answer: B. O(log n)
8.
A programmer is asked to select an algorithm for a problem in which the
input size may become extremely large. The programmer compares an
O(n log n) algorithm with an O(n²) algorithm. Both algorithms correctly
solve the problem, but the primary concern is scalability as n becomes
very large. Which algorithm generally provides better asymptotic
performance?
A. O(n²)
B. O(n log n)
C. Both are equivalent
D. O(n³)
Answer: B. O(n log n)
9.
A developer needs a data structure that stores elements in a sequence
where the most recently inserted element must be the first element
removed. The application involves processing nested function calls, and
the developer wants insertion and removal to occur at the same end of
the structure. Which data structure best matches this requirement?
A. Queue
B. Stack
WGU C949 DATA STRUCTURES AND ALGORITHMS I
OBJECTIVE ASSESSMENT EXAM 200 QUESTIONS AND
CORRECT DETAILED ANSWERS WITH RATIONALES
(VERIFIED ANSWERS) |AGRADE.
.
1.
A software developer is designing a program that must repeatedly
examine a collection of student identification numbers to determine
whether a particular identifier exists. The collection is stored in an array,
but the identifiers are not maintained in any particular order. The
developer wants to use the simplest searching technique possible and is
not concerned with improving the search beyond checking elements
sequentially until the desired identifier is found or the entire collection
has been examined. Which searching algorithm is most appropriate for
this requirement?
A. Binary search
B. Linear search
C. Hash search
D. Interpolation search
Answer: B. Linear search
2.
A programmer has an array containing 10,000 values that have already
been sorted in ascending order. The program must locate a specific value
as efficiently as possible, and the programmer understands that the
search algorithm can eliminate approximately half of the remaining
search space after every comparison. Assuming the array remains sorted
while the searches are performed, which algorithm should the
programmer select?
,2
A. Linear search
B. Binary search
C. Depth-first search
D. Breadth-first search
Answer: B. Binary search
3.
A developer is comparing two algorithms for processing increasingly
large datasets. Algorithm A requires approximately 5n operations for an
input of size n, while Algorithm B requires approximately n² operations.
For very large values of n, the developer wants to select the algorithm
whose growth rate remains substantially smaller as the input size
increases. Which algorithm has the better asymptotic growth rate?
A. Algorithm A
B. Algorithm B
C. Both algorithms have the same growth rate
D. The growth rate cannot be determined from the information given
Answer: A. Algorithm A
4.
A computer science student is analyzing an algorithm that performs a
constant number of operations regardless of whether the input contains
10 elements, 1,000 elements, or 1,000,000 elements. The student wants
to express the algorithm's asymptotic time complexity using Big-O
notation. Which notation most accurately describes this algorithm?
A. O(log n)
B. O(n)
C. O(n²)
D. O(1)
Answer: D. O(1)
,3
5.
A program processes every element in an input array exactly once,
performing a fixed amount of work for each element and not using
nested loops or recursion that repeatedly processes the same elements. If
the array contains n elements, how should the running time of this
algorithm generally be classified using Big-O notation?
A. O(1)
B. O(log n)
C. O(n)
D. O(n²)
Answer: C. O(n)
6.
A developer writes an algorithm containing two nested loops. The outer
loop executes n times, and for every iteration of the outer loop, the inner
loop also executes n times. Each inner-loop iteration performs constant-
time work. Assuming no early termination occurs, which Big-O
classification best describes the algorithm's time complexity?
A. O(1)
B. O(log n)
C. O(n)
D. O(n²)
Answer: D. O(n²)
7.
A sorted array contains one million elements, and a program uses binary
search to locate a requested value. During each comparison, the
algorithm determines whether the target is smaller or larger than the
middle element and then discards approximately half of the remaining
, 4
elements. Which Big-O complexity best describes the worst-case
running time of the search?
A. O(1)
B. O(log n)
C. O(n)
D. O(n²)
Answer: B. O(log n)
8.
A programmer is asked to select an algorithm for a problem in which the
input size may become extremely large. The programmer compares an
O(n log n) algorithm with an O(n²) algorithm. Both algorithms correctly
solve the problem, but the primary concern is scalability as n becomes
very large. Which algorithm generally provides better asymptotic
performance?
A. O(n²)
B. O(n log n)
C. Both are equivalent
D. O(n³)
Answer: B. O(n log n)
9.
A developer needs a data structure that stores elements in a sequence
where the most recently inserted element must be the first element
removed. The application involves processing nested function calls, and
the developer wants insertion and removal to occur at the same end of
the structure. Which data structure best matches this requirement?
A. Queue
B. Stack