NEW
Font size
S
M
L
XL
WorksheetsTest 4
Total questions: 50
Worksheet time: 17mins
Name
Class
Date
1.
Which keyword is used to define a class in Java?
a)
class
b)
def
c)
struct
d)
ClassDef
2.
Which method is the entry point of any Java program?
a)
start()
b)
main()
c)
execute()
d)
init()
3.
Java was developed by?
a)
Microsoft
b)
Sun Microsystems
c)
Google
d)
IBM
4.
Which extension is used for Java source files?
a)
.jav
b)
.java
c)
.js
d)
.class
5.
Which JVM converts bytecode into machine code?
a)
Interpreter
b)
JIT Compiler
c)
Assembler
d)
Loader
6.
Which of these is a primitive data type in Java?
a)
String
b)
Integer
c)
int
d)
Scanner
7.
Default value of boolean variable?
a)
true
b)
false
c)
0
d)
null
8.
Which keyword is used for defining constants?
a)
const
b)
final
c)
static
d)
constant
9.
Which data type is used for single characters?
a)
String
b)
char
c)
int
d)
boolean
10.
Range of byte in Java?
a)
-128 to 127
b)
0 to 255
c)
-256 to 255
d)
-127 to 128
11.
Which keyword is used for decision making?
a)
for
b)
if
c)
loop
d)
break
12.
Which loop runs at least once?
a)
for
b)
while
c)
do-while
d)
if
13.
Which statement is used to exit a loop?
a)
stop
b)
return
c)
exit
d)
break
14.
Which statement is used to skip current iteration?
a)
skip
b)
continue
c)
break
d)
pass
15.
Which statement is used for multiple conditions?
a)
if
b)
if-else
c)
switch
d)
goto
16.
What is a class in Java?
a)
A variable
b)
A method
c)
A blueprint of objects
d)
An object
17.
What is an object in Java?
a)
A variable
b)
An instance of a class
c)
A method
d)
A loop
18.
Which operator is used to create an object in Java?
a)
new
b)
create
c)
alloc
d)
malloc
19.
Which is correct object creation?
a)
Student s = Student();
b)
Student s = new Student;
c)
Student s = new Student();
d)
Student s();
20.
Can we create multiple objects of a class?
a)
Yes
b)
No
c)
Only one
d)
Depends
21.
What is a constructor?
a)
A method
b)
A variable
c)
A block to initialize objects
d)
A loop
22.
Constructor name must be?
a)
Same as class
b)
Different from class
c)
Any name
d)
Keyword name
23.
Which constructor takes no parameters?
a)
Parameterized
b)
Default
c)
Static
d)
Final
24.
Can constructors be overloaded?
a)
Yes
b)
No
c)
Only default
d)
Only parameterized
25.
Which keyword calls parent constructor?
a)
this
b)
super
c)
parent
d)
base
26.
Which memory area stores objects?
a)
Stack
b)
Heap
c)
Register
d)
Static
27.
Which operator allocates memory for objects?
a)
malloc
b)
alloc
c)
new
d)
create
28.
Which method is called when object is created?
a)
main
b)
init
c)
constructor
d)
start
29.
Can objects be referenced by multiple variables?
a)
Yes
b)
No
c)
Only one
d)
Not sure
30.
Can we assign one object reference to another?
a)
Yes
b)
No
c)
Only with cast
d)
Not possible
31.
Which keyword defines static members?
a)
final
b)
static
c)
const
d)
global
32.
Static variables are shared by?
a)
One object
b)
All objects
c)
Only main
d)
None
33.
Static methods can access?
a)
Only static variables
b)
Only instance variables
c)
Both
d)
None
34.
Static blocks execute when?
a)
Object created
b)
Class loaded
c)
Program ends
d)
Never
35.
Can static methods be overloaded?
a)
Yes
b)
No
c)
Only constructors
d)
Not sure
36.
Which keyword is used for inheritance?
a)
extends
b)
implements
c)
inherit
d)
base
37.
Which keyword is used for interfaces?
a)
extends
b)
implements
c)
interface
d)
abstract
38.
Which method is redefined in child class?
a)
Overloaded
b)
Overridden
c)
Static
d)
Private
39.
Can a class inherit multiple classes?
a)
Yes
b)
No
c)
Sometimes
d)
Only abstract
40.
Which class is parent of all classes in Java?
a)
Object
b)
Main
c)
Parent
d)
Base
41.
Can constructors be inherited?
a)
Yes
b)
No
c)
Partially
d)
Not sure
42.
Which keyword refers to current object?
a)
this
b)
super
c)
self
d)
object
43.
Which keyword refers to parent object?
a)
parent
b)
base
c)
super
d)
this
44.
What is method overloading?
a)
Same method, different parameters
b)
Same method, same parameters
c)
Different methods
d)
None
45.
What is method overriding?
a)
Same method in parent and child
b)
Different method names
c)
Changing return type only
d)
None
46.
Which keyword prevents inheritance?
a)
final
b)
static
c)
abstract
d)
private
47.
Which methods must be overridden?
a)
private
b)
static
c)
abstract
d)
final
48.
What is dynamic polymorphism?
a)
Method overloading
b)
Method overriding
c)
Constructor chaining
d)
Static methods
49.
What is encapsulation?
a)
Binding data & methods together
b)
Inheritance
c)
Polymorphism
d)
Abstraction
50.
Which keyword is used for abstraction?
a)
abstract
b)
final
c)
static
d)
extends
Reset
