Java/Java Multiple Choice Questions. Sample Test,Sample questions

Question:
 break statement is used to
i) get out of method ii) end a program
iii) get out of a loop iv) get out of the system

1.1 & 2

2.1,2 & 3

3.1 & 3

4.3


Question:
 In the second type, the information written in java after // is ignored by the …………………..

1.Interpreter

2.Compiler

3.Programmer

4.All of the above


Question:
 Java has its origin in

1.C programming language

2.PERRL

3.COBOL

4.Oak programming language


Question:
 Prepared Statement object in JDBC used to execute……….. queries.

1.Executable

2.Simple

3.High level

4.Parameterized


Question:
 The ………………….. looks only for a match between the value of the expression and one of its case constants.

1.if

2.match

3.switch

4.None of the above


Question:
 Which method will a web browser call on a new applet?

1.main method

2.destroy method

3.execute method

4.init method


Question:
All Java classes are derived from

1. java.lang.Class

2.java.util.Name

3.java.lang.Object

4.java.awt.Window


Question:
By using ………………. you can force immediate termination of a loop, bypassing the conditional expression and any remaining code in the body of the loop.

1.Break

2.Continue

3.Terminate

4.Loop Close


Question:
Filters were officially introduced in the Servlet ……………… specification.

1.2.1

2.2.3

3.2.2

4.2.4


Question:
For the execution of DELETE SQL query in JDBC, …………. method must be used.

1.executeQuery()

2.executeDeleteQuery()

3.executeUpdate()

4.executeDelete()


Question:
In Java variables, if first increment of the variable takes place and then the assignment occurs. This operation is also called…………………………

1.pre-increment

2.post-increment

3.incrementation

4.pre incrementation


Question:
In Java, …………. can only test for equality, whereas ………… can evaluate any type of Boolean expression.

1.switch, if

2.if, switch

3.if, break

4.continue, if


Question:
In order to run JSP ……………….. is required.

1.Mail Server

2.Applet viewer

3.Java Web Server

4.Database connection


Question:
Java programs are

1.Faster than others

2.Platform independent

3.Not reusable

4.Not scalable


Question:
Java servlets are an efficient and powerful solution for creating ………….. for the web.

D) 

1.Dynamic content

2.Static content

3.Hardware

4.Both a and b


Question:
JSP embeds in ……………. in ………………….

1.Servlet, HTML

2.HTML, Java

3.HTML, Servlet

4.Java, HTML


Question:
Native-protocol pure Java converts ……….. into the ………… used by DBMSs directly.

1.JDBC calls, network protocol

2. ODBC class, network protocol

3.ODBC class, user call

4.JDBC calls, user call


Question:
OOP features are
i) Increasing productivity ii) Reusability
iii) Decreasing maintenance cost iv) High vulnerability

1. 1,2 & 4

2.1,2 & 3

3.1, 2 & 4

4.None of the above


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

1.i-false, ii-false B)C)

2.i-false,ii-true

3.i-true, ii-false

4.i-true, ii-true


Question:
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

1.i-true, ii-true, iii-false, iv-true

2.i-false, ii-false, iii-false, iv-false

3.i-true, ii-true, iii-true, iv-true

4. i-true, ii-false, iii-false, iv-false


Question:
System.in.read() is being used, the program must specify the ……………… clause.

1.throws.java.out.IOException

2.throws.java.in.IOException

3.throws.java.io.IOException

4.throws.java.io.InException


Question:
The command javac is used to

1.debug a java program

2.compile a java program

3.interpret a java program

4. execute a java program


Question:
The compiled Java program can run on any ………………… platform having Java Virtual Machine (JVM) installed on it.
A) program
B) java
C) hardware
D) nonjava

1. program

2. java

3.hardware

4.nonjava


Question:
The jdb is used to

1.Create a jar archive

2.Debug a java program

3.Create a C header file

4.Generate java documentation


Question:
The out object is an object encapsulated inside the …………….. class and represents the standard output device.

1.standard

2.local

3.global

4.system


Question:
The third type of comment is used by a tool called ……………… for automatic generation of documentation.

1.Java commenting

2.Java generator

3.Java doc

4.Java loc


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

1.No error

2.Compilation error

3.The program won’t run

4.Program exit


Question:
When a programming class implements an interface, it must provide behavior for

1.two methods defined in that interface

2.any methods in a class

3.only certain methods in that interface

4.all methods defined in that interface


Question:
When the operators are having the same priority, they are evaluated from …………….. …………. in the order they appear in the expression.

1.right to left

2.left to right

3.any of the order

4.depends on the compiler


Question:
Which is the root class of all AWT events

1.java.awt.ActionEvent

2.java.awt.AWTEvent

3. java.awt.event.AWTEvent

4.java.awt.event.Event


Question:
Which of the following is not mandatory in a variable declaration?

1.a semicolon

2.an identifier

3.an assignment

4.a data type


Question:
Which one of the following is true for Java

1.Java is object-oriented and interpreted

2.Java is efficient and faster than C

3.Java is the choice of everyone.

4.Java is not robust.


More MCQS

  1. Java Mcq Question Set 1
  2. Java Mcq Question Set 2
  3. Java Mcq Question Set 3
  4. Java Mcq Question Set 4
  5. Java Mcq Question Set 5
  6. Java Mcq Question Set 6
  7. Java Mcq Question Set 7
  8. Java Mcq Question Set 8
  9. Java Mcq Question Set 9
  10. Java Multiple Choice Questions
  11. DATA TYPES IN JAVA
  12. Classes ,Constructor ,Methods,Inheritance
  13. Java Multiple Choice Questions.
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!