0% found this document useful (0 votes)
103 views

Java Programming Solved MCQs (Set-4)

This document provides 100 multiple choice questions about Java programming concepts like exceptions, threads, streams and I/O. It tests knowledge of exception classes like IOException, Error, and ArrayIndexOutOfBoundsException. It also covers threading topics such as the Runnable interface, Thread priority and states, and methods like start(), join(), sleep(). Finally, it questions understanding of input/output stream classes like InputStream, OutputStream, Reader and Writer as well as I/O methods like read(), println(), readLine().
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
103 views

Java Programming Solved MCQs (Set-4)

This document provides 100 multiple choice questions about Java programming concepts like exceptions, threads, streams and I/O. It tests knowledge of exception classes like IOException, Error, and ArrayIndexOutOfBoundsException. It also covers threading topics such as the Runnable interface, Thread priority and states, and methods like start(), join(), sleep(). Finally, it questions understanding of input/output stream classes like InputStream, OutputStream, Reader and Writer as well as I/O methods like read(), println(), readLine().
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Java Programming MCQs [set-4]

76. Which exception is thrown by read() method?


A. IOException
B. InterruptedException
C. SystemException
D. SystemInputException
Answer: A

77. Which is the super class of all exception classes


A. Exception
B. Object
C. Error
o m
D. Throwable . c
Answer: D
te
a of the java.lang package?
q M
78. Which class is the super class of all classes
A. Object
c
B. System
C. Super
M
D. Class
Answer: A

79. Which of the following exception is raised when a number is divided by zero
A. NumberFormatException
B. ArithmeticException
C. NullPointerException
D. IllegalArgumentException
Answer: B

80. A single try block must be followed by which of these?


A. finally
B. catch
C. catch or finally
D. None of the mentioned
Answer: C

81. Which of these exceptions will occur if we try to access the index of an array
beyond its length?
A. ArithmeticException
B. ArrayException
C. ArrayIndexException
D. ArrayIndexOutOfBoundsException
Answer: D

82. Runnable is a
A. Class
B. Method
C. Variable
D. Interface
Answer: D

83. Thread priority in Java is represented as?


A. int
B. Float
C. double
D. long
Answer: A

84. Which of these class is used to make a thread?


A. String
B. System
C. Thread
D. Runnable
Answer: C

85. Which of these interface is implemented to create a Thread?


A. Runnable
B. Connections
C. Set
D. MapConnections
Answer: A

Download more sets at McqMate.com


86. Which of these method of Thread class is used to find out the priority given to a
thread?
A. get()
B. ThreadPriority()
C. getPriority()
D. getThreadPriority()
Answer: C

87. Which of this method of Thread class is used to change the state of a thread to
blocked state?
A. sleep()
B. terminate()
C. stop()
D. block()
Answer: A

88. Which method in Thread class is used to check weather a thread is still
running?
A. isAlive()
B. Join()
C. isRunning()
D. Alive()
Answer: A

89. Which of these methods is used to begin the execution of a thread?


A. run()
B. start()
C. runThread()
D. startThread()
Answer: B

90. Which of these method waits for the thread to treminate?


A. sleep()
B. isAlive()
C. join()
D. stop()
Answer: C

Download more sets at McqMate.com


91. Which of these is used to read a string from the input stream?
A. get()
B. getLine()
C. read()
D. readLine()
Answer: D

92. Which of these classes is used to read characters and strings in Java from
console?
A. BufferedReader
B. StringReader
C. BufferedStreamReader
D. InputStreamReader
Answer: D

93. Which of these classes are used by Byte streams for input operation?
A. InputStream
B. InputOutputStream
C. Reader
D. All of the mentioned
Answer: A

94. Which of these class contains the methods print() & println()?
A. System
B. System.out
C. BufferedOutputStream
D. PrintStream
Answer: D

95. Which of these methods can be used to write console output?


A. printout()
B. println()
C. write()
D. All of the mentioned
Answer: B

96. Which of these classes are used by character streams output operations?

Download more sets at McqMate.com


A. OutputStream
B. Writer
C. ReadStream
D. InputOutputStream
Answer: B

97. Which refers to a channel through which data flow from the source to the
destination:
A. String
B. Character
C. Stream
D. Buffer
Answer: C

98. Java Stream classes can be categorized into two groups:


A. Byte and Character Stream Classes
B. Stream and String Classes
C. String and Character Stream Classes
D. Buffer and Character Stream Classes
Answer: A

99. Byte Stream Classes support input/output operations on _____


A. 8 bit
B. 16 bit
C. 32 bit
D. 64 bit
Answer: A

100. Character Stream Classes support input/output operations on _______


characters:
A. 8 bit Unicode
B. 16 bit Unicode
C. 32 bit Unicode
D. 64 bit Unicode
Answer: B

Download more sets at McqMate.com

You might also like