الاثنين، 10 يونيو 2013

Java Multiple Choice Questions With Answers set-6

1. JSP embeds in ................ in ......................
A) Servlet, HTML
B) HTML, Java
C) HTML, Servlet
D) Java, HTML

2. The class at the top of exception class hierarchy is ..........................
A) ArithmeticException
B) Throwable
C) Class
D) Exception

3. In a java program, package declaration .................... import statements.
A) must precede
B) must succeed
C) may precede or succeed
D) none

4. The class string belongs to ................... package.
A) java.awt
B) java.lang
C) java.applet
D) java.string

5. ............... package is used by compiler itself. So it does not need to be imported for use.
A) java.math
B) java.awt
C) java.applet
D) java.lang

6. State true or false for the following statements in Java.
i) Java beans slow down software development process.
ii) Java Servlets do not have built in multithreading feature.
A) i-false, ii-false
B) i-false, ii-true
C) i-true, ii-false
D) i-true, ii-true

7. State whether true or false.
i) init( ) of servlet is called after a client request comes in 
ii) Servlets are ultimately converted into JSP
A) i-false, ii-false
B) i-false, ii-true
C) i-true, ii-false
D) i-true, ii-true

8. What will be the result of compiling following code.
public class MyClass{
     public static void main(String args[]){
           System.out.println("In first main()");
     }
public static void main(char args[]){
          System.out.println('a');
     }
}

A) Code will not compile and will give "Duplicate main() method declaration" error
B) Code will compile correctly but will give a runtime  exception
C) Code will compile correctly and will print "In first main()" (without quotes) when it is run
D) Code will compile correctly and will print "a" (without quotes) when it is run

9.Match the following. 
a) Java                      1) is a tool for debugging java program
b) Javah                    2) is a tool for creating C-like header files
c) Javap                    3) runs java bytecode
d) jdb                        4) prints java code representation

A) a-3, b-2,c-1
B) a-3, b-2, c-4, d-1
C) a-1, b-2, c-3, d-4
D) a-2, b-1, c-3, d-4

10.State true or false.
i) init() is called after start() in applet
ii) applets are used for networking
iii) inheritance is a part of Java Foundation Classes
iv) final does not prevent inheritance

A) i-true, ii-true, iii-false, iv-true
B) i-false, ii-false, iii-false, iv-false
C) i-true, ii-true, iii-true, iv-true
D) i-true, ii-false, iii-false, iv-false

Answers:

1.  D) Java, HTML
2.  B) Throwable
3.  A) must precede
4.  B) java.lang
5.  D) java.lang
6.  A) i-false, ii-false
7.  A) i-false, ii-false
8.  C) Code will compile correctly and will print "In first main()" (without quotes) .. run
9.  B)  a-3, b-2, c-4, d-1
10.B) i-false, ii-false, iii-false, iv-false

You Might also view the following Related Posts

ليست هناك تعليقات:

إرسال تعليق

Healthcare Systems Article Category

Medical Factors Which make it The most effective  just by Sejal Kakadiya  Medicine and health agencies with now consentrate on top quality, ...