Java
Quiz
There are 23 questions in this quiz. Good luck!
Passing grade is 70% = C.
Passing grade is 70% = C.
1) What is the size of a Char?
|
a)
![]() |
b)
![]() |
c)
![]() |
d)
![]() |
|
2) A class cannot be declared:
|
a)
![]() |
b)
![]() |
c)
![]() |
|
3) Following code will result in: int a =
3.5;
|
a)
![]() |
b)
![]() |
c)
![]() |
d)
![]() |
|
4) Following code will result in: int a1 =
5; double a2 = (float)a1;
|
a)
![]() |
b)
![]() |
c)
![]() |
|
5) Following code will result in: int a =
9/0;
|
a)
![]() |
b)
![]() |
c)
![]() |
d)
![]() |
|
6) Following code will result in: float a =
9/0;
|
a)
![]() |
b)
![]() |
c)
![]() |
d)
![]() |
|
7) A class can be transient
|
a)
![]() |
b)
![]() |
|
8) Following code will result in: class A {
int b = 1; public static void main(String [] args) {
System.out.println("b is " + b); }}
|
a)
![]() |
b)
![]() |
c)
![]() |
d)
![]() |
|
9) Following code will result in: class A {
public static void main(String [] args) {B b = new A(); }} class B extends A
{}
|
a)
![]() |
b)
![]() |
c)
![]() |
|
10) Following code will result in: class A {
public static void main(String [] args) {A a = new B(); }} class B extends A
{}
|
a)
![]() |
b)
![]() |
c)
![]() |
|
11) Methods that are marked protected can be
called in any subclass of that class.
|
a)
![]() |
b)
![]() |
|
12) An abstract class can have non-abstract
methods.
|
a)
![]() |
b)
![]() |
|
13) Java keywords are written in lowercase
as well as uppercase.
|
a)
![]() |
b)
![]() |
|
14) What is an instanceof
|
a)
![]() |
b)
![]() |
|
15) Primitive datatypes are allocated on a
stack.
|
a)
![]() |
b)
![]() |
|
16) Can you compare a boolean to an integer?
|
a)
![]() |
b)
![]() |
|
17) If class A implements an interface does
it need to implement all methods of that interface?
|
a)
![]() |
b)
![]() |
|
18) Integer a = new Integer(2); Integer b =
new Integer(2); What happens when you do if (a==b)?
|
a)
![]() |
b)
![]() |
c)
![]() |
d)
![]() |
|
19) The methods wait(), notify() and
notifyAll() in Object need to be called from synchronized pieces of code.
|
a)
![]() |
b)
![]() |
|
20) Inner classes can be defined within
methods.
|
a)
![]() |
b)
![]() |
|
21) Synchronized is a keyword to tell a
Thread to grab an Object lock before continuing execution.
|
a)
![]() |
b)
![]() |
|
22) The default statement of a switch is
always executed.
|
a)
![]() |
b)
![]() |
|
23) How can you prevent a member variable
from becoming serialized?
|
a)
![]() |
b)
![]() |
c)
![]() |
d)
![]() |
|
No comments:
Post a Comment