• Verkeerd document? Gratis ruilen
  • Geschreven door studenten die geslaagd zijn
  • Direct beschikbaar na je betaling
  • Online lezen of als PDF
Verkopen
Kies je studieland
Kies je taal
Document preview thumbnail
Voorbeeld 2 van de 5 pagina's
Tentamen (uitwerkingen)

Oca Exam Practice Questions And Answers 2026/2027

Document preview thumbnail
Voorbeeld 2 van de 5 pagina's

This document contains OCA exam practice questions and answers designed to support preparation for the 2026/2027 examination period. It provides exam-style questions with answers to help students review key concepts, test their knowledge, and identify areas that need further study.

Voorbeeld van de inhoud

OCA EXAM PRACTICE QUESTIONS AND
ANSWERS 2026/2027
Can you have static classes in Java? - ANSWER-Yes and no. You cannot have top-
level static classes, but you may have nested static classes (these are mainly used in
defining one-off, utility and/or library classes where instantiation would not make sense).
You can basically declare the class final to mimic static class behavior since you
wouldn't want to extend a static class in the first place.

ArithmeticException - ANSWER-Thrown by the JVM when code attempts to divide by
zero (Runtime Exception)

ArrayIndexOutOfBoundsException - ANSWER-Thrown by the JVM when code uses an
illegal index to access an array (Runtime Exception)

ClassCastException - ANSWER-Thrown by the JVM when an attempt is made to cast
an exception to a subclass of which it is not an instance (Runtime Exception)

IllegalArgumentException - ANSWER-Thrown by the programmer to indicate that a
method has been passed an illegal or inappropriate argument (Runtime Exception)

NullPointerException - ANSWER-Thrown by the JVM when there is a null reference
where an object is required (Runtime Exception)

NumberFormatException - ANSWER-Thrown by the programmer when an attempt is
made to convert a string to a numeric type but the string doesn't have an appropriate
format (Runtime Exception)

protected void finalize() - ANSWER-called by the garbage collector on an object when
garbage collection determines that there are no more references to the object (subclass
overrides the finalize method to dispose of system resources or to perform other
cleanup)

Method overloading - ANSWER-multiple methods with the same name but with a
different signature (keep in mind "public void buzz() { }" "buzz()" is the signature)

return type and all that other stuff can be different no problem

Calling this() in Java - ANSWER-this() must be the first line of a constructor if present

Variables declared inside an interface are? - ANSWER-Implicitly public static final (keep
in mind this is why the naming conventions will be like "LEFT_MOTOR")

, Functional Interfaces and lambda expressions - ANSWER-Interface must contain ONE
abstract method, lambda expressions here may be used to represent the instance of a
functional interface

Keep in mind lambda syntax!
Also, note that there must be the same number of arguments, as well as the type of
arguments that they specify. You don't need to specify types, but if you specify one, you
must specify the other. (aka (a,b) is good, but (String a, b) is NOT)

Switch statements - ANSWER-The value of the 'expression' in a switch-case statement
must be an integer, char, short, long. Float and double are not allowed.

StringBuilder s1 = new StringBuilder("meow");
if (s1.toString() == "meow") System.out.println("four"); - ANSWER-FALSE. While both of
them evaluate to "meow", they do not both point to the "meow" in the string pool.

What is the output when new Hippopotamus() is called?
1: class Mammal {
2: public Mammal(int age) { System.out.println("1"); }
3: }
4: public class Hippopotamus extends Mammal {
5: public Hippopotamus() { System.out.println("2"); }
6: } - ANSWER-THIS CODE WILL FAIL.
Keep in mind subclasses will make a call to the superclass if no explicit call is made to
the parent constructor. Therefore, super() will be run but there is nothing to receive it,
since public Mammal(int age) exists and a default constructor is not created.

Which of the following statements can be inserted in the blank so that the code will
compile successfully? - ANSWER-There have been a few of these trick questions, to be
honest. In this case, it doesn't seem like they want what would make sense from a
programmer's point of view, but literally as the question says, whatever would fool the
compiler.

Method overriding (subclasses) - ANSWER-Cannot be more restrictive than original
(private -> protected is fine, but not vice versa)

return types must be same or a subclass of original return type AND must have the
same parameters (different parameters is overloading!)

Can you pass a null reference? - ANSWER-A null value can always be passed as a
reference. Although this will compile without issue, it will produce a
NullPointerException at runtime. (LOOK AT QUESTION WORDING AND LOOK AT
WHAT THEY'RE ASKING FOR)

Can you make a method private and abstract? - ANSWER-No, there would be literally
no point to this method, as no class would be able to implement it.

Documentinformatie

Geüpload op
16 september 2026
Aantal pagina's
5
Geschreven in
2026/2027
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden
$14.49

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kan je een ander document kiezen. Je kan het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
ExpertEducators
3.7
(11)
Verkocht
78
Volgers
1
Items
3180
Laatst verkocht
2 weken geleden




Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via Bancontact, iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo eenvoudig kan het zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen