WorksheetsJAVA UNIT 1 PART 2
Total questions: 15
Worksheet time: 8mins
Name
Class
Date
1.
. Java Source Code is compiled into ______________.
a)
.Obj
b)
Source Code
c)
Byte Code
d)
.Exe
2.
Which of the tool is used to compile java code ?<br />
a)
Java
b)
Javac
c)
Jar
d)
Javadoc
3.
What is the output of this program? <br />class variable_scope <br /> {<br />public static void main(String args[]) <br /> {<br /> int x;x = 5;<br /> {<br /> int y = 6;<br /> System.out.print(x + " " + y);<br /> }<br /> System.out.println(x + " " + y);<br /> } <br /> }<br /><br /><br />
a)
5 6 5 6
b)
5 6 5
c)
Runtime error
d)
Compilation error
4.
Which is a valid keyword in java?
a)
interface
b)
string
c)
unsigned
d)
Float
5.
Which one of the following will declare an array and initialize it with<br /> five numbers?
a)
Array a = new Array(5);
b)
int [] a = {23,22,21,<br />20,19};
c)
int a [] = new int[5];
d)
int [5] array;
6.
Who is known as father of Java Programming Language?
a)
James Gosling
b)
M. P Java
c)
Charel Babbage
d)
Blais Pascal
7.
Which provides runtime environment for java byte code to be executed?
a)
JDK
b)
JVM
c)
JRE
d)
JAVAC
8.
Which of the following is not OOPS concept in Java?
a)
Inheritance
b)
Encapsulation
c)
Polymorphism
d)
Compilation
9.
Which concept of Java is a way of converting real world <br />objects in terms of class?
a)
Polymorphism
b)
Encapsulation
c)
Abstraction
d)
Inheritance
10.
Which component is used to compile, debug and execute <br />java program?
a)
JVM
b)
JDK
c)
JIT
d)
JRE
11.
What is the extension of compiled java classes?
a)
.class
b)
.java
c)
.txt
d)
.js
12.
Which of the following is a valid declaration of an <br />object of class Box?
a)
Box obj = new Box();
b)
Box obj = new Box;
c)
obj = new Box();
d)
new Box obj;
13.
Which of these statement is incorrect?
a)
Every class must <br />contain a main() method
b)
Applets do not require <br />a main() method at all
c)
There can be only <br />one main() method in a program
d)
main() method must be <br />made public
14.
class main_class <br /> {<br /> public static void main(String args[])<br /> {<br /> int x = 9;<br /> if (x == 9) <br /> { <br /> int x = 8;<br /> System.out.println(x);<br /> }<br /> } <br /> }<br />
a)
9
b)
8
c)
Compilation <br />error
d)
Runtime error
15.
What is the process of defining more than one method in a class differentiated by <br />method signature?
a)
Function overriding
b)
Function overloading
c)
default argument in <br />function
d)
None of the mentioned
100 %
