WorksheetsOCA Test I
Total questions: 10
Worksheet time: 10mins
Which of the following are true? (Choose all that apply)
javac compiles a .class file into a .java file.
javac compiles a .java file into a .bytecode file.
javac compiles a .java file into a .class file.
Java takes the name of the class as a parameter.
Java takes the name of the .bytecode file as a parameter.
Which of the following are true statements? (Choose all that apply)
Java allows operator overloading.
Java code compiled on Windows can run on Linux.
Java has pointers to specific locations in memory.
Java is a procedural language.
Java is an object-oriented language
0
4
Compilation fails on line 3
Compilation fails on line 4
Compilation fails on line 8
Which represent the order in which the following statements can be assembled into a program
that will compile successfully? (Choose all that apply)
A: class Rabbit {}
B: import java.util.*;
C: package animals;
A, B, C
B, C, A
C, B, A
B, A
C, A
Bunny is a class
bun is a class
main is a class
Bunny is a reference to an object
bun is a reference to an object
int amount = 9L;
int amount = 0b101;
int amount = 0xE;
double amount = 0xE;
double amount = 1_2_.0_0;
Which of the following lines of code compile? (Choose all that apply)
int i1 = 1_234;
double d1 = 1_234_.0;
double d2 = 1_234._0;
double d3 = 1_234.0_;
double d4 = 1_234.0;
Which of the following are true? (Choose all that apply)
An instance variable of type boolean defaults to false.
An instance variable of type boolean defaults to true.
An instance variable of type boolean defaults to null.
An instance variable of type int defaults to 0.
An instance variable of type int defaults to 0.0.
Which of the following are true? (Choose all that apply)
A local variable of type boolean defaults to null.
A local variable of type float defaults to 0.
A local variable of type Object defaults to null.
A local variable of type boolean defaults to false.
None of the above.
Which of the following method signatures is a valid declaration of an entry point in a
Java application?
public void main(String[] args)
public static void main()
private static void start(String[] mydata)
public static final void main(String[] mydata)
None of the above
