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

Posted Date:-2021-10-25 05:26:59


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

1.SystemInputException

2.SystemException

3.InterruptedException

4.IOException

Posted Date:-2021-10-25 05:26:59


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.

Posted Date:-2021-10-25 05:26:59


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

Posted Date:-2021-10-25 05:26:59


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

1.System.out

2.System

3.PrintStream

4.BUfferedOutputStream

Posted Date:-2021-10-25 05:26:59


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

1.BufferedInputStream

2.FileInputStream

3.BufferedFileInputStream

4.InputStream

Posted Date:-2021-10-25 05:26:59


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

1.Writer

2.String

3.File

4.StringReader

Posted Date:-2021-10-25 05:26:59


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

Posted Date:-2021-10-25 05:26:59


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

Posted Date:-2021-10-25 05:26:59


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

1.InputStreamReader

2.FileInputStream

3.FileWriter

4.FileReader

Posted Date:-2021-10-25 05:26:59


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

1.StringReader

2.BufferedReader

3.InputStreamReader

4.BufferedStreamReader

Posted Date:-2021-10-25 05:26:59


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

1.FileWriter

2.FileReader

3.FileInputStream

4.InputStreamReader

Posted Date:-2021-10-25 05:26:59


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

1.BufferedInputStream

2.ArrayInputStream

3.ByteArrayInputStream

4.InputStream

Posted Date:-2021-10-25 05:26:59


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

Posted Date:-2021-10-25 05:26:59


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

Posted Date:-2021-10-25 05:26:59


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

1.Writer

2.InputStream

3.InputOutputStream

4.ReadStream

Posted Date:-2021-10-25 05:26:59


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

1.Writer

2.InputStream

3.ReadStream

4.InputOutputStream

Posted Date:-2021-10-25 05:26:59


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

Posted Date:-2021-10-25 05:26:59


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

1.Stack

2.Queue

3.Array

4.Maps

Posted Date:-2021-10-25 05:26:59


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

Posted Date:-2021-10-25 05:26:59


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

1.float

2.int

3.byte

4.None of these

Posted Date:-2021-10-25 05:26:59


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

1.Comparator

2.Collection

3.EventListner

4.set

Posted Date:-2021-10-25 05:26:59


Question:
Which of these interface handle sequences?

1.List

2.Set

3.Collection

4.Comparator

Posted Date:-2021-10-25 05:26:59


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

1.ObjectFilter

2.DataInput

3.FileFilter

4.ObjectInput

Posted Date:-2021-10-25 05:26:59


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

1.Set

2.List

3.SortedList

4.SortedMap

Posted Date:-2021-10-25 05:26:59


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

1.Set

2.List

3.SortedList

4.SortedMap

Posted Date:-2021-10-25 05:26:59


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

1.Set

2.List

3.Collection

4.Array

Posted Date:-2021-10-25 05:26:59


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

1.flush()

2.clear()

3.close()

4.fflush()

Posted Date:-2021-10-25 05:26:59


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

1.close()

2.clear()

3.fflush()

4.flush()

Posted Date:-2021-10-25 05:26:59


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

1.Short stream

2.Integer stream

3.Long stream

4.Byte stream

Posted Date:-2021-10-25 05:26:59


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)

Posted Date:-2021-10-25 05:26:59


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

1.Array

2.Set

3.Collection

4.List

Posted Date:-2021-10-25 05:26:59


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()

Posted Date:-2021-10-25 05:26:59


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

1.print()

2.put()

3.printf()

4.write()

Posted Date:-2021-10-25 05:26:59


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

1.directory path

2.directory in disk

3.a file in disk

4.None

Posted Date:-2021-10-25 05:26:59


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

1.EMPTY_SET

2.EMPTY_LIST

3.EMPTY_MAP

4.All of the above

Posted Date:-2021-10-25 05:26:59


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

Posted Date:-2021-10-25 05:26:59


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

1.classes

2.Variables

3.streams

4.Methods

Posted Date:-2021-10-25 05:26:59


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

1.readLine()

2.get()

3.getLine()

4.read()

Posted Date:-2021-10-25 05:26:59


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

1.reverseall()

2.Reverse()

3.reverse()

4.reverseAll()

Posted Date:-2021-10-25 05:26:59


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

1.get()

2.scanf()

3.read()

4.getInteger()

Posted Date:-2021-10-25 05:26:59


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()

Posted Date:-2021-10-25 05:26:59


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

1.print()

2.println()

3.write()

4.All of the above

Posted Date:-2021-10-25 05:26:59


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

1.ConvertList()

2.singletonList()

3.CopyList()

4.SetList()

Posted Date:-2021-10-25 05:26:59


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

1.randomize()

2.ambigous()

3.rand()

4.shuffle()

Posted Date:-2021-10-25 05:26:59


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

1.delete()

2.refresh()

3.reset()

4.clear()

Posted Date:-2021-10-25 05:26:59


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

1.fill()

2.set()

3.add()

4.Complete()

Posted Date:-2021-10-25 05:26:59


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

Posted Date:-2021-10-25 05:26:59


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

1.ArrayList

2.LinkedList

3.AbstractSet

4.AbstractList

Posted Date:-2021-10-25 05:26:59


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

Posted Date:-2021-10-25 05:26:59


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
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website 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!