Skip to content

Introduction to Programming in Java final exam review

The topics, worked on a live board with an AI tutor.

Units

  1. Using objects and methods

    What exams ask

    These shortcuts appear in nearly every loop and every score or average calculation, and the exam traces them to the exact value, including where a cast cuts off a decimal.

    Java programs are built from objects, and the exam constantly asks what a call such as s.substring(1, 4) returns, or how to make a random number in a range.

    • Variables, primitive types and expressions
    • Compound assignment and casting
    • Objects, methods and String

    Practice

    Write a declaration of a boolean named isOpen that holds true.Answer

    Boolean isOpen = true;

    Hint: Type, name, equals, value

    If score is 8, what is score after score *= 3; score -= 4; ?Answer

    20

    Hint: 24 first, then 20

  2. Selection and iteration

    What exams ask

    Real tests have more than one part, such as in range or not allowed, and the exam asks you to evaluate, trace and rewrite compound boolean expressions.

    Loops let a few lines process thousands of values, and tracing them by hand is a skill the exam tests in almost every multiple-choice and free-response set.

    • Boolean expressions and if statements
    • Compound conditions and De Morgan's laws
    • while and for loops
    • String algorithms and loop analysis

    Practice

    With int n = 12, what is n % 5 == 2?Answer

    True (hint: 12 divided by 5 leaves 2).

    For a = true and b = false, what is !a || b?Answer

    False (hint: !a is false and b is false).

  3. Class creation

    • Class anatomy and constructors
    • Accessors, mutators and parameters
    • Static members and ethical issues

    Practice

    Declare a private double variable called gpa.Answer

    Private double gpa;

    Hint: Private, then type, then name

    Write an accessor getName for a private String name.Answer

    Public String getName() { return name; }

    Hint: The return type is the field's type

  4. Data collections

    • Arrays
    • ArrayList
    • Searching and sorting
    • 2D arrays and recursion

    Practice

    For int[] a = new int[4], what are a.length and a[3]?Answer

    4 and 0 (hint: a new int array is filled with zeros).

    From [A, B, C], what is list after list.add(1, "X")?Answer

    [A, X, B, C] (hint: add at index shifts later elements right).

Questions

What does the Introduction to Programming in Java review cover?

Every unit of the course, 4 in all. Pick one and Helio teaches it on the board, then asks you questions. Using objects and methods; Selection and iteration; Class creation; Data collections.

Can it help the week before my final?

Yes. Pick a topic, and Helio explains it, checks you and goes over what you miss.

Is it the same as my class?

It follows the usual topics of Introduction to Programming in Java. For anything else on your syllabus, type the topic and Helio teaches that too.

How much is free?

30 minutes a month for one learner, with no card. Starter is free for 7 days with a card: cancel in time and pay nothing.

A tutor you can talk to

30 minutes every month. No card.