MCQ for Class 12 Computer Science File Handling
Class 12 Computer Science students should refer to the following multiple-choice questions with answers for File Handling in standard 12. These MCQ questions with answers for Grade 12 Computer Science will come in exams and help you to score good marks
File Handling MCQ Questions Class 12 Computer Science with Answers
Question: Character Stream classes are present in java.io package deal with the_______/ text data.
a) Byte
b) Character
c) Both (A) and (B)
d) None of these
Answer: Character
Question: ________stream classes present in java.io package deal with binary data.
a) Byte
b) Character
c) Both (A) and (B)
d) None of these
Answer: Byte
Question:
In the box A, the answer will be________
a) Stream
b) Byte
c) Output
d) Input
Answer: Stream
Question:
In the box B, the answer will be_______
a) Stream
b) Byte
c) Output
d) Input
Answer: Byte
Question:
In the box C, the answer will be______
a) Stream
b) Byte
c) Output
d) Character
Answer: Character
Question:
In the box D, the answer will be______
a) Stream
b) Input
c) Output
d) Character
Answer: Input
Question:
In the box E, the answer will be____
a) Stream
b) Byte
c) Output
d) Character
Answer: Output
Question:
In the box F, the answer will be_______
a) Reader
b) Byte
c) Output
d) Input
Answer: Reader
Question: Java streams can be classified into______basic types.
a) One
b) Two
c) Three
d) Four
Answer: Two
Question: Java streams are namely input stream and_________stream.
a) Stream
b) Byte
c) Output
d) Character
Answer: Output
Question: The_________stream reads data from the source (file, keyboard).
a) Stream
b) Input
c) Output
d) Character
Answer: Input
Question: The_______stream writes data to the destination (file, output device).
a) Stream
b) Byte
c) Output
d) Character
Answer: Output
Question: The______package contains a collection of stream classes that support reading and writing in a file.
a) Java.io
b) Java.util
c) Java.package
d) All of these
Answer: Java.io
Question: _______stream classes are a group of classes available in java.io package.
a) Input
b) Byte
c) Output
d) Character
Answer: Character
Question: Character stream classes can be used to read and write________Unicode characters.
a) 8 bit
b) 16 bit
c) 32 bit
d) 64 bit
Answer: 16 bit
Question: _______stream classes can be further classified into reader and writer classes.
a) Input
b) Byte
c) Output
d) Character
Answer: Character
Question: ________classes are a group of classes designed to read characters from files.
a) Writer
b) Reader
c) Output
d) Input
Answer: Reader
Question: The______classes are a group of classes designed to write characters into a file.
a) Writer
b) Reader
c) Character
d) Byte
Answer: Writer
Question: Writer classes are inherited from the_______class.
a) Object
b) Writer
c) Reader
d) Character
Answer: Object
Question: Writer classes are______classes (classes that cannot be used to create an object) and come with set of methods to be implemented by its sub classes.
a) Intellectual
b) Abstract
c) Byte
d) Java.io
Answer: Abstract
Question: Input Stream Reader and Buffered Reader are the subclass of_______class.
a) Object
b) Writer
c) Reader
d) Character
Answer: Reader
Question: ______class is the subclass of Input Stream Reader class.
a) File Reader
b) File Writer
c) File java
d) Java File
Answer: File Reader
Question: Output Stream Writer, Buffered Writer and Print Writer are the sub classes of_______class.
a) Object
b) Writer
c) Reader
d) Character
Answer: Writer
Question: File Writer class is the_______of Output Stream Writer class.
a) Super class
b) Sub.io
c) Sub class
d) Base class
Answer: Sub class
Question: Writer class is the______for writing a character stream.
a) Super class
b) Sub.io
c) Subclass
d) Baseclass
Answer: Baseclass
Question: The abstract_______class defines the functionality that is available for all character output streams.
a) Object
b) Writer
c) Reader
d) Character
Answer: Writer
Question: Methods of______class are used by its sub classes.
a) Writer
b) Object
c) Reader
d) Character
Answer: Writer
Question: The writer method______closes the stream.
a) Void write (int)
b) Void close ()
c) Void write (Strings)
d) All of these
Answer: Void close ()
Question: The writer method_______writes string 's' to the stream.
a) Void write (int C)
b) Void close ()
c) Void write(String s)
d) All of these
Answer: Void write(String s)
Question: The writer method________writes the lower 16 bits of 'c' to the stream.
a) Void write (int C)
b) Void close 0
c) Void write(String s)
d) All of these
Answer: Void write (int C)
Question: The Output Stream_______class extends Writer class.
a) Writer
b) Object
c) Reader
d) Character
Answer: Writer
Question: The_______converts stream of characters to a stream of bytes.
a) Input Stream
b) Output Stream
c) Reader Stream
d) Writer Stream
Answer: Output Stream
Question: The File Writer class extends______Writer and outputs characters to a file.
a) Input Stream
b) Output Stream
c) Reader Stream
d) Writer Stream
Answer: Output Stream
Question: The File Writer class has________constructor which throws IO Exception
a) File Writer (String file path)
b) File Writer (File file obj)
c) File Writer (String file path, Boolean append)
d) All of these
Answer: All of these
Question: Which of the following constructor is of File Writer Class ?
a) File Writer (String file path)
b) File Reader (File file obj)
c) File Writer constructor
d) All of these
Answer: File Writer (String file path)
Question: In the constructor "__________", if append is true, characters are appended to the end of file, otherwise the existing contents of the file are overwritten.
a) File Writer (String file path)
b) File Writer (File file obj)
c) File Writer (String file path, Boolean append)
d) None of these
Answer: File Writer (String file path, Boolean append)
Question: In the following example - an object of_______can be created. File Writerfwobject = new File Writer ("/Java/files/Charfilel.txt");
a) File Stream
b) File Writer
c) File Reader
d) File Demo
Answer: File Writer
Question: It is important to close the stream______after writing to a file is accomplished.
a) Object
b) Reader
c) File
d) Directory
Answer: Object
Question: _______files consume system resources and depending on the file mode.
a) Closed
b) Large
c) Small
d) Open
Answer: Open
Question: ________class is the base class for reading a character stream.
a) Object
b) Reader
c) File
d) Directory
Answer: Reader
Question: The abstract_______class defines the functionality that is available for all character input streams.
a) Object
b) Reader
c) File
d) Directory
Answer: Reader
Question: ______class should be used in program to perform read operations.
a) File Stream
b) File Writer
c) File Reader
d) File Demo
Answer: File Reader
Question: _________method of Reader class closes the stream.
a) Void close()
b) Int read()
c) Void read()
d) None of these
Answer: Void close()
Question: ________method of Reader class, reads next available character from the stream, it returns "-1" to indicate the end of stream.
a) Void close 0
b) Int read()
c) Void read()
d) None of these
Answer: Int read()
Question: The Input Stream Reader class extends______class.
a) Stream
b) Writer
c) Reader
d) Demo
Answer: Reader
Question: _______class converts a stream of bytes to a stream of characters.
a) Stream
b) Writer
c) Reader
d) Demo
Answer: Reader
Question: The_______class extends Input Stream Reader class and reads characters from a file.
a) File Stream
b) File Writer
c) File Reader
d) File Demo
Answer: File Reader
Question: Which of the following is a File Reader constructor ?
a) File Reader (String file path)
b) File Reader (File file obj)
c) Both (A) and (B)
d) None of these
Answer: Both (A) and (B)
Question: Which of the following is not a File Reader constructor ?
a) File Reader (String file path)
b) File Reader (File file obj)
c) Both (A) and (B)
d) File Reader(int i, int j)
Answer: File Reader(int i, int j)
Question: In the following example - an object of_______can be created. File Reader frobject = new File Reader ("/Java/flles/Charfflel.txt");
a) File Reader
b) File Writer
c) Both (A) and (B)
d) File Demo
Answer: File Reader
Question: While reading from a file,______must identify that the file has ended.
a) Program
b) Code
c) Class
d) Method
Answer: Program
Question: The Java_______method returns "-1" to identify the end of data in the stream.
a) Close()
b) Read()
c) Print()
d) Write()
Answer: Read()
Question: The______and_______classes in the java.io package, gives the ability to read and write from and into files in the disk.
a) File lnput Stream
b) File Output Stream
c) File Reader Stream
d) Both (A) and (B)
Answer: Both (A) and (B)
Question: The above mentioned streams are the sub classes of______and______classes.
a) Reader Stream
b) Input Stream
c) Output Stream
d) Both (B) and (C)
Answer: Both (B) and (C)
Question: The file_______is a subclass of Output Stream and is used to write bytes to the file or some output stream.
a) Reader Stream
b) Input Stream
c) Output Stream
d) Both (B) and (Q
Answer: Output Stream
Question: _______method of File Output Stream class closes the file output stream and releases any system resources associated with the stream.
a) Void write (int b)
b) Void close ()
c) Void write (byte [] b)
d) Void read()
Answer: Void close ()
Question: ________method of File Output Stream class writes the specified byte to this file output stream.
a) Void write (int b)
b) Void close ()
c) Void write (byte [] b)
d) Voidread()
Answer: Void write (int b)
Question: ______method of File Output Stream class writes b.length bytes from the specified byte array to this file output stream.
a) Void write(int b)
b) Void close()
c) Void write (byte [] b)
d) Voidread()
Answer: Void write (byte [] b)
Question: The constructors of_______can accept either a string containing the path to the file location or an object of the file class.
a) File Output Stream
b) File lnput Stream
c) File Reader Stream
d) File Constructor
Answer: File Output Stream
Question: The constructor File Output Stream (String name) throws________
a) File Out of Bounds Exception
b) File Not Found Exception
c) File Found Exception
d) None of these
Answer: File Not Found Exception
Question: The constructor File Output Stream (File file) throws_______
a) File Not Found Exception
b) File Out of Bounds Exception
c) File Found Exception
d) None of these
Answer: File Not Found Exception
Question: The following example will create an instance of________FileOutputStreamfosobject = new File Output Stream ("/home/Akash/myflle.txt");
a) File Output Stream
b) File lnput Stream
c) File Reader Stream
d) File Constructor
Answer: File Output Stream
Question: The_______is a subclass of Input Stream and is generally used to read byte data from the files.
a) File lnput Stream
b) File Reader Stream
c) File Writer Stream
d) File Output Stream
Answer: File Output Stream
Question: ______method of File lnput Stream class reads a byte of data from this input stream.
a) Void close( )
b) Int read(byte[] b)
c) Int read( )
d) Void write()
Answer: Int read( )
Question: _______method of File lnput Stream class closes the file input stream and releases any system resources associated with the stream.
a) Void close( )
b) Int read(byte[] b)
c) Int read( )
d) Void write()
Answer: Void close( )
Question: ______method of FilelnputStream class reads up to b.length bytes of data from this input stream into an array of bytes.
a) Void close( )
b) Int read(byte[] b)
c) Int read( )
d) Void write()
Answer: Int read(byte[] b)
Question: A_______can get input from live interaction through keyboard / GUI or it may take input as command line arguments or from the files.
a) Program
b) Code
c) Class
d) Method
Answer: Program
Question: _______class belongs to the java.util package.
a) Printer
b) Console
c) Scanner
d) Keyboard
Answer: Keyboard
Question: It provides various methods to read input from the______or from the file.
a) Printer
b) Console
c) Scanner
d) Keyboard
Answer: Scanner
Question: A special feature of this class is that it breaks the input string into tokens (words) using a______
a) Delimiter
b) Printer
c) Console
d) White space
Answer: Delimiter
Question: _____is the default delimiter.
a) Delimiter
b) Printer
c) Console
d) White space
Answer: White space
Question: Each______can be of different type, for example a string like "India-1947" can also be read as "String-int" values.
a) Symbol
b) Token
c) Word
d) Mark
Answer: Token
Question: Which of the following is not a Scanner related constructor or method ?
a) Scanner (String str)
b) Scanner (Input Stream isobject)
c) Scanner (File fobject)
d) Scanner(Files i)
Answer: Scanner(Files i)
Question: A______object can be created from a string, file object or Input Stream object.
a) Printer
b) Console
c) Scanner
d) Keyboard
Answer: Scanner
Question: The method______of Scanner class closes the Scanner.
a) Void close ()
b) String next()
c) Boolean has Next()
d) int nextlnt()
Answer: Void close ()
Question: The method_____of Scanner class returns the next token.
a) Void close()
b) String next()
c) Boolean hasNext()
d) int nextlnt()
Answer: String next()
Question: The method______of Scanner class returns true if there is a token in input.
a) Void close()
b) String next()
c) Boolean has Next()
d) int nextlnt()
Answer: Boolean has Next()
Question: The method_______of Scanner class scans the next token of the input as Int.
a) Void close 0
b) String next()
c) Boolean has Next()
d) int nextlnt()
Answer: int nextlnt()
Question: The method______of Scanner class scans the next token of the input as Float.
a) Float next Float( )
b) String next()
c) Boolean has Next()
d) int nextlnt()
Answer: Float next Float( )
Question: The method_______of Scanner class scans the next token of the input as Line.
a) Float next Float( )
b) String next()
c) Boolean has Next()
d) String next Line( )
Answer: String next Line( )
Question: _______class can also be used to read from a file.
a) Printer
b) Console
c) Scanner
d) Keyboard
Answer: Scanner
Question: The_______class is especially used when the input is to be types in hidden form (characters must not be echoed on the screen).
a) Printer
b) Console
c) Scanner
d) Keyboard
Answer: Console
Question: The______class provides a method for reading password.
a) Printer
b) Console
c) Scanner
d) Keyboard
Answer: Console
Question: The Console class belongs to______package.
a) Java.io
b) Java.util
c) Java.class
d) Java.console
Answer: Java.io
Question: ________method of Console class is used to write a formatted string to this console's output stream using the specified format string and arguments.
a) String read Line( )
b) Char[ ] read Password()
c) Console printf(String format, Object args)
d) None of these
Answer: Console printf(String format, Object args)
Question: _______method of Console class reads a single line of text from the console.
a) String readLine( )
b) Char[ ] readPassword()
c) Console printf(String format, Object args)
d) None of these
Answer: String readLine( )
Question: _______method of Console class reads a password or passphrase from the console with echoing disabled.
a) String read Line()
b) Char[ ] read Password()
c) Console printf(String format, Object args)
d) None of these
Answer: Char[ ] read Password()
Question: Scanner class is used for performing which of the following operations ?
a) Read from a file
b) Navigate through a file
c) Scan a file
d) All of these
Answer: Read from a file
Question: Which of the following is correct syntax ?
a) Public static void main (String args[ ])
b) Public static void main (String args)
c) Public static void main(String args[ ])
d) Public static void main(String args[ ]);
Answer: Public static void main(String args[ ])
Question: The_______class provides a method for reading password.
a) Printer
b) Console
c) Scanner
d) Keyboard
Answer: Console
Books recommended by teachers
CBSE Class 12 Computer Science Cascading Style Sheets and JavaScript MCQs |
CBSE Class 12 Computer Science Classes and Objects In Java MCQs Set A |
CBSE Class 12 Computer Science Classes and Objects In Java MCQs Set B |
CBSE Class 12 Computer Science Creating HTML Forms Using KompoZer MCQs Set A |
CBSE Class 12 Computer Science Creating HTML Forms Using KompoZer MCQs Set B |
CBSE Class 12 Computer Science Designing Simple Website Using Kompozer MCQs |
CBSE Class 12 Computer Science Exception Handling In Java MCQs |
CBSE Class 12 Computer Science File Handling MCQs Set A |
CBSE Class 12 Computer Science File Handling MCQs Set B |
CBSE Class 12 Computer Science File System MCQs Set A |
CBSE Class 12 Computer Science File System MCQs Set B |
CBSE Class 12 Computer Science Introduction To E Commerce MCQs |
CBSE Class 12 Computer Science Introduction To M Commerce MCQs Set A |
CBSE Class 12 Computer Science Introduction To M Commerce MCQs Set B |
CBSE Class 12 Computer Science Java Basics MCQs Set A |
CBSE Class 12 Computer Science Java Basics MCQs Set B |
CBSE Class 12 Computer Science Object Oriented Concepts MCQs |