• ¿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 5 Study Guide Exam Questions With Complete Solutions

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

JAVA CHAPTER 5 STUDY GUIDE EXAM QUESTIONS WITH COMPLETE SOLUTIONS

Vista previa del contenido

JAVA CHAPTER 5 STUDY GUIDE
EXAM QUESTIONS WITH
COMPLETE SOLUTIONS

Breaking a program down into small manageable methods:
A) makes problems more easily solved
B) allows for code reuse
C) simplifies programs
D) all of the above - Answer- Answer: D

This type of method performs a task and then terminates.
A) value-returning
B) void
C) local
D) simple - Answer- Answer: B

In the following code, Integer.parseInt(str), is an example of:
int num;
string str = "555";
num = Integer.parseInt(str) + 5;
A) a value-returning method
B) a void method
C) a local variable
D) a complex method - Answer- Answer: A

Which of the following is NOT a part of the method header?
A) return type
B) method name
C) parentheses
D) semicolon - Answer- Answer: D

Which of the following is included in a method call?
A) return type
B) method modifiers
C) parentheses
D) return variable - Answer- Answer: C

You should always document a method by writing comments that appear:
A) just before the method's definition
B) just after the method's definition
C) at the end of the file

, D) only if the method is more than five lines long - Answer- Answer: A


When an argument value is passed to a method, the receiving parameter variable is:
A) declared within the body of the method
B) declared in the method header inside the parentheses
C) declared in the calling method
D) uses the declaration of the argument - Answer- Answer: B

If you attempt to use a local variable before it has been given a value:
A) a compiler error will occur
B) the local variable will always contain the value 0
C) the results will be unpredictable
D) the local variable will be ignored - Answer- Answer: A

What will be the result of the following code?
int num;
string str = "555";
num = Integer.parseInt(string str) + 5;
A) num will be set to 560.
B) str will have a value of "560".
C) The last line of code will cause an error.
D) Neither num or str will be changed. - Answer- Answer: C

Given the following method header, which of the method calls would be an error?
public void displayValues(double x, int y)
A) displayValue(a,b); // where a is a long and b is a byte
B) displayValue(a,b); // where a is an int and b is a byte
C) displayValue(a,b); // where a is a short and b is a long
D) They would all give an error. - Answer- Answer: C

Which of the following would be a valid method call for the following method?
public static void showProduct(double num1, int num2)
{
double product;
product = num1 * num2;
System.out.println("The product is " +
product);
}
A) showProduct("5", "40");
B) showProduct(10.0, 4.6);
C) showProduct(10, 4.5);
D) showProduct(3.3, 55); - Answer- Answer: D

When writing the documentation comments for a method, you can provide a description
of each

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
$17.49

¿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