0% found this document useful (0 votes)
2 views

OOD Trivia

Uploaded by

Siddharth Joshi
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

OOD Trivia

Uploaded by

Siddharth Joshi
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 61

OOD Trivia

A _____ is a template
from which objects can be
instantiated
A ______ is a routine defined
within a class to implement a
behaviour
An _____ class cannot
be instantiated
Java does not allow for
_____ inheritance
All classes in Java
implicitly extends the
_____ class
Objects contain both
_____ and _____
_____ methods belong
to the class
_____ loops will
execute at least once
Java best practices dictates
the use of _____ notation for
variables and method names
What can Java
bytecode run on?
What does JVM stand for
and what does it do?
Name a Java IDE
other than Eclipse
What is the yellow and red
underlining in Eclipse and
why do we get them?
What are the access
modifiers in Java?
What can the final
keyword be applied to?
What is the syntax for the
logical operator AND in
Java?
What is the output of the following?

final String[] arr = {“Apr”, “May”, “Jun”,


“Jul”};
arr[3] = “Julie”;
for (String s : arr) {
System.out.println(s);
}
What is the output of the following ?

int n = 3;
switch(n) {
case 1:
System.out.println(“abcd”);
break;
case 2:
System.out.println(“efg”);
case 3:
System.out.println(“hijk”);
default:
System.out.println(“xyz”);
}
What is the output of the following?

for (int i = 0; i < 10; i++) {


i *= i;
System.out.println(i);
}
List all the primitive
types in Java
How do we instantiate
objects in Java?
Array indexes start at
what value?
What is the output of the following?

String str1 = new String(“Hello”);


String str2 = new String(“Hello”);
System.out.println(str1 == str2);
How can we differentiate a
constructor from a normal
method?
What is the default
constructor?
What must be the first
line inside every
constructor?
What is the syntax for taking
in a variable number of
arguments to a method?
What are the differences
between an abstract class and
a concrete class?
Attributes within an
interface are implicitly
what?
What is the keyword used
for inheritance between
interfaces?
What are the key interfaces
that extends the Collection
interface?
What is the difference
between ordered and
sorted?
Name an implementing class
within the Collections
Framework that is ordered,
sorted, and does not allow for
duplicates
Name an implementing class
within the Collections Framework
that is ordered, unsorted, and does
allow for duplicates
What are the two interfaces
that Java provides for
comparisons?
Name one benefit
of generics
We put our
dependencies into the
______________
What do SOLID
stand for?
What are the 4
pillars of OOD?
What is the library that Java
uses for testing?
What are the 3 A’s
of testing?
What are the 5
steps to TDD?
Why do we need
Mockito on top of
Junit?
How do we initialize
our mock objects?
Give the syntax for verifying that the
method “myMethod” belonging to the
object “mockedObject” has not been
called with no arguments
How many stacks does
a Java application
have?
Java is a pass by _____
language
Objects are stored in
which part of
memory?
Protected fields and
methods are denoted by
what in a class
diagram?
How many design patterns did
the Gang of Four describe in
their book “Design Patterns –
Elements of Reusable Object-
Oriented Software”?
Give one major
benefit of
javadocs
What does JSON
stand for?
Converting Java
objects into JSON
objects is called what?
Give one easy way to tell
whether an exception is a
runtime exception or not
What is the difference
between an error and
an exception?
What are the two ways
to handle checked
exceptions?
What is the time
complexity of
performing a binary
search?
This big O notation is
often called the naïve
approach. What is it?
What is the time complexity of the
following code snippet:

for (int i = 0; i < arr.length; i++) {


counter += counter;
}
for (int i = 0; i < arr.length; i++) {
arr[i] += counter;
}
Name and explain
one common hazard
of multi-threading

You might also like