Professional Documents
Culture Documents
Feedback: The Correct Answer Is: Start
Feedback: The Correct Answer Is: Start
Select one:
a. run();
b. start();
c. init();
d. resume();
Feedback
The correct answer is: start();
Question 2
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of these classes can return more than one character to be returned to input stream?
Select one:
BufferedReader
CharArrayReader
Bufferedwriter
PushbachReader
Feedback
The correct answer is: PushbachReader
Question 3
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Which of these stream contains the classes which can work on character stream?
Select one:
OutputStream
InputStream
Feedback
The correct answer is: Character Stream
Question 4
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Which method is used to make main thread to wait for all child threads
Select one:
Stop ()
Wait ()
Sleep ()
Join ()
Feedback
The correct answer is: Join ()
Question 5
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What will be the output of the program?
try
{
int x = 0;
int y = 5 / x;
}
catch (Exception e)
{
System.out.println("Exception");
}
catch (ArithmeticException ae)
{
System.out.println(" Arithmetic Exception");
}
System.out.println("finished");
Select one:
Arithmetic Exception
Compilation fails.
finished
Exception
Feedback
The correct answer is: Compilation fails.
Question 6
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is a super class of all exception type classes?
Select one:
Catchable
String
Throwable
RuntimeExceptions
Feedback
The correct answer is: Throwable
Question 7
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following keyword is used by calling function to handle exception thrown by called
function?
Select one:
try
throws
throw
catch
Feedback
The correct answer is: throws
Question 8
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
What is the output of this program?
1. import java.io.*;
2. class filesinputoutput
3. {
5. {
7. System.out.print(obj.available());
8. }
9. }
Select one:
prints number of bytes in file
false
true
prints number of characters in the file
Feedback
The correct answer is: prints number of bytes in file
Question 9
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following handles the exception when a catch is not used?
Select one:
throw handler
default handler
java run time system
finally
Feedback
The correct answer is: default handler
Question 10
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Using which annotation non visible or private method can be tested?
Select one:
@Visible
@VisibleForTesting
@NonVisible
@NonVisibleForTesting
Feedback
The correct answer is: @VisibleForTesting
Question 11
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the output of this program?
1. class exception_handling
2. {
3. public static void main(String args[])
4. {
5. try
6. {
7. System.out.print("A");
8. throw new NullPointerException ("Hello");
9. }
10. catch(ArithmeticException e)
11. {
12. System.out.print("B");
13. }
14. }
15. }
Select one:
B
A
Runtime Exception
Hello
Feedback
The correct answer is: Runtime Exception
Question 12
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following operators is used to generate instance of an exception which can be
thrown using throw?
Select one:
new
alloc
thrown
malloc
Feedback
The correct answer is: new
Question 13
Correct
Mark 1.00 out of 1.00
Flag question
Question text
The …………………… package contains a large number of stream classes that provide
capabilities for processing all types of data.
Select one:
java.util
java.awt
java.io
java.net
Feedback
The correct answer is: java.io
Question 14
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of these method(s) is/are used for writing bytes to an outputstream?
Select one:
Feedback
The correct answer is: print() and write()
Question 15
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of these data type is returned by every method of OutputStream?
Select one:
int
float
Feedback
The correct answer is: none of the mentioned
Question 16
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
What are valid statements for suspend() and resume() method?
Select one:
If the target thread holds a lock on object when it is suspended, no thread can lock this object
Feedback
The correct answer is: All
Question 17
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What package is a part of the wrapper class which is imported by default into all Java
programs?
Select one:
java.lang
java.awt
java.io
java.util
Feedback
The correct answer is: java.lang
Question 18
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
launch()
execute()
run()
main()
Feedback
The correct answer is: run()
Question 19
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Which of these is used to perform all input & output operations in Java?
A.
B.
C.
D.
Select one:
Variables
Methods
classes
streams
Feedback
The correct answer is: streams
Question 20
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is not pre defined annotation in Java?
a)
b)
c)
d)
Select one:
@SafeVarags
@Overriden
@FunctionInterface
@Deprecated
Feedback
The correct answer is: @Overriden
Question 21
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of these class is used to read characters in a file?
Select one:
FileInputStream
FileReader
InputStreamReade
FileWriter
Feedback
The correct answer is: FileReader
Question 22
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
What is the output of this program?
1. import java.io.*;
2. class Chararrayinput
3. {
5. {
9. obj.getChars(0,length,c,0);
12. int i;
13. try
14. {
16. {
17. System.out.print((char)i);
18. }
19. }
21. {
23. e.printStackTrace();
24. }
25. }
26. }
Select one:
abc
abcde
abcd
abcdef
Feedback
The correct answer is: abc
Question 23
Correct
Mark 1.00 out of 1.00
Flag question
Question text
threadE.start();
Select one:
0
3
2
1
Feedback
The correct answer is: 2
Question 24
Correct
Mark 1.00 out of 1.00
Flag question
Question text
……………….. streams provide functionally for threads to communicate and exchange data
between them.
A) Object
B) Piped
C) Pushback
D) Filtered
Select one:
Piped
Pushback
Object
Filtered
Feedback
The correct answer is: Piped
Question 25
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
Using both
Feedback
The correct answers are:
Question 26
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of these method of FileReader class is used to read characters from a file?
Select one:
read()
get()
scanf()
getInteger()
Feedback
The correct answer is: read()
Question 27
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Annotation type definition looks similar to which of the following?
Select one:
a. Method
b. Interface
c. Field
d. Class
Feedback
The correct answer is: Interface
Question 28
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is true about acquiring object lock before calling wait(), notify() and notifyAll()?
Select one:
it’s mandatory to acquire object lock before calling wait(), notify() and
notifyAll() methods on object
If we call wait(), notify() and notifyAll() methods without acquiring object lock i.e. from outside
synchronize block then java.lang.IllegalMonitorStateException is thrown at runtime.
wait(), notify() and notifyAll() methods are always called from Synchronized block only
all
Feedback
The correct answer is: all
Question 29
Correct
Mark 1.00 out of 1.00
Remove flag
Question text
The DataInputStream and DataOutputStream classes are …………………….. streams that allow
the reading and writing of java primitive data types.
Select one:
file
filter
sequence
object
Feedback
The correct answer is: filter
Question 30
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
10
8
5
12
Feedback
The correct answer is: 10
Question 31
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Annotations which are applied to other annotations are called meta annotations.
a) True
b) False
Select one:
True
False
Feedback
The correct answer is 'True'.
Question 32
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
1. class exception_handling
2. {
3. public static void main(String args[])
4. {
5. try
6. {
7. int i, sum;
8. sum = 10;
9. for (i = -1; i < 3 ;++i)
10. {
11. sum = (sum / i);
12. System.out.print(i);
13. }
14. }
15. catch(ArithmeticException e)
16. {
17. System.out.print("0");
18. }
19. }
20. }
Select one:
a. -1
b. 0
c. -101
d. -10
Feedback
The correct answer is: -10
Question 33
Correct
Mark 1.00 out of 1.00
Flag question
Question text
How can Thread go from waiting to runnable state?
Select one:
All
When sleep time is up
Using resume() method when thread was suspended
notify/notifAll
Feedback
The correct answer is: All
Question 34
Correct
Mark 1.00 out of 1.00
Flag question
Question text
The ……………………… method of the BufferedReader class is used for reading lines of text
from the console, the file or other input streams.
Select one:
readByte( )
read(byte[]b)
read( )
readLine( )
Feedback
The correct answer is: readLine( )
Question 35
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Which exception is thrown by the read( ) method of InputStream class.
Select one:
IOException
ReadException
File Not Found Exception
Exception
Feedback
The correct answer is: IOException
Question 36
Correct
Mark 1.00 out of 1.00
Remove flag
Question text
What is the output of this program?
1. class exception_handling
2. {
3. public static void main(String args[])
4. {
5. try
6. {
7. int a, b;
8. b = 0;
9. a = 5 / b;
10. System.out.print("A");
11. }
12. catch(ArithmeticException e)
13. {
14. System.out.print("B");
15. }
16. }
17. }
Select one:
B
A
Compilation Error
Runtime error
Feedback
The correct answer is: B
Question 37
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following keywords is used for throwing exception manually?
Select one:
throw
finally
catch
try
Feedback
The correct answer is: throw
Question 38
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which version of Java introduced annotation?
Select one:
Java 6
Java 7
Java 5
Java 8
Feedback
The correct answer is: Java 5
Question 39
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
All correct
Thread run () method can also be called directly to create thread.
Thread start () method call run () method internally
Feedback
The correct answer is: On calling Thread start () method a new thread get created.
Question 40
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which is the Parent class of annotation class?
Select one:
Object
Super
Class
Main
Feedback
The correct answer is: Object