• ¿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

Java Chapter 2 Review Exam Questions With Complete Solutions

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

JAVA CHAPTER 2 REVIEW EXAM QUESTIONS WITH COMPLETE SOLUTIONS

Vista previa del contenido

JAVA CHAPTER 2 REVIEW EXAM
QUESTIONS WITH COMPLETE
SOLUTIONS

What will be displayed as a result of executing the following code?
int x = 6;
String msg = "I am enjoying this class.";
String msg1 = msg.toUpperCase();
String msg2 = msg.toLowerCase();
char ltr = msg.charAt(x);
int strSize = msg.length();
System.out.println(msg);
System.out.println(msg1);
System.out.println(msg2);
System.out.println("Character at index x = " +
ltr);
System.out.println("msg has " + strSize +
"characters."); - Answer- I am enjoying this class.
I AM ENJOYING THIS CLASS.
i am enjoying this class.
Character at index x = n
msg has 25characters.

What will be displayed as a result of executing the following code?
public class test
{
public static void main(String[] args)
{
int value1 = 9;
System.out.println(value1);
int value2 = 45;
System.out.println(value2);
System.out.println(value3);
value = 16;
}
} - Answer- Nothing, there is an error

Which of the following is NOT a valid comment statement?
A) // comment 1
B) /* comment 2 */

, C) */ comment 3 /*
D) /** comment 4 */ - Answer- C) */ comment 3 /*

When saving a Java source file, save it with an extension of:
A) .javac
B) .class
C) .src
D) .java - Answer- D) .java

Every Java application program must have:
A) a class named MAIN
B) a method named main
C) comments
D) integer variables - Answer- B) a method named main

To print "Hello, world" on the monitor, use the following Java statement:
A) SystemOutPrintln("Hello, world");
B) System.out.println{"Hello, world"}
C) System.out.println("Hello, world");
D) Print "Hello, world"; - Answer- c) System.out.println("Hello, world");

To display the output on the next line, you can use the println method or use this escape
sequence
in the print method.
A) \n
B) \r
C) \t
D) \b - Answer- A) \n

This is a named storage location in the computer's memory.
A) Literal
B) Constant
C) Variable
D) Operator - Answer- C) variable

What would be displayed as a result of the following code?
int x = 578;
System.out.print("There are " +
x + 5 + "\n" +
"hens in the hen house."); - Answer- "There are 5785
hens in the hen house."

Variables are classified according to their:
A) value
B) data type
C) names

Información del documento

Subido en
12 de septiembre de 2025
Número de páginas
9
Escrito en
2025/2026
Tipo
Examen
Contiene
Preguntas y respuestas
$16.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.
wisdompoint
3.7
(20)
Vendido
120
Seguidores
66
Artículos
5730
Última venta
4 meses 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