Home
MCQS
Java MCQ Quiz Hub
Java Multiple Choice Questions.
Choose a topic to test your knowledge and improve your Java skills
1. Java programs are
Faster than others
Platform independent
Not reusable
Not scalable
2. Java has its origin in
C programming language
PERRL
COBOL
Oak programming language
3. Which one of the following is true for Java
Java is object-oriented and interpreted
Java is efficient and faster than C
Java is the choice of everyone.
Java is not robust.
4. The command javac is used to
debug a java program
compile a java program
interpret a java program
execute a java program
5. Java servlets are an efficient and powerful solution for creating ………….. for the web. D)
Dynamic content
Static content
Hardware
Both a and b
6. Filters were officially introduced in the Servlet ……………… specification.
2.1
2.3
2.2
2.4
7. Which is the root class of all AWT events
java.awt.ActionEvent
java.awt.AWTEvent
java.awt.event.AWTEvent
java.awt.event.Event
8. OOP features are i) Increasing productivity ii) Reusability iii) Decreasing maintenance cost iv) High vulnerability
1,2 & 4
1,2 & 3
1, 2 & 4
None of the above
9. 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 & 2
1,2 & 3
1 & 3
3
10. Native-protocol pure Java converts ……….. into the ………… used by DBMSs directly.
JDBC calls, network protocol
ODBC class, network protocol
ODBC class, user call
JDBC calls, user call
11. All Java classes are derived from
java.lang.Class
java.util.Name
java.lang.Object
java.awt.Window
12. The jdb is used to
Create a jar archive
Debug a java program
Create a C header file
Generate java documentation
13. What would happen if “String[]args” is not included as an argument in the main method?
No error
Compilation error
The program won’t run
Program exit
14. For the execution of DELETE SQL query in JDBC, …………. method must be used.
executeQuery()
executeDeleteQuery()
executeUpdate()
executeDelete()
15. Which method will a web browser call on a new applet?
main method
destroy method
execute method
init method
16. Which of the following is not mandatory in a variable declaration?
a semicolon
an identifier
an assignment
a data type
17. When a programming class implements an interface, it must provide behavior for
two methods defined in that interface
any methods in a class
only certain methods in that interface
all methods defined in that interface
18. In order to run JSP ……………….. is required.
Mail Server
Applet viewer
Java Web Server
Database connection
19. State true or false. i) AWT is an extended version of swing ii) Paint( ) of Applet class cannot be overridden
i-false, ii-false B)C)
i-false,ii-true
i-true, ii-false
i-true, ii-true
20. Prepared Statement object in JDBC used to execute……….. queries.
Executable
Simple
High level
Parameterized
21. In Java variables, if first increment of the variable takes place and then the assignment occurs. This operation is also called…………………………
pre-increment
post-increment
incrementation
pre incrementation
22. When the operators are having the same priority, they are evaluated from …………….. …………. in the order they appear in the expression.
right to left
left to right
any of the order
depends on the compiler
23. In Java, …………. can only test for equality, whereas ………… can evaluate any type of Boolean expression.
switch, if
if, switch
if, break
continue, if
24. The ………………….. looks only for a match between the value of the expression and one of its case constants.
if
match
switch
None of the above
25. System.in.read() is being used, the program must specify the ……………… clause.
throws.java.out.IOException
throws.java.in.IOException
throws.java.io.IOException
throws.java.io.InException
26. By using ………………. you can force immediate termination of a loop, bypassing the conditional expression and any remaining code in the body of the loop.
Break
Continue
Terminate
Loop Close
27. The out object is an object encapsulated inside the …………….. class and represents the standard output device.
standard
local
global
system
28. The third type of comment is used by a tool called ……………… for automatic generation of documentation.
Java commenting
Java generator
Java doc
Java loc
29. In the second type, the information written in java after // is ignored by the …………………..
Interpreter
Compiler
Programmer
All of the above
30. 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
program
java
hardware
nonjava
31. JSP embeds in ……………. in ………………….
Servlet, HTML
HTML, Java
HTML, Servlet
Java, HTML
32. 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
i-true, ii-true, iii-false, iv-true
i-false, ii-false, iii-false, iv-false
i-true, ii-true, iii-true, iv-true
i-true, ii-false, iii-false, iv-false
Submit