Java MCQ

 

1.     Which provides runtime environment for java byte code to be executed?

 

(A)JDK       (B)JVM      (C)    JRE   (D)JAVAC

 

2.     What is byte code in Java?

 

(A)  Code generated by a Java compiler

(B)   Code generated by a Java Virtual Machine

(C)  Name of Java source code file

(D)  Block of code written inside a class

 

 

3.     Which of the following are not Java keywords ?

 

(A) double

(B) switch

(C) then

(D) instanceof

 

 

4.     Hot Java is a ______________________.

 

(A)Application in Java

(B)JVM for Java Application

(C)Java enabled browser

(D)Later version of Java Language

 

5.     Which of the following commands will compile a Java source file “ShortProgram.java”

 

(A) java ShortProgram.html

(B) javac ShortProgram

(C) java ShortProgram

(D)javac ShortProgram.java

 

6.     Which of the following commands is not used to run a java applet?

 

(A) Appletviewer ShortProgram.html

(B) java ShortProgram

(C) appletviewer ShortProgram.java

(D)appletviewer ShortProgram.class

 

7.     The syntax of the argument passed to main method of any application in java is

 

(A) Strings args[]

(B) String args[]

(C) String args

(D)String args[]

 

8.     The zeroth element in the parameter set passed to the main method contains

 

(A) The name of the program

(B)  The number of parameters

(C)  The name of the argument

(D) A null element

 

9.     Applets do not contain main method. (True/ False)

 

(A) True

(B) False

 

10. Java applications can be run using appletviewer. (True/False)

 

(A)True

(B) False

 

11. The JVM is an interpreter that takes java files and generate byte code files. (True/False)

 

(A)True

(B) False

 

12.                        What is the stored in the object obj in following lines of Java code?

   box obj;

 

a) Memory address of allocated memory of object
b) NULL
c) Any arbitrary pointer
d) Garbage

 

13.                        Which of these keywords is used to make a class?
a) class
b) struct
c) int
d) none of the mentioned

 

 

 

 

 

 

Comments

Popular posts from this blog