Escrito por estudiantes que aprobaron Inmediatamente disponible después del pago Leer en línea o como PDF ¿Documento equivocado? Cámbialo gratis 4,6 TrustPilot
logo-home
Document preview thumbnail
Vista previa 3 fuera de 29 páginas
Examen

CMSC 131 EXAM 2 QUESTIONS WITH VERIFIED ANSWERS

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

CMSC 131 EXAM 2 QUESTIONS WITH VERIFIED ANSWERS

Vista previa del contenido

CMSC 131 EXAM 2 QUESTIONS WITH VERIFIED ANSWERS




Correct 31

Incorrect 00


Your answers


1 of 31

Definition



s = c == 'y' ? "Yes" : "No";



Give this one a try later!



public class Values {
private String distance;
private double cost;
private boolean completed;


public static void main(String[] args) {
Values values = new Values();
System.out.println(values.distance);
System.out.println(values.cost);
System.out.println(values.completed);
}
}

, When we call a.doSomething(b) which value does the special value this (present
inside of the doSomething method) have?


a. It has the same value a has
b. It has the same value b has
c. It has the value null
d. None of the above.



We can call a non-static method of a class (circle all that apply):


a. Only if an object of the class has already been created.
b. From a static method of the class.
c. By using the class name (e.g., ClassName.method)
d. None of the above.




Assuming variable c is a character type variable and s is a string type variable,
rewrite the following code using a single statement and the ternary operator
so s is assigned the correct value.


if (c == 'y') {
s = "Yes";
} else {
s = "No";
}


Don't know?




2 of 31

Definition



b



Give this one a try later!

, Which of the following actually creates an object?

a. Destructor
b. Constructor
c. new operator
d. None of the above.




Circle all the areas where an object can be found.


a. Stack
b. Heap
c. Only in the first method that has been called.
d. None of the above




Would the following class compile? Yes / No


public class Misc2 {
public static void main(String[] args) {
String m;


System.out.println(m);
}
}




Which of the following actually creates an object?


a. new
b. constructor
c. private
d. None of the above.


Don't know?

Información del documento

Subido en
10 de julio de 2026
Número de páginas
29
Escrito en
2025/2026
Tipo
Examen
Contiene
Preguntas y respuestas
$12.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.
GEEKA
3.8
(361)
Vendido
2137
Seguidores
1449
Artículos
58516
Ú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