Java SE - Basic

Print the objectives

Take the exam   Take a beta test

The Java SE - Basic exam covers what most developers having some Java experience certainly know, with no extra study effort.

Together with the OO for Java - Basic exam, it is the entry point for new users to get a yellow belt (the first belt after the initial white belt).

Concepts or APIs which are covered by this basic level are also covered by other Java SE exams. For example, we cover basic inheritance here, and more inheritance at the Java SE Core - Intermed level. Harder questions about collections can be found in the Java SE Collections exam.

Note to the question authors: if you wonder if your question is too hard for this exam, it usually is. Please put it in another exam.

The questions assume that you have the following prerequisites:
  • Use basic programming notions, as "procedures", variables, nested loops,...
  • Have a basic understanding of OO (equivalent to the OO for Java - Basic exam).
  • Use the System.out.println() method to output strings at the console.
  Released  Beta  Frozen  

Java Objects

Define and instantiate classes.
 
 

Object  1 question

From a code fragment, predict the behaviours of reference usage. Understand that a reference to an object is like a pointer, and changing the value of a reference does not affect the object it pointed to.

Use the base JavaBeans vocabulary and concepts: property, accessor/mutator, getter/setter.
By JavaBean, we mean simple POJO with getters and setters, NO EJB (Enterprise JavaBean).

NOT covered: OO oriented questions (these are for the OO exams), more advanced Javabeans techniques such as property listeners.
30 327 209

Class  2 questions

Write a basic .java file to define a class, declaring the package and the imports correctly.
Use the default constructor, or write a constructor.

NOT covered: class loading, interfaces, abstract classes.

Use the correct Java syntax for using basic inheritance.
Write a class that inherits from another class with the extends keyword.
Know that java.lang.Object is the ultimate ancestor.
Write expressions that upcast or downcast a reference (no tricks, no arrays).

NOT covered: interfaces, abstraction, overriding, super (for the next level).
19 572 112

Method and Attribute  2 questions

Define instance attributes with an initial value.

Declare valid methods with a return type (which might be void).
Return a value at the end of a method execution.
Declare and use local variables and parameters.
Identify the signature for the main method, and use it as program entry point (including its parameter).

Declare and use static methods and attributes. Given a code fragment, identify the forbidden situation where a static method calls a non-static method (or access a non static attribute) without going through an instance. Understand that static attributes are shared for all instances in the JVM.
Assign a visibility modifier (public, private, protected, default) to a method or attribute. In a code fragment, determine the validity of these modifiers basic usage (no trick).
Access attributes and methods with and without this keyword.

NOT covered: overloading, overriding, super (for the next level).
20 633 94

Language Elements

Write small Java programs.
 
 

Variables  2 questions

Declare a variable (local, parameter, attribute).
Know the default value of references, int, double, boolean, float, long, byte, short and char.
Identify cases where a default value is not assigned, and predict an error in a code fragment that uses an uninitialized variable.
Use blocks "{ }" for narrowing the scope of local variables. Differentiate the scope of attributes and local variables. Given a code fragment, detect the forbidden usage of local variables where they are not visible (outside definition block, before definition).
43 445 134

Types  1 question

Write basic code that uses the primitive types int, double, boolean, float, long, byte, short and char.

Instantiate, concatenate and compare String literals and variables. Understand that a String is not a primitive type.

Declare and use a single dimension array of primitive or objects. Use the brackets {} to initialize it.
Determine the size (amount of elements) of a given array.
22 629 57

Operators  1 question

Write expressions and predict the result of given expressions that use these operators: =, +=, ++, ==, !=, <, <=, >, >=, !, ||, &&, +, -, *, /, .equals.
25 721 67

Control Structures  2 questions

Write code with the if-else, while, for, do-while.
NOT covered: switch, continue and break, "for each" introduced in Java 5.
37 279 68

Exceptions  2 questions

Catch a checked exception with a try/catch/finally statement.
Use the printStackTrace() method.

NOT covered: throwing an exception, throws keyword, custom exceptions classes, nested exceptions, RuntimeException.
40 213 65

Misc

Miscellaneous
 
 

Vocabulary and Concepts  1 question

Define the following terms: JVM, JDK, JRE, Java SE.
Differentiate the purpose of the JDK and the JRE.
13 27 96

Garbage Collection  1 question

Differentiate the memory management of Java and other languages that do not use garbage collection.
This includes knowing that the JVM tracks unreferenced objects which are eligible for GC, and that the JVM decides when to run the GC.
Identify code situations that lead to memory leaks.
13 171 36

Naming  1 question

Identify cases where these Java language basic naming conventions are not respected:
  • keywords and packages: lower case
  • classes: CaMeL case, begin with a capital.
  • methods and variables (including static): caMeL case, begin with a lower case.
  • packages: all lowercase.
Know that any unicode character can be used to name classes, variables, attributes, methods and packages.
24 100 44

Comments and JavaDoc  1 question

Define comments inside a Java code fragment, using // and /* */.

Write basic JavaDoc comments using /**.
Navigate through the Jave SE JavaDoc to find informations.

NOT covered: JavaDoc @ tags, html syntax in JavaDoc.
15 0 67

Files and Packages  1 question

Define the purpose of .java, .class and .jar files.

Create a package and put a class in it. Put a class in the default package.
Locate a .java or .class file in the directory structure from its package name.
Import classes from other packages in a .java file.

Distinguish a class using:

  • its fully-qualified name;
  • its short name plus a specific class import;
  • its short name plus a package import (* notation).

Know the general purpose of java.lang and java.util.

22 76 48

Collections  2 questions

Write code that uses an ArrayList to store and read a list of elements, and an Iterator to iterate on it.
Import the appropriate package.
Use ArrayList core methods: .add(Object), .add(int, Object), .get(int), .set(int, Object), remove(int), remove(Object), clear(), contains(Object), size().
Obtain an iterator from an ArrayList and use its core methods: hasNext(), next().

NOT covered: the collection hierarchy (Collection, List,...), maps, Vector, sorting, Arrays class.
22 18 184

Exam information

  • 30 minutes
  • 20 questions (5837)
  • 70% required
  • +6 √
  • - 0  points
  • 1 day delay
  • status: released

Top contributors