• ¿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 2 fuera de 9 páginas
Examen

CMSC 131 Object Oriented Programming I Unit Test 5 - Questions with Correct Answers (Verified Update)

Document preview thumbnail
Vista previa 2 fuera de 9 páginas

CMSC 131 Object Oriented Programming I Unit Test 5 (University of Maryland): 17 exam questions with verified correct answers and rationales, for CMSC 131 at University of Maryland. 9 pages, 2026 verified update. Sample questions covered: Which observations give valid examples of null row and row-major traversal, respectively? | Base a = new Derived(6); The final expression is Class().getSimpleName(). Derived extends Base, and both class names are as shown. What is return | int[][] a = { { 9, 10 }, { 12, 15 } }; What is the value of a[1][0]? | Which statement best characterizes two-dimensional array?

Vista previa del contenido

CMSC 131 Object-Oriented Programming I: Unit Test 5
Questions and Answers - University of Maryland

1. Which observations give valid examples of null row and row-major traversal, respectively?
A. A nested loop visits all column indices of row zero before row one. / Creating new int[4][]
allocates four reference slots without creating individual rows.
B. A value is read from the third row and second position using indices 2 and 1. / A nested loop
visits all column indices of row zero before row one.
C. Creating new int[4][] allocates four reference slots without creating individual rows. / One row
contains two entries while another contains four.
D. Creating new int[4][] allocates four reference slots without creating individual rows. / A nested
loop visits all column indices of row zero before row one.
Answer: D. Creating new int[4][] allocates four reference slots without creating individual rows. / A
nested loop visits all column indices of row zero before row one.
Rationale: When only the outer array is allocated, an unassigned row slot can be null. A row-first
nested traversal completes the selected row before advancing to the next.


2. Base a = new Derived(6); The final expression is a.getClass().getSimpleName(). Derived extends
Base, and both class names are as shown. What is returned?
A. Derived
B. ClassCastException
C. Object
D. Base
Answer: A. Derived
Rationale: getClass observes the receiver’s runtime class rather than the variable’s declared type.


3. int[][] a = { { 9, 10 }, { 12, 15 } }; What is the value of a[1][0]?
A. 12
B. 9
C. 15
D. 10
Answer: A. 12
Rationale: The first index selects the second row. The second index selects its first entry.

,4. Why can each active recursive call have a different value for the same named parameter?
A. Each recursive step moves toward a reachable base case
B. Add the current value to the sum of the remainder
C. StackOverflowError
D. Each invocation has its own frame
Answer: D. Each invocation has its own frame
Rationale: Each active method invocation has its own execution frame for parameters and local
state.


5. Which statement best characterizes two-dimensional array?
A. The selected nonnull row's length gives its individual cell count.
B. A Java two-dimensional array is an array whose elements are references to arrays.
C. The length of the outer array gives the number of row slots.
D. In grid[r][c], the first index selects a row, and the second selects a cell in that row.
Answer: B. A Java two-dimensional array is an array whose elements are references to arrays.
Rationale: A Java two-dimensional array is an array whose elements are references to arrays.
Consider this example. Storing a grid uses one outer array and a row array for each initialized row.


6. When does a statement following a recursive call normally run?
A. After that recursive call returns
B. The base case
C. Each recursive step moves toward a reachable base case
D. Each invocation has its own frame
Answer: A. After that recursive call returns
Rationale: Unwinding returns control from deeper recursive calls to their callers.

Información del documento

Subido en
20 de noviembre de 2026
Número de páginas
9
Escrito en
2026/2027
Tipo
Examen
Contiene
Preguntas y respuestas
$8.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

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
DrJon
3.8
(161)
Vendido
620
Seguidores
188
Artículos
29629
Última venta
2 días hace




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