Practice Questions with Answers + Study Guides, 4
Quizlets & 7-Day Study Planner
Purdue CNIT 155 Final Exam Study Guide (2025
Edition)
Course Focus: Introduction to Object-Oriented Programming with Java
Exam Format: Multiple Choice, Coding Output Analysis, and Short Programming Tasks
Core Topics to Study
1. Java Basics
• Syntax, structure of a Java program
• Data types (int, double, char, boolean, String)
• Variable declaration and initialization
• Comments: // (single-line), /* */ (multi-line)
Example:
java
CopyEdit
int age = 20;
double gpa = 3.75;
String name = "Boilermaker";
2. Control Structures
• if, else if, else statements
• switch statements
• Logical operators: &&, ||, !
,Example:
java
CopyEdit
if (score >= 90) {
System.out.println("A");
} else if (score >= 80) {
System.out.println("B");
}
3. Loops
• for, while, and do-while loops
• Nested loops
• Loop control: break, continue
Example:
java
CopyEdit
for (int i = 0; i < 10; i++) {
System.out.println(i);
}
4. Arrays
• One-dimensional and two-dimensional arrays
• Array declaration, initialization, traversal
Example:
java
CopyEdit
int[] nums = {1, 2, 3};
System.out.println(nums[0]); // Output: 1
5. Methods (Functions)
• Method definition and calling
• Parameters, return values
• Method overloading
Example:
java
CopyEdit
public static int add(int a, int b) {
return a + b;
}
6. Classes & Objects
• Class structure: fields, constructors, methods
, • Creating objects
• this keyword
• Access modifiers: public, private, protected
Example:
java
CopyEdit
public class Dog {
String name;
public Dog(String n) {
name = n;
}
}
7. Inheritance
• extends keyword
• super keyword
• Method overriding
• @Override annotation
Example:
java
CopyEdit
class Animal {
void makeSound() {
System.out.println("Sound");
}
}
class Dog extends Animal {
@Override
void makeSound() {
System.out.println("Bark");
}
}
8. Exception Handling
• Try/catch blocks
• finally clause
• Common exceptions: ArithmeticException, NullPointerException
Example:
java
CopyEdit
try {
int result = ;
} catch (ArithmeticException e) {
System.out.println("Cannot divide by zero!");
}
9. File I/O Basics (if covered)
, • Using Scanner and File classes
• Reading from text files
Practice Questions
1. What’s the output of this code?
java
CopyEdit
int x = 5;
while (x < 8) {
System.out.print(x);
x++;
}
2. Fix the error:
java
CopyEdit
public void printHello()
System.out.println("Hello");
3. Write a method that returns the sum of elements in an array.
Tips for the Final Exam
• Memorize syntax patterns (especially loops and conditionals).
• Practice tracing code for output.
• Know how to debug common errors (null pointers, out-of-bounds, etc.).
• Review past assignments and labs – many questions are similar!
Purdue CNIT 155 Final Exam Study Planner (7-
Day Plan)
Goal: Build confidence with Java programming concepts, reinforce logic building, and be ready for any question type.
Daily Planner Overview
Day Focus Areas Tasks
- Review Java syntax, data types, and variable rules
Day 1 Java Basics + Variables - Watch 30-min YouTube crash course
- Practice 10 variable declaration examples