QUIZZES AND COMPLETE RESOLVED
ANSWERS
True - answer ✔✔-T / F
The finally block of a try/catch structure will execute if no exception occurs in the try block.
True - answer ✔✔-T / F
In a Binary Search Tree, all elements to one side of a node are < that node's value, and all elements to
the other side are > that node's value.
True - answer ✔✔-T / F
A method that may throw a checked exception must either catch that exception or declare that it
throws an exception in its header.
True - answer ✔✔-T / F
A class from which you can create objects is called a concrete class.
True - answer ✔✔-T / F
All methods in a Java interface must be abstract.
True - answer ✔✔-T / F
If you declare a parameterized constructor in your class, the compiler will not create a default
constructor for you.
39 - answer ✔✔-Evaluate the code to determine the output.
,MyStack<Integer> s = new MyStack<Integer>();
s.push(23); s.push(26); s.push(13);
System.out.println(s.pop() + s.pop() );
16 - answer ✔✔-Evaluate the following code to determine what value will be at the bottom of the stack
after the code completes.
MyStack<Integer> s = new MyStack<Integer>();
s.push(16); s.push(65); s.push(90);
22 - answer ✔✔-Evaluate the following code to determine the output.
MyQueue<Integer> q = new MyQueue<Integer>();
q.add(22); q.add(65); q.add(73);
System.out.println(q.remove());
38 - answer ✔✔-Evaluate the following code to determine what value will be at the front of the queue
after the code completes.
MyQueue<Integer> q = new MyQueue<Integer>();
q.add(38); q.add(42); q.add(83);
True - answer ✔✔-T / F
Encapsulation is about assigning responsibilities to objects.
Composition - answer ✔✔-Which object oriented relationship is used to define a "has a" relationship?
Polymorphism
, Data Hiding
Composition
Inheritance
Message Parsing
Encapsulation
Getters and Setters - answer ✔✔-Methods used to access an object's private data are called ______ .
True - answer ✔✔-T / F
The benefit of data hiding is that we can make an object truly responsible for what it knows and what it
does.
new - answer ✔✔-Which keyword is used in Java to create an object?
True - answer ✔✔-T / F
A Stack is a Last In First Out (LIFO) data structure.
True - answer ✔✔-T / F
Stacks and Queues can be implemented as ArrayLists or LinkedLists.
True - answer ✔✔-T / F
Any iterative algorithm can be written recursively.
True - answer ✔✔-T / F
The "super" keyword is used in the subclass constructor to call a specific super class constructor.
True - answer ✔✔-T / F
A sub-class may inherit methods and instance variables from its super class, and may also implement its
own methods and declare its own instance variables.