OOPs
Outputs
Data Structures
Try Me
Vocab Time
100

These are the core tenets of OOP.

What are, Inheritance, Encapsulation, Polymorphism, and Abstraction.

100

for (int i = 12; i > 0; i--) {

System.out.print(i + ", ");

} This for loop will print out _______________.

What is 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1,

100

int n = 1000;

System.out.println("Hey - your input is: " + n);

System.out.println("Hmm.. I'm doing more stuff with: " + n);

System.out.println("And more: " + n);

The Big-O complexity for this code is ____________.

What is O(1)

100

A finally block executed when an exception is thrown from a try block that does not have a catch block.

When is a finally block is executed?

100

JDK stands for ___________________.

What is Java Development Kit?

200

Overloading is related to compile time (or static) polymorphism. This feature allows different methods to have same name, but different signatures, especially number of input parameters and type of input paramaters.

What is Overloading.

200

This for loop will execute ________ times: for(int i = 0;;i++){}

What is an infinite loop. Or infinitely counting upwards.

200

This data structure implements the LIFO paradigm.

What is Stack?

200

This is the super class for all types of errors and exceptions in java.

What is java.lang.Throwable.

200

JVM stands for ______________.

What is Java Virtual Machine?


300

Static methods can be overloaded.

What is yes.

300

How many times will this loop iterate: 

for (int i = 0; i >=65; i++) {}

What is none?

300

ArrayList, LinkedList, and Vector are all implementations of the List interface. This is most efficient for adding and removing elements from the list?

What is LinkedList.

300

This method is used to print the detailed information about the exception that occurred.

What is printStackTrace();

300

Methods that can access an Encapsulated field.

What is a getter/setter?

400

We can override static methods.

What is no. Static methods cannot be overridden because method overriding only occurs in the context of dynamic (i.e. runtime) lookup of methods. Static methods (by their name) are looked up statically (i.e. at compile-time). 

400

public class A { 

    public static void main(String[] args) 

    { 

        if (true) 

            break; 

    }  

Returns ________________.

What is an error. break can only be used in a loop or a switch.

400

Java enums are more powerful than integer constants.

What are Enums are essentially final classes with a fixed number of instances. They can implement interfaces but cannot extend another class?


400

The output is:

public class Test 

    public static void main(String[] args) 

    { 

        try

        { 

            System.out.printf("1"); 

            int data = 5 / 0; 

        } 

        catch(ArithmeticException e) 

        { 

            System.out.printf("2"); 

            System.exit(0); 

        } 

        finally

        { 

            System.out.printf("3"); 

        } 

        System.out.printf("4"); 

    } 

What is 12?

400

This refers to changing an entity of one datatype into another.

What is Typecasting.

500

This keyword is used to call immediate parent constructor in a class.

What is super();

500

public class A { 

    public static void main(String[] args) 

    { 

        int $_ = 5; 

    } 

} This outputs _____________.

What is nothing? Java variables can start with any character.

500

In binary trees, this is the algorithm for an Inorder tree traversal.

What is: 

1. Traverse the left subtree, i.e., call Inorder(left-subtree)   

2. Visit the root.   

3. Traverse the right subtree, i.e., call Inorder(right-subtree)

500


List<Integer> integers = Arrays.asList(3, 9, 7, 0, 10, 20);


integers.forEach(i -> {


    if (i == 0) {


        throw new IllegalArgumentException("Zero not allowed");


    }


    System.out.println(Math.PI / i);


});

When using a standard functional interface already provided by Java, you can only throw unchecked exceptions because standard functional interfaces do not have a “throws” clause in its method signatures?

500

This is a value that denotes the location of an object in memory (Rectangle box = new Rectangle --> box is the reference to the object)

What is a Reference.

M
e
n
u