Midterm Exam
Explanation & Learnings
The midterm covered topics from Lessons 1 to 6, which included Java history, OOP principles, program structure, data types, operators, and control flow. Topics like bitwise operators and increment/decrement behavior required more than just reading — I actually had to trace through the logic to fully get it. I thought I had a good enough grip on most of it going in, but the true or false section proved otherwise. A lot of the statements were worded in a way that made me second-guess myself.
Part 2 being multiple choice made it more manageable since at least having options to choose from helped narrow things down. I got through it without as much trouble compared to the first part.
Part 3 was coding, and since I had the syntax memorized it went relatively smooth — except for one method where I forgot to divide the variables and return the result. It was a small mistake but the kind that costs points, which was frustrating because I actually knew how to do it. Here's a short sample program that uses the Scanner syntax I memorized:
import java.util.Scanner; public class BasicScanner { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Enter ID and Score: "); int id = sc.nextInt(); // Parses integer double score = sc.nextDouble(); // Parses double System.out.println("ID: " + id + " | Score: " + score); sc.close(); } }
The part that really got me was the increment and decrement questions. I struggled with tracing through prefix and postfix in longer expressions. I think I got the first two right, but there was one question involving a and b where I put false as the output. It wasn't until I got home that I realized it was actually testing bitwise operators — and when "&" is used with booleans, it doesn't short-circuit, meaning both sides still get evaluated. To be honest, it was a fulfilling exam.