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

Java Programming Fundamentals and OOP — Exam Questions and Answers

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

Comprehensive exam Q&A for Java Programming and Object-Oriented Programming courses. Covers 30 multiple-choice and short-answer questions with clear, verified answers and explanations. Topics covered: - Java syntax rules, identifiers, and operators - Default values, data types, and type casting - Constructors, this keyword, and method overloading - Conditionals, loops, and short-circuit evaluation - ArrayList methods and index-based operations - String comparison (== vs .equals()) - Exception types: ArrayIndexOutOfBoundsException, NullPointerException - The four OOP pillars: encapsulation, abstraction, inheritance, polymorphism - Method overriding vs overloading - instanceof operator and dynamic binding - Static vs instance methods Includes tricky exam questions where correct answer explanations help you avoid common Java pitfalls.

Vista previa del contenido

Java Programming
Fundamentals, OOP & Collections

CS202 — Object-Oriented Programming | Undergraduate CS
Questions & Verified Answers

, Java Programming — Fundamentals & OOP
30 questions covering Java syntax, operators, OOP principles, ArrayList, exceptions, constructors, and
best practices.


Q1. Which statement about Java constructors is incorrect?
A. Constructors must have the same name as the class
B. Constructors do not have a return type
C. Constructors can be overloaded
D. A class can have only one constructor
E. A constructor may be static
Answer: E. A constructor may be static.
Constructors in Java cannot be declared static. They are instance-specific.
Option D is also incorrect (a class CAN have multiple constructors via overloading),
but E describes a property that is fundamentally impossible — constructors cannot be static.

Q2. What is the output of: System.out.println(5 + "5");
A. 10
B. 55
C. 5+5
D. Compile error
Answer: B. 55
When + is used with a String operand, Java performs string concatenation.
The integer 5 is converted to "5", then concatenated with "5" to produce "55".

Q3. What is the default value of a boolean instance variable in Java?
A. true
B. false
C. null
D. 0
Answer: B. false
Java default values for instance fields: boolean=false, int=0, double=0.0, Object=null.
Local variables do NOT have default values — they must be initialized before use.
Q4. What is the result of 24 % 5?
A. 4.8
B. 4
C. 5
D. 1
Answer: B. 4
% returns the remainder of integer division. 24 ÷ 5 = 4 remainder 4.
For negative numbers: -24 % 5 = -4 (sign follows the dividend in Java).
Q5. What does new ArrayList<>(2) create?
A. A list with 2 elements

Información del documento

Subido en
13 de mayo de 2026
Número de páginas
7
Escrito en
2025/2026
Tipo
Examen
Contiene
Preguntas y respuestas
$15.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

Vendido
1
Seguidores
0
Artículos
38
Última venta
2 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