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

C169 Objective Assessment Exam – Java Programming – 2026 Actual Questions & Answers (WGU)

Document preview thumbnail
Vista previa 10 fuera de 52 páginas

C169 Objective Assessment Java Programming PDF helps WGU students review actual-style questions and answers for Introduction to Programming in Java. This updated study resource is designed for quick exam prep, weak-area review, and focused practice before the OA. C169 Objective Assessment, C169 OA, WGU C169 exam, Western Governors University C169, Introduction to Programming in Java, Java programming OA, C169 Java questions, C169 actual questions, C169 answers PDF, WGU Java programming, C169 study guide, C169 exam prep, C169 practice questions, C169 updated PDF, C169 full version exam, WGU programming exam, Java OA study guide, Java exam questions, Java questions answers, buy C169 PDF, download C169 exam, C169 review guide, C169 objective assesment, C169 assesment, WGU C169 OA PDF, C169 Java OA help, programming in Java WGU, C169 test bank, WGU exam prep PDF, C169 questions answers

Vista previa del contenido

C169
Objective Assessment
(Full Version Exam)
Introduction to Programming in Java
Western Governors University

This document provides a focused OA
• This Exam is structured to help students
reinforce understanding, identify weak areas,
and prepare confidently for the assessment.

• you can review quickly and walk into exam
confident and prepared.

, Preview Pages Below

Get the Complete PDF After Purchase


"If you require further clarification or in need of any study
resources, feel free to Message me."




Thank you for viewing this preview.

,Question 1: Which Java component is responsible for actually executing
compiled bytecode on a specific machine?
A. Java Development Kit (JDK)
B. Java Runtime Environment (JRE)
C. Java Virtual Machine (JVM)
D. Java Application Programming Interface (API)
Correct Answer: C. Java Virtual Machine (JVM)
Expert Rationale: The JVM is the part of the Java platform that interprets and
executes the bytecode instructions produced by the compiler on a particular
device.


Question 2: Which statement best describes the relationship between the JDK
and the JRE?
A. The JRE includes the JDK so programs can be compiled and run.
B. The JDK includes the JRE so programs can be compiled and run.
C. The JVM includes both the JDK and the JRE.
D. The JDK and JRE are unrelated and installed separately by design.
Correct Answer: B. The JDK includes the JRE so programs can be compiled and
run.
Expert Rationale: The JDK is the full development kit that contains tools such as
the compiler and also bundles the JRE so compiled programs can be executed.


Question 3: In a Java IDE, which action most directly checks for syntax errors and
translates source code to bytecode?
A. Running the program
B. Debugging the program
C. Compiling the program
D. Formatting the program

,Correct Answer: C. private
Expert Rationale: Marking fields or methods private prevents direct access from
outside the class, supporting encapsulation as described in the guide.


Question 13: Which statement correctly calls a static method showMenu from a
class Shop?
A. Shop.showMenu();
B. new Shop.showMenu();
C. Shop shop = showMenu();
D. shop.showMenu();
Correct Answer: A. Shop.showMenu();
Expert Rationale: Static methods are invoked using the class name and dot
operator, not through an instance created with new.


Question 14: Which of the following is a valid Java array declaration that
reserves space for 5 int values?
A. int[5] nums;
B. int nums = new int[5];
C. int[] nums = new int[5];
D. array int nums[5];
Correct Answer: C. int[] nums = new int[5];
Expert Rationale: The correct syntax declares a variable of type int[] and uses new
int[5] to allocate memory, matching the array examples in the guide.


Question 15: Which method would you use to find the number of elements
currently stored in an ArrayList<String> names?
A. names.length()
B. names.size()

,B. if (s1 != s2)
C. if (s1.equals(s2))
D. if (equals(s1, s2))
Correct Answer: C. if (s1.equals(s2))
Expert Rationale: The guide emphasizes that equals compares string contents,
whereas == checks whether two references point to the same object.


Question 19: What is stored in a reference variable of type Dog when you write
Dog d = new Dog();?
A. The entire Dog object
B. The address (reference) of a Dog object in memory
C. The source code of the Dog class
D. A copy of the Dog class’s methods
Correct Answer: B. The address (reference) of a Dog object in memory
Expert Rationale: The study guide explains that object variables hold references
to objects created on the heap using the new keyword.


Question 20: Which Java loop is most naturally used when the number of
iterations is known before the loop begins?
A. while loop
B. do-while loop
C. for loop
D. Enhanced for loop
Correct Answer: C. for loop
Expert Rationale: The classic for loop is typically described as a definite loop used
when the number of repetitions is known in advance.


Question 21: Which of the following boolean expressions uses the short-circuit
AND operator?

,for (int i = 1; i <= 3; i++) {
count += i;
}
System.out.println(count);
A. 3
B. 4
C. 6
D. 7
Correct Answer: C. 6
Expert Rationale: The loop adds 1 + 2 + 3 to count, resulting in 6.


Question 30: Consider this code:
String s1 = "Java";
String s2 = "Ja" + "va";
boolean same = (s1 == s2);
System.out.println(same);
What will be printed?
A. true
B. false
C. 0
D. It throws a runtime exception
Correct Answer: A. true
Expert Rationale: Both s1 and s2 refer to the same interned string "Java" built at
compile time, so the references are identical and == yields true.


Question 31: What will this code print?

,C.
switch(day) {
case 1: case 2: case 3: case 4: case 5:
System.out.println("Weekday");
break;
case 6: case 7:
System.out.println("Weekend");
break;
}
D.
switch(day) {
default:
System.out.println("Weekday");
break;
}
Correct Answer: C.
Expert Rationale: Option C groups the case labels correctly and uses break to
prevent fall-through, producing exactly one line of output for each value.


Question 37: What is printed by the following code?
int a = 5;
int b = 10;
int result = 0;

,int sum = 0;
for (int v : vals) {
sum += v;
}
System.out.println(sum);
A. 8
B. 10
C. 18
D. 20
Correct Answer: D. 20
Expert Rationale: The enhanced for loop iterates through each element, adding 2
+ 4 + 6 + 8 = 20.


Question 52: Consider the method:
public void addItem(ArrayList<String> list, String item) {
list.add(item);
}
and the code:
ArrayList<String> groceries = new ArrayList<>();
addItem(groceries, "Milk");
System.out.println(groceries.size());
What will be printed?
A. 0
B. 1
C. 2
D. It causes a compile-time error

, System.out.print(v + " ");
}
A. 1 2 3 4
B. 2 3 4 5
C. 2 3 4
D. A runtime error occurs
Correct Answer: B. 2 3 4 5
Expert Rationale: The first loop increments each element, so the array becomes
{2,3,4,5}, which the enhanced loop then prints.


Question 62: Consider the following code fragment:
String a = "win";
String b = new String("win");
boolean x = (a == b);
boolean y = a.equals(b);
System.out.println(x + " " + y);
What output is produced?
A. true true
B. false false
C. true false
D. false true
Correct Answer: D. false true
Expert Rationale: a and b reference different objects, so == is false, but they
contain the same characters, so equals returns true.


Question 63: What is printed by this code?

, Question 73: What happens when this code executes?
String[] words = new String[2];
words[0] = "Hi";
System.out.println(words[1].length());
A. It prints 0.
B. It prints the length of an empty string.
C. It throws a NullPointerException.
D. It throws an ArrayIndexOutOfBoundsException.
Correct Answer: C. It throws a NullPointerException.
Expert Rationale: words[1] is still null by default; calling length() on a null
reference triggers a NullPointerException.


Question 74: What is printed by the following code?
int x = 5;
if (x > 0 && x < 10) {
System.out.println("Range");
}
if (x < 0 || x > 10) {
System.out.println("Out");
} else {
System.out.println("Check");
}
A. Range
B. Range followed by Check

Información del documento

Subido en
25 de julio de 2026
Número de páginas
52
Escrito en
2025/2026
Tipo
Examen
Contiene
Preguntas y respuestas
$14.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.
LectJoshua
4.0
(1681)
Vendido
9267
Seguidores
5514
Artículos
7851
Última venta
1 hora 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