Java QB
Java QB
0 D 3 BJ
2 C A _______.
3
A B
Classes objects
. .
C D
properties function
. .
Answer is : B
2 2 B 3 11AO Original name of Java is ____
0 D 3 BJ
2 C A
3
A B
JavaOO JavaC++
. .
C D
Oak none
. .
Answer is : C
3 2 B 3 11AO Java was developed in the year
0 D 3 BJ
2 C A ____
3
A B
1995 2000
. .
C D
2001 2008
. .
Answer is : A
4 2 B 3 11AO Java was developed at _____
0 D 3 BJ
2 C A
3
A Bsun
microsoft
. . microsystem
C D
oracle TCS
. .
Answer is : B
5 2 B 3 11AO Expand J2SE
0 D 3 BJ
2 C A
3
Java 2 Java 2
A B
Standard Software
. .
Edition Edition
CJava 2 System D
none
. Edition .
Answer is : A
6 2 B 3 11AO Expand JDK
0 D 3 BJ
2 C A
3
Java Java
A B
Deployment Development
. .
Kit Kit
C D
Java design none
. .
Answer is : B
7 2 B 3 11AO Java platform independence is
0 D 3 BJ
2 C A achieved through ____
3
A B
JDK J2SE
. .
C D
JVM none
. .
Answer is : C
8 2 B 3 11AO JVM stands for
0 D 3 BJ
2 C A
3
AJava Virtual BJava Visual
. Mechanism . Machine
CJava Virtual DJava Visual
. Machine . Mechanism
Answer is : C
9 2 B 3 11AO Which one of the following is
0 D 3 BJ
2 C A not supported by java?
3
A B
pointers file
. .
C D
inheritance static constant
. .
Answer is : A
1 2 B 3 11AO In public static void main(String
0 0 D 3 BJ
2 C A args[]) –args specifies
3
Acommand line Bstring
. argument . arguments
C D
string array none
. .
Answer is : A
1 2 B 3 11AO What is different between a Java
1 0 D 3 BJ
2 C A applet and a Java application?
3
An application An applet
can in general must be
A B
be trusted executed in a
. .
whereas an browser
applet can't environment
CAn applet is not Dall of the
. able to access . above
the files of the
computer it runs
on
Answer is : D
1 2 B 3 11AO What is byte code in the context
2 0 D 3 BJ
2 C A of Java?
3
The type of
The type of
code
A Bcode generated
generated by
. . by a Java
a Java
Virtual Machine
compiler
It is the code
It is another
written within
Cname for a D
the instance
. Java source .
methods of a
file
class.
Answer is : A
1 2 B 3 11AO Which of the following
3 0 D 3 BJ
2 C A declarations is correct?
3
Aboolean b = B
byte b = 255
. TRUE .
CString s = D
both a and b
. “CMS”; .
Answer is : C
1 2 B 3 11AO Declarations can appear
4 0 D 3 BJ
2 C A anywhere in the body of a Java
3 method before it is used
A B
true false
. .
C D
may be none
. .
Answer is : A
1 2 B 3 11AO The range of values for the long
5 0 D 3 BJ
2 C A type data is
3
A 31 B 64
-2 to 231-1 -2 to 264
. .
C 63 D 32
-2 to 263-1 -2 to 232-1
. .
Answer is : C
1 2 B 3 11AO What is the main purpose of
6 0 D 3 BJ
2 C A the 'public static void
3 main(String[] args)' method
in a Java program?
A It is the entry B It is used to
point of the
program where declare
. .
execution variables.
begins.
It is
It is used for
Cresponsible for D
defining
. printing output .
classes.
to the console.
Answer is : C
1 2 B 3 11AO Which of the following
7 0 D 3 BJ
2 C A assignments are valid?
3
A B
float x=123.4 int num;
. .
C int n=(int) D
none
. false .
Answer is : B
1 2 B 3 11AO The default value of char type
8 0 D 3 BJ
2 C A variable is ___
3
A B
‘\u0020’ ‘\u00ff
. .
C D
““ ‘\u0000’
. .
Answer is : D
1 2 B 3 11AO What will be the result of the
9 0 D 3 BJ
2 C A expression 13 & 25?
3
A B
125 25
. .
C D
9 12
. .
Answer is : C
2 2 B 3 11AO Which of the following is not a
0 0 D 3 BJ
2 C A primitive type?
3
A B
byte string
. .
C D
integer float
. .
Answer is : B
2 2 B 3 11AO What is the result of the
1 0 D 3 BJ
2 C A expression ?
3
(1&2) + (3|4)
A1 B2
. .
C D
8 7
. .
Answer is : D
2 2 B 3 11AO In Java, what is the default value
2 0 D 3 BJ
2 C A for an instance variable (non-
3 static variable) of type int?
A B
0 1
. .
C D
null undefined
. .
Answer is : A
2 2 B 3 11AO What is the role of the static
3 0 D 3 BJ
2 C A keyword in Java?
3
It is used to
It indicates that
A Bcreate dyna
a method cannot
. . mic
be overridden
variables
It indicates that
a variable or
method belongs It is used to
C D
to the class rather define cons
. .
than an tant values
instance of the
class
Answer is : C
2 2 B 3 11AO Which of the following
4 0 D 3 BJ
2 C A expressions are illegal?
3
A B (false &&
(10 | 5)
. . true)
Boolean
C D
x=(Boolean) both b and c
. .
10;
Answer is : D
2 2 B 3 11AO Which of the following control
5 0 D 3 BJ
2 C A expressions are valid for an if
3 statement?
Aan integer Ba Boolean
. expression . expression
C D
either a or b neither a nor b
. .
Answer is : B
2 2 B 3 11AO Which of the following is a
6 0 D 3 BJ
2 C A decision making statement
3
A Bswitch
if statement
. . statement
Cconditional D
all the above
. statement .
Answer is : D
2 2 B 3 11AO What is the numerical range of a
7 0 D 3 BJ
2 C A char?
3
A B -(215) to (215)
-128 to 127
. .–1
C D
0 to 32767 0 to 65535
. .
Answer is : D
2 2 B 3 11AO Java supports ____________
8 0 D 3 BJ
2 C A arrays.
3
Aone Btwo
. dimensional . dimensional
Cmulti D
all the above
. dimensional .
Answer is : D
2 2 B 3 11AO Objects interaction through
9 0 D 3 BJ
2 C A sending messages is achieved by
3 ____
A B
methods functions
. .
C D
both none
. .
Answer is : A
3 2 B 3 11AO A class can be thought of as a
0 0 D 3 BJ
2 C A ____
3
A B
data type variable
. .
C D
value none
. .
Answer is : A
3 2 B 3 21AO An object can be thought of as a
1 0 D 3 BJ
2 C A ___________
3
A B
data type variable
. .
Cvalue Dnone
. .
Answer is : B
3 2 B 3 21AO To eliminate redundant code in a
2 0 D 3 BJ
2 C A object oriented program ___ can
3 be used
A B
inheritance data hiding
. .
C D
abstraction none
. .
Answer is : A
3 2 B 3 21AO To take multiple forms in a
3 0 D 3 BJ
2 C A program ____ can be used
3
A B
inheritance polymorphism
. .
C D
abstraction none
. .
Answer is : B
3 2 B 3 21AO API means
4 0 D 3 BJ
2 C A
3
Application Applet
A B
Programming Programming
. .
Interface Interface
Application
C D
Programming none
. .
Interchange
Answer is : A
3 2 B 3 21AO
5 0 D 3 BJ
2 C A
3 Which one of the following is an
access specifier ?
A B
private public
. .
C Dall of the
protected
. . above
Answer is : D
3 2 B 3 21AO Which keyword is used to
6 0 D 3 BJ
2 C A prevent a method from being
3 overridden in Java?
A B
'static' 'final'
. .
C D
'abstract' j'override'
. .
Answer is : B
3 2 B 3 21AO In order for a source code file,
7 0 D 3 BJ
2 C A containing the public class Test,
3 to successfully compile, which
of the following must be true?
It must have a It must be
A B
package named
. .
statement Test.java
It must declare
CIt must import D
a public class
. java.lang .
named Test
Answer is : B
3 2 B 3 21AO What output is displayed as the
8 0 D 3 BJ
2 C A result of executing the following
3 statement?
A B0b default
0 default value
. . value
C0.0 default D0.0f default
. value . value
Answer is : A
4 2 B 3 21AO What is the default size of
7 0 D 3 BJ
2 C A byte ?
3
A B
i bit 1 byte
. .
C D
2 bytes 4 bytes
. .
Answer is : B
4 2 B 3 21AO What are the Type Conversions
8 0 D 3 BJ
2 C A available in Java language?
3
Narrowing Widening
A B
Type Type
. .
Conversion Conversion
C DNone of the
A and B
. . above
Answer is : C
4 2 B 3 21AO Type promotion in Java usually
9 0 D 3 BJ
2 C A refers to ____.
3
Narrowing Widening
A B
Type Type
. .
Conversion Conversion
CNo Type DString
. Conversion . Conversion
Answer is : B
5 2 B 3 21AO Type Casting in Java usually
0 0 D 3 BJ
2 C A refers to ____.
3
Narrowing Widening
A B
Type Type
. .
Conversion Conversion
CNo Type DType
. Conversion . promotion
Answer is : A
5 2 B 3 21AT/ Explicit Type Conversion in Java
1 0 D 3 F
2 C A refers to Narrowing Type
3 Conversion.
A B
True False
. .
Answer is : TRUE
C float, long, D
all the above
. double .
Answer is : D
Answer is : FALSE
C D
float char
. .
Answer is : A
A B
32 64
. .
C D
512 None
. .
Answer is : D
5 2 B 3 21AO
7 0 D 3 BJ What is the purpose of the
2 C A
3 continue statement in a loop?
To skip the
current
ATo exit the loop B
iteration and
. immediately .
move to the
next iteration
To execute a
C To terminate D
specific block
. the program .
of code
Answer is : B
A B
for loop while loop
. .
C D
do-while loop none
. .
Answer is : B
5 2 B 3 21AO Which keyword in Java is used
9 0 D 3 BJ
2 C A for constant variables?
3
A B
const static
. .
C D
constant final
. .
Answer is : D
C D
3times float
. .
Answer is : B
Aint [] myList = B
int [] myList =
. {"1", "2", "3"}; . (5, 8, 2);
Answer is : D
AAddition B
& operator
. operator(+). .
C D
|| operator none
. .
Answer is : A
It is accessible It is accessablde
Ato all other Bonly to
. classes in the . subclasses of its
hierarchy parent class
It represents
C D
the public both a and c
. interface of its .
class
Answer is : D
AArray a = Bint [] a =
. new . {23,22,21,20,19
Array(5); };
C D
int a [] = int [5] array;
. new int[5]; .
Answer is : B
C D
sub classes reference
. .
Answer is : B
Compiler fails at
C the time of DCompiler
. Math class . succeeds.
instantiation
Answer is : C
CBlock of code D
both b and c
. declarations .
Answer is : D
C D
1 4
. .
Answer is : A
Answer is : C
Answer is : FALSE
Answer is : D
abstract show();
}
}
wrong, method
A Bshow() should
nothing is wrong
. . have a return
type
Answer is : C
C Private D
both b and c
. methods .
Answer is : D
C D public
public Test()
. . Test(void)
Answer is : C
C D
replace()
. reverse( ) .
Answer is : D
C D
both a and b
. s.replace( ) .
Answer is : D
C D
Runnable all the above
. .
Answer is : D
C Dsingle level
Hierarchial
. inheritance . inheritance
Answer is : A
7 2 B 3 31AO
9 0 D 3 BJ
The classes contained in the_________ of other programs can
2 C A be easily reused.
3
A B
pointers packages
. .
Cinterface Dnone
. .
Answer is : B
Referring to the
Passing itself
instance variable
C Dto method of
when local
. . the same
variable has the
class
same name
Answer is : D
private
C D
synchronized int volatile int d;
. .
e;
Answer is : C
A B
abstract simple class
. .
C D
static thread
. .
Answer is : A
C D
inherits base
. .
Answer is : B
A compile time B
run time error
. error .
First called
C code runs D method is
. sucessfully . executed
successfully
Answer is : B
ARunnable B
Math interface
. interface .
CSystem DThreadHandling
. interface . interface
Answer is : A
CThread DRunnable
. .
Answer is : C
ACompilatio BCompilation
. n error . succeeds
Compilation
succeeds but at the
time of creating
CRuntime D
object using default
. error .
constructor, it
throws compilation
error
Answer is : D
An event is an An event is a
object that class used for
C D
describes any defining
. .
change by the object, to
user and system create events
Answer is : A
It's a Java-
It's a technique
C Dspecific term for
to create
. . importing
objects in Java.
packages.
Answer is : A
C D
super this
. .
Answer is : A
C D
package interface
. .
Answer is : C
Package
defines a
A package can
Anamespace B
contain other
. in which .
package within it
classes are
stored
Answer is : D
It’s a process in
It’s a process in
which a single
which many
process can
Cdifferent
Daccess
. process are able
information
to access same
from many
information
sources
Answer is : A
Answer is : C
Answer is : A
It is dependent
CNone of them Don the
. will be executed . operating
system
Answer is : D
Answer is : D
A B
java.applet java.awt
. .
C D
java.event java.awt.event
. .
Answer is : D
A B
KeyListener() addKistener()
. .
C D
addKeyListene eventKeyboardLi
. .
r() stener()
Answer is : C
C D
addMouseMoti eventMouseMo
. .
onListner() tionListener()
Answer is : C
A B
getID() getSource()
. .
C D
getEvent() getEventObject
. .
()
Answer is : A
1 2 B 3 41AO Which of these class is super
0 0 D 3 BJ
4 2 C A class of all the events?
3
A B
EventObject EventClass
. .
C D
ActionEvent ItemEvent
. .
Answer is : A
1 2 B 3 41AO Which of these events will be
0 0 D 3 BJ
5 2 C A notified if scroll bar is
3 manipulated?
A BComponentEv
ActionEvent
. . ent
CAdjustmentEv D
WindowEvent
. ent .
Answer is : C
1 2 B 3 41AO Which of these events will be
0 0 D 3 BJ
6 2 C A generated if we close an applet’s
3 window?
A B
ActionEvent ComponentEv
. .
ent
CAdjustmentEv D
WindowEvent
. ent .
Answer is : D
1 2 B 3 41AO When does Exceptions in Java
0 0 D 3 BJ
7 2 C A arises in code sequence?
3
B Compilation
. Run Time
. Time
C Can Occur D None of the
. Any Time . mentioned
Answer is : A
1 2 B 3 41AO Which of these keywords is not a
0 0 D 3 BJ
8 2 C A part of exception handling?
3
A B
try finally
. .
C D
thrown catch
. .
Answer is : C
1 2 B 3 41AO Which of these keywords must
0 0 D 3 BJ
9 2 C A be used to monitor for
3 exceptions?
A B
try finally
. .
C D
throw catch
. .
Answer is : A
1 2 B 3 41AO Which of these keywords must
1 0 D 3 BJ
0 2 C A be used to handle the exception
3 thrown by try block in some
rational manner?
A B
try finally
. .
C D
throw catch
. .
Answer is : D
1 2 B 3 41AO Which of these keywords is used
1 0 D 3 BJ
1 2 C A to manually throw an exception?
3
Atry B finally
. .
C D
throw catch
. .
Answer is : C
1 2 B 3 41AO Which of these packages
1 0 D 3 BJ
2 2 C A contains all the event handling
3 interfaces?
A B
java.lang java.awt
. .
C D
java.event
. java.awt.event .
Answer is : C
1 2 B 3 41AO Which of these interfaces
1 0 D 3 BJ
3 2 C A handles the event when a
3 component is added to a
container?
AComponentLis B
ContainerListe
. tener .
ner
C D
FocusListener InputListener
. .
Answer is : B
1 2 B 3 41AO Which of these interfaces define
1 0 D 3 BJ
4 2 C A a method actionPerformed()?
3
A BContainerList
ComponentList
. . ener
ener
C D
ActionListener InputList
. .
Answer is : C
1 2 B 3 41AO Which of these interfaces define
1 0 D 3 BJ
5 2 C A a method itemStateChanged()?
3
AComponentLis BContainerList
. tener . ener
C D
ActionListener ItemListener
. .
Answer is : C
1 2 B 3 41AO Which of these methods will
1 0 D 3 BJ respond when you click any
6 2 C A
3 button by mouse?
A B
mouseClicked mouseEntered
. .
() ()
C D all of the
mousePressed(
. . mentioned
)
Answer is : D
1 2 B 3 41AO Which is the container that
1 0 D 3 BJ
7 2 C A doesn't contain title bar and
3 MenuBars but it can have other
components like button, textfield
etc?
A B
Window Frame
. .
C D
Panel Container
. .
Answer is : C
1 2 B 3 41AO Give the abbreviation of AWT?
1 0 D 3 BJ
8 2 C A
3
Applet Abstract
A B
Windowing Windowing
. .
Toolkit Toolkit
Absolute
C D None of the
Windowing
. . above
Toolkit
Answer is : B
1 2 B 3 41AO Which method is used to set the
1 0 D 3 BJ
9 2 C A graphics current color to the
3 specified color in the graphics
class?
A BFileInputStre
FileStream
. . am
CBUfferedOutpu DFileBufferStr
. tStream . eam
Answer is : B
1 2 B 3 51AO Which of these exception is
2 0 D 3 BJ
2 2 C A thrown in cases when the file
3 specified for writing is not
found?
A B
IOException FileException
. .
CFileNotFoundE DFileInputExce
. xception . ption
Answer is : C
1 2 B 3 51AO Which of these class contains
2 0 D 3 BJ
3 2 C A the methods used to write in a
3 file?
A BFileInputStre
FileStream
. . am
CBUfferedOutpu DFileBufferStr
. tStream . eam
Answer is : B
1 2 B 3 51AO Which of these methods are used
2 0 D 3 BJ
4 2 C A to read in from file?
3
Aget() B read()
. .
C D
scan() readFileInput()
. .
Answer is : B
1 2 B 3 51AO Which of these values is returned
2 0 D 3 BJ
5 2 C A by read() method is end of file
3 (EOF) is encountered?
A B
0 1
. .
C D
-1 Null
. .
Answer is : C
1 2 B 3 51AO Which of these exception is
2 0 D 3 BJ
6 2 C A thrown by close() and read()
3 methods?
A B
IOException FileException
. .
CFileNotFound DFileInputOutpu
. Exception . tException
Answer is : A
1 2 B 3 51AO What will be the output of the
2 0 D 3 BJ
7 2 C A following Java program?
3
1. import java.io.*;
2. class
filesinputoutput
3. {
4. public
static void
main(String args[])
5. {
6.
InputStream obj =
new
FileInputStream("inp
utoutput.java");
7.
System.out.print(obj
.available());
8. }
9. }
A B
true false
. .
Cprints number Dprints number
. of bytes in file . of characters
in the file
Answer is : C
1 2 B 3 51AO Which of these stream contains
2 0 D 3 BJ
8 2 C A the classes which can work on
3 character stream?
A B
InputStream OutputStream
. .
CCharacter DNone of the
. Stream . above
Answer is : C
1 2 B 3 51AO Which of these class is used to
2 0 D 3 BJ
9 2 C A read characters in a file?
3
A B
FileReader FileWriter
. .
CFileInputStrea DInputStreamRe
.m . ader
Answer is : A
1 2 B 3 51AO Which of these method of
3 0 D 3 BJ
0 2 C A FileReader class is used to read
3 characters from a file?
A B
read() scanf()
. .
C D
get() getInteger()
. .
Answer is : A
1 2 B 3 51AO Which of these class can be used
3 0 D 3 BJ
1 2 C A to implement the input stream
3 that uses a character array as the
source?
ABufferedReade B
FileReader
.r .
CCharArrayRea DFileArrayRead
. der . er
Answer is : C
1 2 B 3 51AO Which of these classes can return
3 0 D 3 BJ
2 2 C A more than one character to be
3 returned to input stream?
ABufferedRead B
Bufferedwriter
. er .
CPushbachRead DCharArrayRea
. er . der
Answer is : C
1 2 B 3 51AO What is the abbreviation of
3 0 D 3 BJ
3 2 C A ASCII?
3
American Australian
Standard Standard
A B
Characters for Code for
. .
Information Information
Interchange Interchange
American Stan American Stan
Cdard Code for Ddard Code for
. Information . Interchange
Interchange Information
Answer is : C
1 2 B 3 51AO What is the size of a CHAR data
3 0 D 3 BJ
4 2 C A type constant in Java?
3
A B
1 byte 2 bytes
. .
C D
4 bytes 6 bytes
. .
Answer is : B
1 2 B 3 51AO What is the character encoding
3 0 D 3 BJ
5 2 C A standard used in Java
3 language?
A B
ASCII Unicode
. .
C D
Hexacode Bytecode
. .
Answer is : C
1 2 B 3 51AO What is the primary purpose of
3 0 D 3 BJ
6 2 C A input streams in Java?
3
ATo write data BTo read data
. to a file. . from a file.
CTo append DTo create
. data to a file. . directories.
Answer is : B
1 2 B 3 51AO Which class in Java is used to
3 0 D 3 BJ
7 2 C A create a new directory?
3
A B
FileReader FileWriter
. .
C D
File Directory
. .
Answer is : C
1 2 B 3 51AO What is the purpose of the
3 0 D 3 BJ
8 2 C A FileOutputStream class in Java?
3
Answer is : A
1 2 B 3 51AO Which method is used to check if
3 0 D 3 BJ
9 2 C A a file or directory exists in Java?
3
A BcreateNewFile(
exists()
. .)
CmakeDirector D isFileOrDirect
. y() . ory()
Answer is : A
1 2 B 3 51AO What is the purpose of the
4 0 D 3 BJ
0 2 C A FileReader class in Java?
3
To read binary To write
A B
data from a binary data to
. .
file. a file.
To read To write
C D
character data character data
. .
from a file. to a file.
Answer is : C
1 2 B 3 51AO What is the purpose of the
4 0 D 3 BJ
1 2 C A File.separator constant in Java?
3
To separate
To separate
A Bdirectories and
text within a
. . files in file
file.
paths.
To
CTo define the Dconcatenate
. end of a file. . strings in file
operations.
Answer is : B
1 2 B 3 51AO Which class is used for efficient
4 0 D 3 BJ
2 2 C A reading of characters from a file
3 in Java?
A BFileInputStrea
FileReader
. .m
CBufferedRead DDataInputStrea
. er .m
Answer is : C
1 2 B 3 51AO Which class is used to write
4 0 D 3 BJ
3 2 C A serialized objects to a file in
3 Java?
AObjectInputStr BFileOutputStr
. eam . eam
CObjectOutputS D
FileWriter
. tream .
Answer is : C
1 2 B 3 51AO What does the File.delete()
4 0 D 3 BJ
4 2 C A method do in Java?
3
Appends text
A B
Delete a file to an existing
. .
file.
Delete binary
CDeletes a file D
data from a
. or directory. .
file.
Answer is : C
1 2 B 3 51AO What is the primary purpose of
4 0 D 3 BJ
5 2 C A the RandomAccessFile class in
3 Java?
ATo read data BTo write data
. from a file. . to a file
To read and
write data at a
C DTo create
specific
. . directories.
position in a
file.
Answer is : C
1 2 B 3 51AO What is the role of the
4 0 D 3 BJ
6 2 C A BufferedInputStream class in
3 Java file handling?
To read To read binary
A B
character data data from a
. .
from a file. file efficiently.
CTo create a DTo append text
. new file. . to an existing
file.
Answer is : B
1 2 B 3 51AO An expression involving byte,
4 0 D 3 BJ
7 2 C A int, and literal numbers is
3 promoted to which of these?
A B
int long
. .
C D
byte float
. .
Answer is : A
1 2 B 3 51AO Which data type value is
4 0 D 3 BJ
8 2 C A returned by all transcendental
3 math functions?
A B
int float
. .
C D
double long
. .
Answer is : C
1 2 B 3 51AO What is the entry point of a
4 0 D 3 BJ
9 2 C A program in Java?
3
A Bthe first line
main()method
. . of code
C D
last line of code main class
. .
Answer is : A
1 2 B 3 51AO Which data type is used to store
5 0 D 3 BJ
0 2 C A floating point numbers with
3 single precision in java.
A B
float double
. .
C D
decimal real
. .
Answer is : A
1 2 B 3 11B D Classify Java support systems.
5 0 D 3 ES
1 2 C A C
3
1 2 B 3 11B D How to implement a java program.
5 0 D 3 ES
2 2 C A C
3
1 2 B 3 11B D Explain about java program
5 0 D 3 ES
3 2 C A C structure
3