• ¿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 8 páginas
Examen

JAVA Chapter 6 Exam Questions and Answers

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

JAVA Chapter 6 Exam Questions and Answers

Vista previa del contenido

JAVA Chapter 6 Exam Questions
and Answers

Q1: Overloaded methods always have the same _________.
a. a. method name.
b. b. return type.
c. c. number of parameters.
d. d. order of the parameters. - Answer-ANS: a. method name.

Q2: An overloaded method is one that
a. a. has a different name than another method, but the same parameters.
b. b. has the same name as another method, but different parameters (by number,
types or order of the types).
c. c. has the same name and parameters as a method defined in another class.
d. d. has the same name and parameters, but a different return type as another method.
- Answer-ANS: b. has the same name as another method, but different parameters (by
number, types or order of the types).

Q3: Which of the following methods are overloaded with respect to one another?

public int max ( int a, int b ) { ... }
public double max ( double a, double b ) { ... }
public int max ( int a, int b, int c ) { ... }
public double max ( double a, double b, double c ) { ... }

a. a. A and B are overloaded; C and D are overloaded.
b. b. A and C are overloaded; B and D are overloaded.
c. c. A, B and C are overloaded.
d. d. All these four methods are overloaded. - Answer-ANS: d. All these four methods
are overloaded.

Q4: Suppose method1 is declared as

void method1 ( int a, float b )

Which of the following methods correctly overloads method1?

a. a. void method2 ( int a, float b ).

, b. b. void method2 ( float a, int b ).
c. c. void method1 ( float a, int b ).
d. d. void method1 ( int b, float a ). - Answer-ANS: c. void method1 ( float a, int b ).

Q5: A Java class can have which of the following methods?

A. A. void foo( int a )
B. B. void foo( int a, int b )
C. C. void foo( double a )
D. D. void foo( double a, double b )
E. E. void foo( int b )

a. a. All of the above.
b. b. A, B, D, E.
c. c. A, B, C, D.
d. d. A, C, D, E. - Answer-ANS: c. A, B, C, D.

Q6: Method calls cannot be distinguished by ________.
a. a. method name.
b. b. return type.
c. c. parameter lists.
d. d. method signature. - Answer-ANS: b. return type.

Q7: In a class containing methods with the same name, the methods are distinguished
by:
a. a. Number of arguments.
b. b. Types of arguments.
c. c. Return type.
d. d. (a) and (b).
e. e. (b) and (c). - Answer-ANS: d. (a) and (b).



Q1: Information is passed to a method in:
a. a. the method name.
b. b. that method's return.
c. c. the method body.
d. d. the arguments to the method. - Answer-ANS: d. the arguments to the method.

2 Q2: Programs designed for maintainability are constructed from small simple pieces
or modules. Modules in Java are called:
a. a. methods.
b. b. classes.
c. c. arguments.
d. d. both methods and classes. - Answer-ANS: d. both methods and classes

2 Q3: A well-designed method

Información del documento

Subido en
12 de julio de 2025
Número de páginas
8
Escrito en
2024/2025
Tipo
Examen
Contiene
Preguntas y respuestas
$13.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.
Scholarsstudyguide
3.8
(169)
Vendido
853
Seguidores
476
Artículos
16410
Última venta
1 semana 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