• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 3 fuera de 17 páginas
Examen

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

Document preview thumbnail
Vista previa 3 fuera de 17 páginas

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

Vista previa del contenido

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.

Información del documento

Subido en
14 de octubre de 2026
Número de páginas
17
Escrito en
2026/2027
Tipo
Examen
Contiene
Preguntas y respuestas
$13.99

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Vendido
0
Seguidores
0
Artículos
332
Última venta
-




Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes