Java MCQs with Answer

 

Java MCQs with Answer

Java MCQs with Answer

  • Java programs are

(a) Faster than others
(b) Platform independent
(c) Not reusable
(d) Not scalable

(b) Platform independent

  • Java has its origin in

(a) C programming language
(b) PERRL
(c) COBOL
(d) Oak programming language

(d) Oak programming language

  • Which one of the following is true for Java

(a) Java is object oriented and interpreted
(b) Java is efficient and faster than C
(c) Java is the choice of everyone.
(d) Java is not robust.

(a) Java is object oriented and interpreted

  • The command javac is used to

(a) debug a java program
(b) compile a java program
(c) interpret a java program
(d) execute a java program

(b) compile a java program

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

(a) Dynamic content
(b) Static content
(c) Hardware
(d) Both a and b

(a) Dynamic content

  • Filters were officially introduced in the Servlet ___________ specification.

(a) 2.1
(b) 2.3
(c) 2.2
(d) 2.4

(b) 2.3

  • Which is the root class of all AWT events

(a) java.awt.ActionEvent
(b) java.awt.AWTEvent
(c) java.awt.event.AWTEvent
(d) java.awt.event.Event

(c) java.awt.event.AWTEvent

  • OOP features are

i) Increasing productivity
ii) Reusability
iii) Decreasing maintenance cost
iv) High vulnerability
(a) 1,2 & 4
(b) 1,2 & 3
(c) 1, 2 & 4
(d) none of the above

(b) 1,2 & 3

  • break statement is used to

i) get out of method
ii) end aprogram
iii) get out of a loop
iv) get out of the system

(a) 1 & 2
(b) 1,2 & 3
(c) 1 & 3
(d) 3

(d) 3

  • Native – protocol pure Java converts ______ into the ______ used by DBMSs directly.

(a) JDBC calls, network protocol
(b) ODBC class, network protocol
(c) ODBC class, user call
(d) JDBC calls, user call

(a) JDBC calls, network protocol

  • The JDBC-ODBC bridge allows ……….. to be used as ………..

(a) JDBC drivers, ODBC drivers
(b) Drivers, Application
(c) ODBC drivers, JDBC drivers
(d) Application, drivers

(c) ODBC drivers, JDBC drivers

  • Which of the following is true about Java.

(a) Java does not support overloading.
(b) Java has replaced the destructor function of C++
(c) There are no header files in Java.
(d) All of the above.

See also  Functional English Important MCQs

(d) All of the above

  • _______ are not machine instructions and therefore, Java interpreter generates machine code that can be directly executed by the machine that is running the Java program.

(a) Compiled Instructions
(b) Compiled code
(c) byte code
(d) Java mid code

(c) byte code

  • The command javac

(a) Converts a java program into binary code
(b) Converts a java program into bytecode
(c) Converts a java program into machine language
(d) None of the above.

(b) Converts a java program into bytecode

  • Which of the following is not the java primitive type

(a) Byte
(b) Float
(c) Character
(d) Long double

(d) Long double

  • Command to execute compiled java program is

(a) java
(b) javac
(c) run
(d) javaw

(a) java

  • Java Servlet

i) is key component of server side java development
ii) is a small pluggable extension to a server that enhances functionality
iii) runs only in Windows Operating System
iv) allows developers to customize any java enabled server
(a) i, ii & iii are ture
(b) i, iii & iv are true
(c) ii, iii & iv are true
(d) i, ii & iv are true

(d) i, ii & iv are true

  • Inner classes are

(a) anonymous classes
(b) nested classes
(c) sub classes
(d) derived classes

(b) nested classes

  • How many times does the following code segment execute/

int x=1, y=10, z=1;
do{
  y–; 
  x++; 
  y-=2; 
  y=z; 
  z++
} while (y>1 && z<10);

(a) 1
(b) 10
(c) 5
(d) infinite

(a) 1

  • State weather the following statement is true or false for EJB.

1. EJB exists in the middle-tier
2. EJB specifies an execution environment
3. EJB supports transaction processing
(a) 1-true, 2. true, 3. true
(b) 1- true, 2. false, 3. true
(c) 1- false, 2- false, 3- false
(d) 1-true, 2-true, 3-false

(a) 1-true, 2. true, 3. true

  • All java classes are derived from

(a) java.lang.Class
(b) java.util.Name
(c) java.lang.Object
(d) java.awt.Window

See also  Functional English Important MCQs

(c) java.lang.Object

  • The jdb is used to

(a) Create a jar archive
(b) Debug a java program
(c) Create C header file
(d) Generate java documentation

(b) Debug a java program

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

(a) No error
(b) Compilation error
(c) Program won’t run
(d) Program exit

(c) Program won’t run

  • For execution of DELETE SQL query in JDBC,______ method must be used.

(a) executeQuery()
(b) executeDeleteQuery()
(c) executeUpdate()
(d) executeDelete()

(c) executeUpdate()

  • Which method will a web browser call on a new applet?

(a) main method
(b) destroy method
(c) execute method
(d) init method

(d) init method

  • Which of the following is not mandatory in variable declaration?

(a) a semicolon
(b) an identifier
(c) an assignment
(d) a data type

(c) an assignment

  • When a program 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

(d) all methods defined in that interface

  • In order to run JSP ……………….. is required.

(a) Mail Server
(b) Applet viewer
(c) Java Web Server
(d) Database connection

(c) Java Web Server

  • State true of 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

(a) i-false, ii-false

  • Prepared Statement object in JDBC used to execute _____ queries.

(a) Executable
(b) Simple
(c) High level
(d) Parameterized

(d) Parameterized

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

(a) pre increment
(b) post increment
(c) incrementation
(d) pre incrementation

(d) pre incrementation

  • When the operators are having the same priority, they are
    evaluated from _______ __________ in the order they appear in the expression.

(a) right to left
(b) left to right
(c) any of the order
(d) depends on compiler

(b) left to right

See also  Functional English Important MCQs
  • In java, ________ can only test for equality, where as ________ can evaluate any type of the
    Boolean expression.

(a) switch, if
(b) if, switch
(c) if, break
(d) continue, if

a) switch, if

  • The ______ looks only for a match between the value of the expression and one of its
    case constants.

(a) if
(b) match
(c) switch
(d) None of the above

(c) switch

  • System.in.read() is being used, the program must specify the _______ clause.

(a) throws.java.out.IOException
(b) throws.java.in.IOException
(c) throws.java.io.IOException
(d) throws.java.io.InException

(c) throws.java.io.IOException

  • By using____________ you can force immediate termination of a loop,
    by passing the conditional expression and any remaining code in the
    body of the
    loop.

(a) Break
(b) Continue
(c) Terminate
(d) Loop Close

(a) Break

  • The out object is an object encapsulated inside the___________
    class, and represents the standard output device.

(a) standard
(b) local
(c) globlal
(d) system

(d) system

  • The third type of comment is used by a tool called _______ for
    automatic generation of documentation.

(a) Java commenting
(b) Java generator
(c) Java doc
(d) Java loc

(c) Java doc

  • In the second type the information written in java after // is
    ignored by the ______.

(a) Interpreter
(b) Compiler
(c) Programmer
(d) All of the above

(b) Compiler

  • The compiled java program can run on any ______ plateform having Java Virtual
    Machine (JVM) installed on it.

(a) program
(b) java
(c) hardware
(d) non java

(b) java

  • Preparedstatement Object in JDBC is used to execute __________ queries.

(a) executable
(b) simple
(c) high level
(d) parameterized

(d) parameterized

  • In JDBC _________imports all Java classes concerned with
    database connectivity.

(a) javax.sql.*
(b) java.mysql.*
(c) java.sql.*
(d) com.*

(a) javax.sql.*

  • MS-SQL stores data in a …………………… file format.

(a) .DAT
(b) .MDB
(c) .MSSQL
(d) .OBJ

(a) .DAT

  • Ingres is a _______.

(a) Socket
(b) Compiler
(c) Database
(d) Web server

(c) Database

Related Topics

Java MCQs with Answer“,”java mcq questions with answers pdf”,”advanced java mcq questions with answers pdf”,”java mcq questions for placement”,”java mcq online test”,”Java MCQ “,”Java MCQ Questions and Answer”,”readmcqs.com”,”ReadMCQs.com”