R4RIN
Articles
Java 8
MCQS
Java MCQ Quiz Hub
Java Mcq Question Set 5
Choose a topic to test your knowledge and improve your Java skills
1. Which of these classes is not part of Java's collection framework?
Stack
Queue
Array
Maps
2. Which of these interface is not a part of Java's collection framework?
Set
List
SortedList
SortedMap
3. Which of these methods deletes all the elements from invoking collection?
delete()
refresh()
reset()
clear()
4. What is Collection in Java?
A group of classes
A group of objects
A group of interfaces
None
5. Which of these interface declares core method that all collections will have?
Comparator
Collection
EventListner
set
6. Which of these interface handle sequences?
List
Set
Collection
Comparator
7. Which of these interface must contain a unique element?
Set
List
Collection
Array
8. Which of these is Basic interface that all other interface inherits?
Array
Set
Collection
List
9. Which of these is an incorrect form of using method max() to obtain maximum element?
max(Collection c)
max(Comparator comp)
max(List c)
max(Collection c, Comparator comp)
10. Which of these methods sets every element of a List to a specified object?
fill()
set()
add()
Complete()
11. Which of these methods can randomize all elements in a list?
randomize()
ambigous()
rand()
shuffle()
12. Which of these methods can convert an object into a List?
ConvertList()
singletonList()
CopyList()
SetList()
13. Which of these is true about unmodifiableCollection() method?
unmodifiableCollection() method is available only for List and Set.
unmodifiableCollection() returns a collection that cannot be modified.
unmodifiableCollection() is defined in Collection class.
None
14. Which of these is static variable defined in Collections?
EMPTY_SET
EMPTY_LIST
EMPTY_MAP
All of the above
15. Which of these is used to perform all input & output operations in Java?
classes
Variables
streams
Methods
16. Which of these is a type of stream in Java?
Short stream
Integer stream
Long stream
Byte stream
17. Which of these classes are used by Byte streams for input and output operation?
InputOutputStream
InputStream
Reader
All of the above
18. Which of these classes are used by character streams for input and output operations?
Writer
InputStream
InputOutputStream
ReadStream
19. Which of these class is used to read from byte array?
BufferedInputStream
ArrayInputStream
ByteArrayInputStream
InputStream
20. Which exception is thrown by read() method?
SystemInputException
SystemException
InterruptedException
IOException
21. Which of these is used to read a string from the input stream?
readLine()
get()
getLine()
read()
22. Which of these class is used to read characters and strings in Java from console?
StringReader
BufferedReader
InputStreamReader
BufferedStreamReader
23. Which of these classes are used by Byte streams for input and output operation?
InputStream
InputOutputStream
Reader
All of the above
24. Which of these class is implemented by FilterInputStream class?
BufferedInputStream
FileInputStream
BufferedFileInputStream
InputStream
25. Which of these class contains the methods print() & println()?
System.out
System
PrintStream
BUfferedOutputStream
26. Which of these methods can be used to writing console output?
print()
println()
write()
All of the above
27. Which of these class is used to create an object whose character sequence is mutable?
StringBuffer()
String()
Both of the mentioned
None
28. Which of these method of class StringBuffer is used to reverse sequence of characters?
reverseall()
Reverse()
reverse()
reverseAll()
29. Which of these classes are used by character streams output operations?
Writer
InputStream
ReadStream
InputOutputStream
30. Which of the following statement is correct?
replace() method replaces last occurrence of a character in invoking string with another character.
replace() method replaces first occurrence of a character in invoking string with another character.
reverseall() method reverses all characters.
reverse() method reverses all characters.
31. Which of these packages contain classes and interfaces used for input & output operations of a program
java.io
java.util
java.lang
All of the above
32. Which of these class is not a member class of java.io package?
Writer
String
File
StringReader
33. Which of these interface is not a member of java.io package?
ObjectFilter
DataInput
FileFilter
ObjectInput
34. Which of these class is not related to input and output stream in terms of functioning?
File
Writer
Reader
InputStream
35. Which of these is specified by a File object?
directory path
directory in disk
a file in disk
None
36. Which of these is method for testing whether the specified element is a file or a directory?
Isfile()
isfile()
IsFile()
isFile()
37. Which of these classes is used for input and output operation when working with bytes?
Reader
InputStream
Writer
All of the above
38. Which of these class is used to read and write bytes in a file?
InputStreamReader
FileInputStream
FileWriter
FileReader
39. Which of these method of InputStream is used to read integer representation of next available byte input?
scanf()
read()
get()
getInteger()
40. Which of these data type is returned by every method of OutputStream?
float
int
byte
None of these
41. Which of these is a method to clear all the data present in output buffers?
flush()
clear()
close()
fflush()
42. Which of these is method is used for writing bytes to an outputstream?
print()
put()
printf()
write()
43. Which of these stream contains the classes which can work on character stream?
Character Stream
InputStream
OutputStream
All of the above
44. Which of these class is used to read characters in a file?
FileWriter
FileReader
FileInputStream
InputStreamReader
45. Which of these method of FileReader class is used to read characters from a file?
get()
scanf()
read()
getInteger()
46. Which of these class can be used to implement input stream that uses a character array as the source?
FileReader
CharArrayReader
BufferedReader
FileArrayReader
47. Which of these is a method to clear all the data present in output buffers?
close()
clear()
fflush()
flush()
48. Which of these classes can return more than one character to be returned to input stream?
PushbachReader
BufferedReader
CharArrayReader
Bufferedwriter
49. Which of these standard collection classes implements a dynamic array?
ArrayList
LinkedList
AbstractSet
AbstractList
Submit