Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 10 out of 52 pages
Exam (elaborations)

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

Document preview thumbnail
Preview 10 out of 52 pages

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

Content preview

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

Document information

Uploaded on
July 25, 2026
Number of pages
52
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$14.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
LectJoshua
4.0
(1680)
Sold
9267
Followers
5514
Items
7851
Last sold
14 hours ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions