Java Mock Test II PDF
Java Mock Test II PDF
This section presents you various set of Mock Tests related to Java Framework. You can download
these sample mock tests at your local machine and solve offline at your convenience. Every mock
test is supplied with a mock test key to let you verify the final score and grade yourself.
A-0
B - 0.0
C - 0L
D - not defined
A - 0.0d
B - 0.0f
C-0
D - not defined
A - 0.0d
B - 0.0f
C-0
D - not defined
A - '\u0000'
B-0
C - null
D - not defined
B - ''
C - null
D - not defined
A - undefined
B-0
C - null
D - not defined
A - true
B - false
C - null
D - not defined
A - Variables, methods and constructors which are declared public can be accessed by any class.
B - Variables, methods and constructors which are declared public can be accessed by any class
lying in same package.
C - Variables, methods and constructors which are declared public in the superclass can be
accessed only by its child class.
A - Variables, methods and constructors which are declared protected can be accessed by any
class.
B - Variables, methods and constructors which are declared protected can be accessed by any
class lying in same package.
C - Variables, methods and constructors which are declared protected in the superclass can be
accessed only by its child class.
A - Variables, methods and constructors which are declared private can be accessed only by the
members of the same class.
B - Variables, methods and constructors which are declared private can be accessed by any class
lying in same package.
C - Variables, methods and constructors which are declared private in the superclass can be
accessed only by its child class.
A - Variables, methods and constructors which are declared private can be accessed only by the
members of the super class.
B - Variables, methods and constructors which are declared protected can be accessed by any
subclass of the super class.
C - Variables, methods and constructors which are declared public in the superclass can be
accessed by any class.
Q 12 - Which of the following stands true about default modifier of class members?
B - By default, variables, methods and constructors can be accessed by any class lying in any
package.
C - By default, variables, methods and constructors can be accessed by any class lying in the
same package.
A - String is immutable.
A - String is mutable.
B - String is immutable.
Q 16 - What is inheritance?
Q 17 - What is Abstraction?
Q 18 - What is Encapsulation?
C - Encapsulation is the technique of making the fields in a class private and providing access to
the fields via public methods.
Q 19 - What is an Interface?
A - Variables defined inside methods, constructors or blocks are called local variables.
B - Variables defined outside methods, constructors or blocks are called local variables.
C - Static variables defined outside methods, constructors or blocks are called local variables.
A - Instance variables are static variables within a class but outside any method.
C - Instance variables are variables within a class but outside any method.
A - class variables are static variables within a class but outside any method.
C - class variables are variables within a class but outside any method.
A - True
B - False
Q 25 - Inheritance represents
A - HAS-A relationship.
B - IS-A relationship.
ANSWER SHEET
1 C
2 B
3 A
4 A
5 C
6 C
7 B
8 A
9 C
10 A
11 D
12 C
13 C
14 A
15 B
16 A
17 C
18 C
19 C
20 B
21 A
22 C
23 A
24 B
25 B