Type Here to Get Search Results !

Java MCQs ( Multiple Choice Questions ) with Answers - Set III

0

 Java MCQ's  with Answers

set III


Q1. All Java classes are derived from

a) java.lang.Class

b) java.util.Name

c) java.lang.Object

d) java.awt.Window

Answer is c) java.lang.Object
Explanation :
For explanation Join the discussion below

 

Q2. What would happen if “String[]args” is not included as an argument in the main method?

a) No error

b) Compilation error

c) Program won’t run

d) Program exit

Answer is c) Program won’t run
Explanation :
For explanation Join the discussion below

 

Q3. Which of the following is not mandatory in a variable declaration?

a) a semicolon

b) an identifier

c) an assignment

d) a data type

Answer is c) an assignment
Explanation :
For explanation Join the discussion below

 

Q4. For the execution of DELETE SQL query in JDBC, _______ . method must be used.

a) executeQuery()

b) executeDeleteQuery()

c) executeUpdate()

d) executeDelete()

Answer is c) executeUpdate()
Explanation :
For explanation Join the discussion below

 

Q5. State true or false.
i) AWT is an extended version of swing
ii) Paint( ) of Applet class cannot be overridden

a) i-false, ii-false

b) i-false,ii-true

c) i-true, ii-false

d) i-true, ii-true

Answer is a) i-false, ii-false

 

Q6. Which method will a web browser call on a new applet?

a) main method

b) destroy method

c) execute method

d) init method

Answer is d) init method
Explanation :
For explanation Join the discussion below

 

Q7. Prepared Statement object in JDBC used to execute _______ queries.

a) Executable

b) Simple

c) High level

d) Parameterized

Answer is d) Parameterized
Explanation :
For explanation Join the discussion below

 

Q8. When a programming class implements an interface, it must provide behavior for

a) two methods defined in that interface

b) any methods in a class

c) only certain methods in that interface

d) all methods defined in that interface

Answer is d) all methods defined in that interface
Explanation :
For explanation Join the discussion below

 

Q9. In order to run JSP _______ is required.

a) Mail Server

b) Applet viewer

c) Java Web Server

d) Database connection

Answer is c) Java Web Server
Explanation :
For explanation Join the discussion below

 

Q10. The jdb is used to

a) Create a jar archive

b) Debug a java program

c) Create a C header file

d) Generate java documentation

Answer is b) Debug a java program
Explanation :
For explanation Join the discussion below

 

Q11. An interface with no fields or methods is known as a ______.

a) Runnable Interface

b) Marker Interface

c) Abstract Interface

d) CharSequence Interface

Answer is b) Marker Interface
Explanation :
For explanation Join the discussion below

 

Q12. Which of these classes are the direct subclasses of the Throwable class?

a) RuntimeException and Error class

b) Exception and VirtualMachineError class

c) Error and Exception class

d) IOException and VirtualMachineError class

Answer is c) Error and Exception class
Explanation :
For explanation Join the discussion below

 

Q13. In which memory a String is stored, when we create a string using new operator?

a) Stack

b) String memory

c) Heap memory

d) Random storage space

Ans is c) Heap memory
Explanation :
For explanation Join the discussion below

 

Q14. Which of the following is a reserved keyword in Java?

a) object

b) strictfp

c) system

d) main

Ans is b) strictfp
Explanation :
For explanation Join the discussion below

 

Q15. What will be the output of the following program?

public class Test2 {  
    public static void main(String[] args) {  
        StringBuffer s1 = new StringBuffer("Complete");  
        s1.setCharAt(1,'i');  
        s1.setCharAt(7,'d');  
        System.out.println(s1);  
     }  
 }  

a) Cimpletd

b) Complete

c) Iomplede

d) Coipletd

Ans is a) Cimpletd
Explanation :
For explanation Join the discussion below

 




Post a comment

0 Comments

Top Post Ad

Below Post Ad