Font size
WorksheetsJava
Total questions: 65
Worksheet time: 22mins
When an applet is terminated which of the following sequence of methods calls take place?
stop(),paint(),destroy()
destroy(),stop(),paint()
destroy(),stop()
stop(),destroy()
Types of exceptions in Java programming are
Checked exception
unchecked exception
Both A & B
None
Checked exception caught at
compile time
run time
Both at compile and run time
None
Which is the super class of all java exceptions classes?
Exception
RuntimeException
Throwable
IOException
un-checked(runtime) exception in java is/are
ArrayIndexOutOfBoundsException
ArithmeticException
NullPointerException
All
Incorrect statement(s) about finally block in java exception
Finally block always follow try catch block
finally block always executes whether exception is handled or not.
There can be multiple finally blocks followed by try catch block.
All are correct
True statement(s) about try catch block
It is mandatory to have catch block with every try block
There must be only one catch block followed by try block
There can be multiple catch block followed by try block.
All
Which is not an exception in Java?
IO Exception
Logical Exception
Array Index out of bound Exception
Arithmetic Exception
Which of these keywords is used to manually throw an exception?
try
finally
throw
catch
Which of these methods are used to register a keyboard event listener?
KeyListener()
addKistener()
addKeyListener()
eventKeyboardListener()
Which of these is a type of stream in Java?
Integer stream
Short stream
Byte stream
Long stream
Which of these classes are used by Byte streams for input and output operation?
InputStream
InputOutputStream
Reader
All of the mentioned
Which of these classes are used by character streams for input and output operations?
InputStream
Writer
ReadStream
InputOutputStream
Which of these class is used to read from byte array?
InputStream.
BufferedInputStream
ArrayInputStream
ByteArrayInputStream
Which exception is thrown by read() method?
IOException
InterruptedException
SystemException
SystemInputException
Which of these is used to read a string from the input stream?
get()
getLine()
read()
readLine()
Which of these class is used to read characters and strings in Java from console?
BufferedReader
StringReader
BufferedStreamReade
InputStreamReader
Which of these classes are used by Byte streams for input and output operation?
InputStream
InputOutputStream
Reader
All of the mentioned
Which of these class is implemented by FilterInputStream class?
InputStream
BufferedInputStream
FileInputStream
BufferedFileInputStream
Which of these methods can be used to writing console output?
print()
println()
write()
All of the mentioned
Which of these class is used to create an object whose character sequence is mutable?
String()
StringBuffer()
Both of the mentioned
None of the mentioned
Which of these method of class StringBuffer is used to reverse sequence of characters?
reverse()
reverseall()
Reverse()
reverseAll()
Which of these classes are used by character streams output operations?
InputStream
Writer
ReadStream
InputOutputStream
How many ways a thread can be created in Java multithreading?
1
2
3
4
Which statements is/are correct
On calling Thread start () method a new thread get created.
Thread start () method call run () method internally
Thread run () method can also be called directly to create thread.
All correct
Which method is used to make main thread to wait for all child threads
Join ()
Sleep ()
Wait ()
Stop ()
Default value of a java thread is
0
1
5
10
Which method is used to check if a thread is running?
isAlive()
run ()
alive ()
keepAlive()
Min and Max priority of a thread in Java multithreading are
1, 10
0,10
0,255
1,256
Daemon thread runs in
Background
Foreground
Both
none
Thread synchronization in a process will be required when
All threads sharing the same address space
All threads sharing the same global variables
All threads sharing the same files
All
Which thread will be executed first if two threads have same priority
They will fall in starvation and none will be executed.
Both will be executed simultaneously
It depends upon operating system
They will be executed on first come first serve basis
The life cycle of a thread in java is controlled by
JRE
JDK
JVM
None
Which method is used to get current running thread object?
runningThread()
currentThread()
runnableThread()
None
