• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 3 out of 17 pages
Exam (elaborations)

WGU C950 Data Structures and Algorithms II: Exam 2 Questions with Correct Answers

Document preview thumbnail
Preview 3 out of 17 pages

WGU C950 Data Structures and Algorithms II: Exam 2 Questions with Correct Answers 100 questions 1. The 'n' in Big-O analysis represents: A. The number of programmers B. The speed of the CPU C. A constant D. The size of the input Correct Answer: D. The size of the input Rationale: Input size. 2. Appending to the end of a Python list is: A. O(n) always B. O(log n) C. O(n^2) D. Amortized O(1) Correct Answer: D. Amortized O(1) Rationale: Occasional resize. 3. Checking membership in a Python set has average complexity

Content preview

WGU C950 Data Structures and Algorithms II: Exam 2 -
Questions with Correct Answers
100 questions

1. The 'n' in Big-O analysis represents:
A. The number of programmers
B. The speed of the CPU
C. A constant
D. The size of the input
Correct Answer: D. The size of the input
Rationale: Input size.

2. Appending to the end of a Python list is:
A. O(n) always
B. O(log n)
C. O(n^2)
D. Amortized O(1)
Correct Answer: D. Amortized O(1)
Rationale: Occasional resize.

3. Checking membership in a Python set has average complexity:
A. O(1)
B. O(n)
C. O(log n)
D. O(n^2)
Correct Answer: A. O(1)
Rationale: Hash-based.

4. An algorithm with O(n log n) complexity is typical of:
A. Linear search
B. Efficient comparison sorts like merge sort
C. Bubble sort
D. Constant-time lookup
Correct Answer: B. Efficient comparison sorts like merge sort
Rationale: Optimal comparison sorting.

5. A program that is O(n^2) may still be acceptable when:
A. Input is huge
B. Real-time constraints exist for millions of items
C. Input sizes are small and remain small
D. Never
Correct Answer: C. Input sizes are small and remain small
Rationale: Practical considerations.

6. If an algorithm is O(n) and takes 2 seconds for n = 1,000, approximately how long for n =
5,000?
A. 5 seconds
B. 25 seconds
C. 2 seconds
D. 10 seconds
Correct Answer: D. 10 seconds
Rationale: Linear scaling.

,7. When simplifying O(3n^2 + 5n + 10), the result is:
A. O(n^2)
B. O(3n^2)
C. O(n)
D. O(5n)
Correct Answer: A. O(n^2)
Rationale: Drop constants and lower-order terms.

8. collections.deque provides O(1) operations at:
A. Both ends
B. The middle only
C. Random indices
D. No positions
Correct Answer: A. Both ends
Rationale: Double-ended queue.

9. Python's '==' operator checks:
A. Value equality
B. Identity
C. Memory address only
D. Type only
Correct Answer: A. Value equality
Rationale: Equality.

10. The heapq module implements:
A. A max-heap only
B. A hash table
C. A linked list
D. A min-heap on top of a list
Correct Answer: D. A min-heap on top of a list
Rationale: Binary heap.

11. Mutable default arguments (e.g., def f(x=[])) can cause bugs because:
A. They are immutable
B. They are deleted
C. They raise errors immediately
D. The same object is reused across calls
Correct Answer: D. The same object is reused across calls
Rationale: Use None instead.

12. A class in Python is:
A. A built-in list
B. A blueprint for creating objects with attributes and methods
C. A loop
D. A module only
Correct Answer: B. A blueprint for creating objects with attributes and methods
Rationale: OOP.

, 13. A Python class attribute differs from an instance attribute because it is:
A. Unique to each instance
B. Private always
C. Shared by all instances
D. Immutable always
Correct Answer: C. Shared by all instances
Rationale: Class-level.

14. A 2D list (list of lists) is a natural way to store:
A. A single integer
B. A string
C. A distance matrix
D. A boolean
Correct Answer: C. A distance matrix
Rationale: Rows and columns.

15. String hashing in Python may vary between runs because of:
A. Hash randomization for security
B. Bugs
C. CPU speed
D. File size
Correct Answer: A. Hash randomization for security
Rationale: PYTHONHASHSEED.

16. A generator in Python:
A. Yields values lazily one at a time
B. Creates all values at once
C. Is a class
D. Sorts data
Correct Answer: A. Yields values lazily one at a time
Rationale: Memory efficient.

17. When a hash table doubles in size, the load factor:
A. Is roughly halved
B. Doubles
C. Stays the same
D. Becomes zero
Correct Answer: A. Is roughly halved
Rationale: Same items, more buckets.

18. Hashing a string key commonly involves:
A. Sorting characters
B. Combining character codes with multiplication and addition
C. Counting vowels only
D. Using the string length only
Correct Answer: B. Combining character codes with multiplication and addition
Rationale: Polynomial rolling hash.

Document information

Uploaded on
October 14, 2026
Number of pages
17
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$13.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Sold
0
Followers
0
Items
332
Last sold
-




Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions