Java/Java Mcq Question Set 5 Sample Test,Sample questions

Question:
What is Collection in Java?

1.A group of classes

2.A group of objects

3.A group of interfaces

4.None


Question:
Which exception is thrown by read() method?

1.SystemInputException

2.SystemException

3.InterruptedException

4.IOException


Question:
Which of the following statement is correct?

1.replace() method replaces last occurrence of a character in invoking string with another character.

2.replace() method replaces first occurrence of a character in invoking string with another character.

3.reverseall() method reverses all characters.

4.reverse() method reverses all characters.


Question:
Which of these class can be used to implement input stream that uses a character array as the source?

1.FileReader

2.CharArrayReader

3.BufferedReader

4.FileArrayReader


Question:
Which of these class contains the methods print() & println()?

1.System.out

2.System

3.PrintStream

4.BUfferedOutputStream


Question:
Which of these class is implemented by FilterInputStream class?

1.BufferedInputStream

2.FileInputStream

3.BufferedFileInputStream

4.InputStream


Question:
Which of these class is not a member class of java.io package?

1.Writer

2.String

3.File

4.StringReader


Question:
Which of these class is not related to input and output stream in terms of functioning?

1.File

2.Writer

3.Reader

4.InputStream


Question:
Which of these class is used to create an object whose character sequence is mutable?

1.StringBuffer()

2.String()

3.Both of the mentioned

4.None


Question:
Which of these class is used to read and write bytes in a file?

1.InputStreamReader

2.FileInputStream

3.FileWriter

4.FileReader


Question:
Which of these class is used to read characters and strings in Java from console?

1.StringReader

2.BufferedReader

3.InputStreamReader

4.BufferedStreamReader


Question:
Which of these class is used to read characters in a file?

1.FileWriter

2.FileReader

3.FileInputStream

4.InputStreamReader


Question:
Which of these class is used to read from byte array?

1.BufferedInputStream

2.ArrayInputStream

3.ByteArrayInputStream

4.InputStream


Question:
Which of these classes are used by Byte streams for input and output operation?

1.InputOutputStream

2.InputStream

3.Reader

4.All of the above


Question:
Which of these classes are used by Byte streams for input and output operation?

1.InputStream

2.InputOutputStream

3.Reader

4.All of the above


Question:
Which of these classes are used by character streams for input and output operations?

1.Writer

2.InputStream

3.InputOutputStream

4.ReadStream


Question:
Which of these classes are used by character streams output operations?

1.Writer

2.InputStream

3.ReadStream

4.InputOutputStream


Question:
Which of these classes can return more than one character to be returned to input stream?

1.PushbachReader

2.BufferedReader

3.CharArrayReader

4.Bufferedwriter


Question:
Which of these classes is not part of Java's collection framework?

1.Stack

2.Queue

3.Array

4.Maps


Question:
Which of these classes is used for input and output operation when working with bytes?

1.Reader

2.InputStream

3.Writer

4.All of the above


Question:
Which of these data type is returned by every method of OutputStream?

1.float

2.int

3.byte

4.None of these


Question:
Which of these interface declares core method that all collections will have?

1.Comparator

2.Collection

3.EventListner

4.set


Question:
Which of these interface handle sequences?

1.List

2.Set

3.Collection

4.Comparator


Question:
Which of these interface is not a member of java.io package?

1.ObjectFilter

2.DataInput

3.FileFilter

4.ObjectInput


Question:
Which of these interface is not a part of Java's collection framework?

1.Set

2.List

3.SortedList

4.SortedMap


Question:
Which of these interface is not a part of Java's collection framework?

1.Set

2.List

3.SortedList

4.SortedMap


Question:
Which of these interface must contain a unique element?

1.Set

2.List

3.Collection

4.Array


Question:
Which of these is a method to clear all the data present in output buffers?

1.flush()

2.clear()

3.close()

4.fflush()


Question:
Which of these is a method to clear all the data present in output buffers?

1.close()

2.clear()

3.fflush()

4.flush()


Question:
Which of these is a type of stream in Java?

1.Short stream

2.Integer stream

3.Long stream

4.Byte stream


Question:
Which of these is an incorrect form of using method max() to obtain maximum element?

1.max(Collection c)

2.max(Comparator comp)

3.max(List c)

4.max(Collection c, Comparator comp)


Question:
Which of these is Basic interface that all other interface inherits?

1.Array

2.Set

3.Collection

4.List


Question:
Which of these is method for testing whether the specified element is a file or a directory?

1.Isfile()

2.isfile()

3.IsFile()

4.isFile()


Question:
Which of these is method is used for writing bytes to an outputstream?

1.print()

2.put()

3.printf()

4.write()


Question:
Which of these is specified by a File object?

1.directory path

2.directory in disk

3.a file in disk

4.None


Question:
Which of these is static variable defined in Collections?

1.EMPTY_SET

2.EMPTY_LIST

3.EMPTY_MAP

4.All of the above


Question:
Which of these is true about unmodifiableCollection() method?

1.unmodifiableCollection() method is available only for List and Set.

2.unmodifiableCollection() returns a collection that cannot be modified.

3.unmodifiableCollection() is defined in Collection class.

4.None


Question:
Which of these is used to perform all input & output operations in Java?

1.classes

2.Variables

3.streams

4.Methods


Question:
Which of these is used to read a string from the input stream?

1.readLine()

2.get()

3.getLine()

4.read()


Question:
Which of these method of class StringBuffer is used to reverse sequence of characters?

1.reverseall()

2.Reverse()

3.reverse()

4.reverseAll()


Question:
Which of these method of FileReader class is used to read characters from a file?

1.get()

2.scanf()

3.read()

4.getInteger()


Question:
Which of these method of InputStream is used to read integer representation of next available byte input?

1.scanf()

2.read()

3.get()

4.getInteger()


Question:
Which of these methods can be used to writing console output?

1.print()

2.println()

3.write()

4.All of the above


Question:
Which of these methods can convert an object into a List?

1.ConvertList()

2.singletonList()

3.CopyList()

4.SetList()


Question:
Which of these methods can randomize all elements in a list?

1.randomize()

2.ambigous()

3.rand()

4.shuffle()


Question:
Which of these methods deletes all the elements from invoking collection?

1.delete()

2.refresh()

3.reset()

4.clear()


Question:
Which of these methods sets every element of a List to a specified object?

1.fill()

2.set()

3.add()

4.Complete()


Question:
Which of these packages contain classes and interfaces used for input & output operations of a program

1.java.io

2.java.util

3.java.lang

4.All of the above


Question:
Which of these standard collection classes implements a dynamic array?

1.ArrayList

2.LinkedList

3.AbstractSet

4.AbstractList


Question:
Which of these stream contains the classes which can work on character stream?

1.Character Stream

2.InputStream

3.OutputStream

4.All of the above


More MCQS

  1. Java Mcq Question Set 1
  2. Java Mcq Question Set 2
  3. Java Mcq Question Set 3
  4. Java Mcq Question Set 4
  5. Java Mcq Question Set 5
  6. Java Mcq Question Set 6
  7. Java Mcq Question Set 7
  8. Java Mcq Question Set 8
  9. Java Mcq Question Set 9
  10. Java Multiple Choice Questions
  11. DATA TYPES IN JAVA
  12. Classes ,Constructor ,Methods,Inheritance
  13. Java Multiple Choice Questions.
Search
Olete Team
Online Exam TestTop Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on Online Exam Testwebsite is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!