CBSE Class 12 Computer Science File Handling MCQs Set 02

Computer Science Objective Questions and Answers: File Handling

Explore reliable objective questions for File Handling tailored for Class 12 learners. Utilizing these Computer Science multiple-choice formats ensures thorough preparation and strengthens problem-solving speed for upcoming school assessments.

Download File Handling MCQs with Answers

View or download the dedicated File Handling MCQ resource below. Practicing these 50 objective questions regularly builds familiarity with standard exam patterns and helps secure higher marks in final Computer Science evaluations.

Multiple Choice Questions

Question 1: 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
Show Answer & Explanation

Answer: (b) Character

Explanation:

  • Character stream classes handle text data.
  • So the answer is (b) Character.
Question 2: ________stream classes present in java.io package deal with binary data.
(a) Byte
(b) Character
(c) Both (A) and (B)
(d) None of these
Show Answer & Explanation

Answer: (a) Byte

Explanation:

  • Byte stream classes handle binary data such as images.
  • So the answer is (a) Byte.
Question 3: AB StreamClassesC StreamClassesD StreamClassesE StreamClassesFClassesWriterClassesIn the box A, the answer will be________
(a) Stream
(b) Byte
(c) Output
(d) Input
Show Answer & Explanation

Answer: (a) Stream

Explanation:

  • Box A is the top of the tree, which splits into Byte and Character streams.
  • So A stands for Stream.
  • So the answer is (a) Stream.
Question 4: AB StreamClassesC StreamClassesD StreamClassesE StreamClassesFClassesWriterClassesIn the box B, the answer will be_______
(a) Stream
(b) Byte
(c) Output
(d) Input
Show Answer & Explanation

Answer: (b) Byte

Explanation:

  • B is one of the two types of stream, and it splits into Input and Output stream classes.
  • The byte streams have Input and Output classes.
  • So the answer is (b) Byte.
Question 5: AB StreamClassesC StreamClassesD StreamClassesE StreamClassesFClassesWriterClassesIn the box C, the answer will be______
(a) Stream
(b) Byte
(c) Output
(d) Character
Show Answer & Explanation

Answer: (d) Character

Explanation:

  • C is the other type of stream. It splits into Reader and Writer classes.
  • These are the character stream classes.
  • So the answer is (d) Character.
Question 6: AB StreamClassesC StreamClassesD StreamClassesE StreamClassesFClassesWriterClassesIn the box D, the answer will be______
(a) Stream
(b) Input
(c) Output
(d) Character
Show Answer & Explanation

Answer: (b) Input

Explanation:

  • D and E are the two branches under byte streams.
  • D is the one that reads data in: Input.
  • So the answer is (b) Input.
Question 7: AB StreamClassesC StreamClassesD StreamClassesE StreamClassesFClassesWriterClassesIn the box E, the answer will be____
(a) Stream
(b) Byte
(c) Output
(d) Character
Show Answer & Explanation

Answer: (c) Output

Explanation:

  • E is the other branch under byte streams, next to Input.
  • It writes data out: Output.
  • So the answer is (c) Output.
Question 8: AB StreamClassesC StreamClassesD StreamClassesE StreamClassesFClassesWriterClassesIn the box F, the answer will be_______
(a) Reader
(b) Byte
(c) Output
(d) Input
Show Answer & Explanation

Answer: (a) Reader

Explanation:

  • Under character streams the two branches are Reader and Writer.
  • The Writer is already shown, so F is Reader.
  • So the answer is (a) Reader.
Question 9: Java streams can be classified into______basic types.
(a) One
(b) Two
(c) Three
(d) Four
Show Answer & Explanation

Answer: (b) Two

Explanation:

  • Streams are of two types: byte streams and character streams.
  • So the answer is (b) Two.
Question 10: Java streams are namely input stream and_________stream.
(a) Stream
(b) Byte
(c) Output
(d) Character
Show Answer & Explanation

Answer: (c) Output

Explanation:

  • Streams are divided by direction into input and output streams.
  • So the answer is (c) Output.
Question 11: The_________stream reads data from the source (file, keyboard).
(a) Stream
(b) Input
(c) Output
(d) Character
Show Answer & Explanation

Answer: (b) Input

Explanation:

  • An input stream brings data in from a source such as a file or keyboard.
  • So the answer is (b) Input.
Question 12: The_______stream writes data to the destination (file, output device).
(a) Stream
(b) Byte
(c) Output
(d) Character
Show Answer & Explanation

Answer: (c) Output

Explanation:

  • An output stream sends data out to a destination such as a file or screen.
  • So the answer is (c) Output.
Question 13: 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
Show Answer & Explanation

Answer: (a) Java.io

Explanation:

  • The java.io package holds the stream classes for reading and writing files.
  • So the answer is (a) Java.io.
Question 14: _______stream classes are a group of classes available in java.io package.
(a) Input
(b) Byte
(c) Output
(d) Character
Show Answer & Explanation

Answer: (d) Character

Explanation:

  • Character stream classes are in java.io, along with byte stream classes.
  • Among the options, Character fits the group described in the question.
  • So the answer is (d) Character.
Question 15: Character stream classes can be used to read and write________Unicode characters.
(a) 8 bit
(b) 16 bit
(c) 32 bit
(d) 64 bit
Show Answer & Explanation

Answer: (b) 16 bit

Explanation:

  • Java characters are Unicode characters of 16 bits.
  • Character streams read and write 16-bit characters.
  • So the answer is (b) 16 bit.
Question 16: _______stream classes can be further classified into reader and writer classes.
(a) Input
(b) Byte
(c) Output
(d) Character
Show Answer & Explanation

Answer: (d) Character

Explanation:

  • Character streams are further divided into Reader classes and Writer classes.
  • So the answer is (d) Character.
Question 17: ________classes are a group of classes designed to read characters from files.
(a) Writer
(b) Reader
(c) Output
(d) Input
Show Answer & Explanation

Answer: (b) Reader

Explanation:

  • Reader classes are made to read characters from files.
  • So the answer is (b) Reader.
Question 18: The______classes are a group of classes designed to write characters into a file.
(a) Writer
(b) Reader
(c) Character
(d) Byte
Show Answer & Explanation

Answer: (a) Writer

Explanation:

  • Writer classes are made to write characters into a file.
  • So the answer is (a) Writer.
Question 19: Writer classes are inherited from the_______class.
(a) Object
(b) Writer
(c) Reader
(d) Character
Show Answer & Explanation

Answer: (a) Object

Explanation:

  • Every Java class is a child of the Object class.
  • Writer classes also start from Object.
  • So the answer is (a) Object.
Question 20: 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
Show Answer & Explanation

Answer: (b) Abstract

Explanation:

  • An abstract class cannot be used to create an object.
  • Writer is such a class, and its subclasses fill in the methods.
  • So the answer is (b) Abstract.
Question 21: Input Stream Reader and Buffered Reader are the subclass of_______class.
(a) Object
(b) Writer
(c) Reader
(d) Character
Show Answer & Explanation

Answer: (c) Reader

Explanation:

  • InputStreamReader and BufferedReader both read characters.
  • So both are subclasses of Reader.
  • So the answer is (c) Reader.
Question 22: ______class is the subclass of Input Stream Reader class.
(a) File Reader
(b) File Writer
(c) File java
(d) Java File
Show Answer & Explanation

Answer: (a) File Reader

Explanation:

  • FileReader extends InputStreamReader.
  • So the answer is (a) File Reader.
Question 23: Output Stream Writer, Buffered Writer and Print Writer are the sub classes of_______class.
(a) Object
(b) Writer
(c) Reader
(d) Character
Show Answer & Explanation

Answer: (b) Writer

Explanation:

  • OutputStreamWriter, BufferedWriter and PrintWriter all write characters.
  • So all are subclasses of Writer.
  • So the answer is (b) Writer.
Question 24: File Writer class is the_______of Output Stream Writer class.
(a) Super class
(b) Sub.io
(c) Sub class
(d) Base class
Show Answer & Explanation

Answer: (c) Sub class

Explanation:

  • FileWriter extends OutputStreamWriter.
  • So it is a subclass of it.
  • So the answer is (c) Sub class.
Question 25: Writer class is the______for writing a character stream.
(a) Super class
(b) Sub.io
(c) Subclass
(d) Baseclass
Show Answer & Explanation

Answer: (d) Baseclass

Explanation:

  • Writer is the parent class from which the other writer classes are built.
  • So it is the base class.
  • So the answer is (d) Baseclass.
Question 26: The abstract_______class defines the functionality that is available for all character output streams.
(a) Object
(b) Writer
(c) Reader
(d) Character
Show Answer & Explanation

Answer: (b) Writer

Explanation:

  • The abstract Writer class gives the common methods for all character output streams.
  • So the answer is (b) Writer.
Question 27: Methods of______class are used by its sub classes.
(a) Writer
(b) Object
(c) Reader
(d) Character
Show Answer & Explanation

Answer: (a) Writer

Explanation:

  • The subclasses use the methods defined in Writer.
  • So the answer is (a) Writer.
Question 28: The writer method______closes the stream.
(a) Void write (int)
(b) Void close ()
(c) Void write (String s)
(d) All of these
Show Answer & Explanation

Answer: (b) Void close ()

Explanation:

  • close() is the method that closes a stream.
  • So the answer is (b) Void close ().
Question 29: 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
Show Answer & Explanation

Answer: (c) Void write(String s)

Explanation:

  • write(String s) takes a string and writes it to the stream.
  • So the answer is (c) Void write(String s).
Question 30: The writer method________writes the lower 16 bits of 'c' to the stream.
(a) Void write (int C)
(b) Void close()
(c) Void write(String s)
(d) All of these
Show Answer & Explanation

Answer: (a) Void write (int C)

Explanation:

  • write(int c) writes the lower 16 bits of the integer c as a character.
  • So the answer is (a) Void write (int C).
Question 31: The Output Stream_______class extends Writer class.
(a) Writer
(b) Object
(c) Reader
(d) Character
Show Answer & Explanation

Answer: (a) Writer

Explanation:

  • OutputStreamWriter is a subclass of Writer.
  • So the answer is (a) Writer.
Question 32: The_______converts stream of characters to a stream of bytes.
(a) Input Stream
(b) Output Stream
(c) Reader Stream
(d) Writer Stream
Show Answer & Explanation

Answer: (b) Output Stream

Explanation:

  • OutputStreamWriter turns characters into bytes.
  • So the converting stream is the Output Stream.
  • So the answer is (b) Output Stream.
Question 33: The File Writer class extends______Writer and outputs characters to a file.
(a) Input Stream
(b) Output Stream
(c) Reader Stream
(d) Writer Stream
Show Answer & Explanation

Answer: (b) Output Stream

Explanation:

  • FileWriter extends OutputStreamWriter and writes characters to a file.
  • So the answer is (b) Output Stream.
Question 34: 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
Show Answer & Explanation

Answer: (d) All of these

Explanation:

  • FileWriter has all three constructors: with a path, with a File object, and with a path and an append flag.
  • Each of them can throw IOException.
  • So the answer is (d) All of these.
Question 35: 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
Show Answer & Explanation

Answer: (a) File Writer (String file path)

Explanation:

  • Only option (a) is a FileWriter constructor.
  • Option (b) is a FileReader constructor.
  • So the answer is (a) File Writer (String file path).
Question 36: 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
Show Answer & Explanation

Answer: (c) File Writer (String file path, Boolean append)

Explanation:

  • The constructor with a second Boolean argument decides whether to append or overwrite.
  • So the answer is (c) File Writer (String file path, Boolean append).
Question 37: In the following example - an object of_______can be created. File Writer fwobject = new File Writer ("/Java/files/Charfilel.txt");
(a) File Stream
(b) File Writer
(c) File Reader
(d) File Demo
Show Answer & Explanation

Answer: (b) File Writer

Explanation:

  • The statement uses the keyword new with FileWriter.
  • So it creates a FileWriter object.
  • So the answer is (b) File Writer.
Question 38: It is important to close the stream______after writing to a file is accomplished.
(a) Object
(b) Reader
(c) File
(d) Directory
Show Answer & Explanation

Answer: (a) Object

Explanation:

  • The stream object should be closed after writing is finished.
  • So the answer is (a) Object.
Question 39: _______files consume system resources and depending on the file mode.
(a) Closed
(b) Large
(c) Small
(d) Open
Show Answer & Explanation

Answer: (d) Open

Explanation:

  • A file that is left open keeps using system resources.
  • So the answer is (d) Open.
Question 40: ________class is the base class for reading a character stream.
(a) Object
(b) Reader
(c) File
(d) Directory
Show Answer & Explanation

Answer: (b) Reader

Explanation:

  • Reader is the base class for reading a character stream.
  • So the answer is (b) Reader.
Question 41: The abstract_______class defines the functionality that is available for all character input streams.
(a) Object
(b) Reader
(c) File
(d) Directory
Show Answer & Explanation

Answer: (b) Reader

Explanation:

  • The abstract Reader class gives the common methods for all character input streams.
  • So the answer is (b) Reader.
Question 42: ______class should be used in program to perform read operations.
(a) File Stream
(b) File Writer
(c) File Reader
(d) File Demo
Show Answer & Explanation

Answer: (c) File Reader

Explanation:

  • FileReader is the class for reading from a file.
  • So the answer is (c) File Reader.
Question 43: _________method of Reader class closes the stream.
(a) Void close()
(b) Int read()
(c) Void read()
(d) None of these
Show Answer & Explanation

Answer: (a) Void close()

Explanation:

  • close() closes the stream.
  • So the answer is (a) Void close().
Question 44: ________method of Reader class, reads next available character from the stream, it returns "-1" to indicate the end of stream.
(a) Void close()
(b) Int read()
(c) Void read()
(d) None of these
Show Answer & Explanation

Answer: (b) Int read()

Explanation:

  • read() returns the next character, or -1 when the stream ends.
  • So the answer is (b) Int read().
Question 45: The Input Stream Reader class extends______class.
(a) Stream
(b) Writer
(c) Reader
(d) Demo
Show Answer & Explanation

Answer: (c) Reader

Explanation:

  • InputStreamReader is a subclass of Reader.
  • So the answer is (c) Reader.
Question 46: _______class converts a stream of bytes to a stream of characters.
(a) Stream
(b) Writer
(c) Reader
(d) Demo
Show Answer & Explanation

Answer: (c) Reader

Explanation:

  • InputStreamReader converts bytes to characters.
  • It is a Reader class.
  • So the answer is (c) Reader.
Question 47: 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
Show Answer & Explanation

Answer: (c) File Reader

Explanation:

  • FileReader extends InputStreamReader and reads characters from a file.
  • So the answer is (c) File Reader.
Question 48: 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
Show Answer & Explanation

Answer: (c) Both (A) and (B)

Explanation:

  • FileReader can be made with a file path or with a File object.
  • So both (A) and (B) are correct.
  • So the answer is (c) Both (A) and (B).
Question 49: 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)
Show Answer & Explanation

Answer: (d) File Reader(int i, int j)

Explanation:

  • The first three options are real FileReader constructor choices.
  • There is no constructor that takes two int values.
  • So the answer is (d) File Reader(int i, int j).
Question 50: In the following example - an object of_______can be created. File Reader frobject = new File Reader ("/Java/files/Charfflel.txt");
(a) File Reader
(b) File Writer
(c) Both (A) and (B)
(d) File Demo
Show Answer & Explanation

Answer: (a) File Reader

Explanation:

  • The statement uses new File Reader, so it creates a FileReader object.
  • So the answer is (a) File Reader.
Question 51: While reading from a file,______must identify that the file has ended.
(a) Program
(b) Code
(c) Class
(d) Method
Show Answer & Explanation

Answer: (a) Program

Explanation:

  • A program has to check for the end of the file while reading.
  • So the answer is (a) Program.
Question 52: The Java_______method returns "-1" to identify the end of data in the stream.
(a) Close()
(b) Read()
(c) Print()
(d) Write()
Show Answer & Explanation

Answer: (b) Read()

Explanation:

  • read() returns -1 when no more data is left.
  • So the answer is (b) Read().
Question 53: The______and_______classes in the java.io package, gives the ability to read and write from and into files in the disk.
(a) File Input Stream
(b) File Output Stream
(c) File Reader Stream
(d) Both (A) and (B)
Show Answer & Explanation

Answer: (d) Both (A) and (B)

Explanation:

  • FileInputStream reads and FileOutputStream writes files in the disk.
  • So both (A) and (B) are right.
  • So the answer is (d) Both (A) and (B).
Question 54: 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)
Show Answer & Explanation

Answer: (d) Both (B) and (C)

Explanation:

  • FileInputStream is a subclass of InputStream.
  • FileOutputStream is a subclass of OutputStream.
  • So the answer is (d) Both (B) and (C).
Question 55: 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 (C)
Show Answer & Explanation

Answer: (c) Output Stream

Explanation:

  • A stream that writes bytes to a file is FileOutputStream, a subclass of OutputStream.
  • So the answer is (c) Output Stream.
Question 56: _______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()
Show Answer & Explanation

Answer: (b) Void close ()

Explanation:

  • close() closes the stream and frees the resources.
  • So the answer is (b) Void close ().
Question 57: ________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) Void read()
Show Answer & Explanation

Answer: (a) Void write (int b)

Explanation:

  • write(int b) writes one byte to the stream.
  • So the answer is (a) Void write (int b).
Question 58: ______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) Void read()
Show Answer & Explanation

Answer: (c) Void write (byte [] b)

Explanation:

  • write(byte[] b) writes all b.length bytes of the array.
  • So the answer is (c) Void write (byte [] b).
Question 59: 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 Input Stream
(c) File Reader Stream
(d) File Constructor
Show Answer & Explanation

Answer: (a) File Output Stream

Explanation:

  • FileOutputStream constructors take either a path string or a File object.
  • So the answer is (a) File Output Stream.
Question 60: 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
Show Answer & Explanation

Answer: (b) File Not Found Exception

Explanation:

  • If the file cannot be opened, FileNotFoundException is thrown.
  • So the answer is (b) File Not Found Exception.
Question 61: 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
Show Answer & Explanation

Answer: (a) File Not Found Exception

Explanation:

  • The File-object form also throws FileNotFoundException.
  • So the answer is (a) File Not Found Exception.
Question 62: The following example will create an instance of________FileOutputStream fosobject = new File Output Stream ("/home/Akash/myfile.txt");
(a) File Output Stream
(b) File Input Stream
(c) File Reader Stream
(d) File Constructor
Show Answer & Explanation

Answer: (a) File Output Stream

Explanation:

  • The statement creates a new FileOutputStream object.
  • So the answer is (a) File Output Stream.
Question 63: The_______is a subclass of Input Stream and is generally used to read byte data from the files.
(a) File Input Stream
(b) File Reader Stream
(c) File Writer Stream
(d) File Output Stream
Show Answer & Explanation

Answer: (a) File Input Stream

Explanation:

  • A stream that reads bytes from a file is FileInputStream, a subclass of InputStream.
  • FileOutputStream writes data, so it does not fit.
  • So the answer is (a) File Input Stream.
Question 64: ______method of File Input 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()
Show Answer & Explanation

Answer: (c) Int read( )

Explanation:

  • read() with no argument reads one byte.
  • So the answer is (c) Int read( ).
Question 65: _______method of File Input 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()
Show Answer & Explanation

Answer: (a) Void close( )

Explanation:

  • close() closes the stream and frees the resources.
  • So the answer is (a) Void close( ).
Question 66: ______method of FileInputStream 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()
Show Answer & Explanation

Answer: (b) Int read(byte[] b)

Explanation:

  • read(byte[] b) reads up to b.length bytes into the array.
  • So the answer is (b) Int read(byte[] b).
Question 67: 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
Show Answer & Explanation

Answer: (a) Program

Explanation:

  • A program can take input from the keyboard, GUI, command line or files.
  • So the answer is (a) Program.
Question 68: _______class belongs to the java.util package.
(a) Printer
(b) Console
(c) Scanner
(d) Keyboard
Show Answer & Explanation

Answer: (c) Scanner

Explanation:

  • The Scanner class is in the java.util package.
  • Console is in java.io, and there is no Keyboard class in java.util.
  • So the answer is (c) Scanner.
Question 69: It provides various methods to read input from the______or from the file.
(a) Printer
(b) Console
(c) Scanner
(d) Keyboard
Show Answer & Explanation

Answer: (d) Keyboard

Explanation:

  • The sentence says the class reads input from a source, either the keyboard or a file.
  • Scanner cannot be its own source, so the keyboard fits.
  • So the answer is (d) Keyboard.
Question 70: 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
Show Answer & Explanation

Answer: (a) Delimiter

Explanation:

  • The Scanner class splits the input into tokens using a delimiter.
  • So the answer is (a) Delimiter.
Question 71: _____is the default delimiter.
(a) Delimiter
(b) Printer
(c) Console
(d) White space
Show Answer & Explanation

Answer: (d) White space

Explanation:

  • The default delimiter is white space.
  • So the answer is (d) White space.
Question 72: 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
Show Answer & Explanation

Answer: (b) Token

Explanation:

  • The pieces the input is broken into are called tokens.
  • So the answer is (b) Token.
Question 73: 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)
Show Answer & Explanation

Answer: (d) Scanner(Files i)

Explanation:

  • Scanner has constructors for a String, an InputStream and a File.
  • Scanner(Files i) is not one of them.
  • So the answer is (d) Scanner(Files i).
Question 74: A______object can be created from a string, file object or Input Stream object.
(a) Printer
(b) Console
(c) Scanner
(d) Keyboard
Show Answer & Explanation

Answer: (c) Scanner

Explanation:

  • A Scanner object can be created from a string, a File or an InputStream.
  • So the answer is (c) Scanner.
Question 75: The method______of Scanner class closes the Scanner.
(a) Void close ()
(b) String next()
(c) Boolean hasNext()
(d) int nextInt()
Show Answer & Explanation

Answer: (a) Void close ()

Explanation:

  • close() closes the Scanner.
  • So the answer is (a) Void close ().
Question 76: The method_____of Scanner class returns the next token.
(a) Void close()
(b) String next()
(c) Boolean hasNext()
(d) int nextInt()
Show Answer & Explanation

Answer: (b) String next()

Explanation:

  • next() returns the next token as a String.
  • So the answer is (b) String next().
Question 77: The method______of Scanner class returns true if there is a token in input.
(a) Void close()
(b) String next()
(c) Boolean hasNext()
(d) int nextInt()
Show Answer & Explanation

Answer: (c) Boolean hasNext()

Explanation:

  • hasNext() returns true if another token is available.
  • So the answer is (c) Boolean hasNext().
Question 78: The method_______of Scanner class scans the next token of the input as Int.
(a) Void close()
(b) String next()
(c) Boolean hasNext()
(d) int nextInt()
Show Answer & Explanation

Answer: (d) int nextInt()

Explanation:

  • nextInt() reads the next token as an int.
  • So the answer is (d) int nextInt().
Question 79: The method______of Scanner class scans the next token of the input as Float.
(a) Float nextFloat( )
(b) String next()
(c) Boolean hasNext()
(d) int nextInt()
Show Answer & Explanation

Answer: (a) Float nextFloat( )

Explanation:

  • nextFloat() reads the next token as a float.
  • So the answer is (a) Float nextFloat( ).
Question 80: The method_______of Scanner class scans the next token of the input as Line.
(a) Float nextFloat( )
(b) String next()
(c) Boolean hasNext()
(d) String nextLine( )
Show Answer & Explanation

Answer: (d) String nextLine( )

Explanation:

  • nextLine() reads the next line of input.
  • So the answer is (d) String nextLine( ).
Question 81: _______class can also be used to read from a file.
(a) Printer
(b) Console
(c) Scanner
(d) Keyboard
Show Answer & Explanation

Answer: (c) Scanner

Explanation:

  • Scanner can read from a file when given a File object.
  • So the answer is (c) Scanner.
Question 82: 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
Show Answer & Explanation

Answer: (b) Console

Explanation:

  • The Console class is used when typed characters must not be shown on screen.
  • So the answer is (b) Console.
Question 83: The______class provides a method for reading password.
(a) Printer
(b) Console
(c) Scanner
(d) Keyboard
Show Answer & Explanation

Answer: (b) Console

Explanation:

  • The Console class has the readPassword() method.
  • So the answer is (b) Console.
Question 84: The Console class belongs to______package.
(a) Java.io
(b) Java.util
(c) Java.class
(d) Java.console
Show Answer & Explanation

Answer: (a) Java.io

Explanation:

  • The Console class is in the java.io package.
  • So the answer is (a) Java.io.
Question 85: ________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 readLine( )
(b) Char[ ] readPassword()
(c) Console printf(String format, Object args)
(d) None of these
Show Answer & Explanation

Answer: (c) Console printf(String format, Object args)

Explanation:

  • printf() writes a formatted string to the console output.
  • So the answer is (c) Console printf(String format, Object args).
Question 86: _______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
Show Answer & Explanation

Answer: (a) String readLine( )

Explanation:

  • readLine() reads one line of text from the console.
  • So the answer is (a) String readLine( ).
Question 87: _______method of Console class reads a password or passphrase from the console with echoing disabled.
(a) String readLine()
(b) Char[ ] readPassword()
(c) Console printf(String format, Object args)
(d) None of these
Show Answer & Explanation

Answer: (b) Char[ ] readPassword()

Explanation:

  • readPassword() reads a password without showing the typed characters.
  • So the answer is (b) Char[ ] readPassword().
Question 88: 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
Show Answer & Explanation

Answer: (a) Read from a file

Explanation:

  • Scanner is used to read from a file.
  • The other options are not clearly named uses of Scanner.
  • So the answer is (a) Read from a file.
Question 89: 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[ ]);
Show Answer & Explanation

Answer: (c) Public static void main(String args[ ])

Explanation:

  • The main method is written as public static void main(String args[]).
  • Option (c) has the correct parameter, with no extra semicolon.
  • So the answer is (c) Public static void main(String args[ ]).
Question 90: The_______class provides a method for reading password.
(a) Printer
(b) Console
(c) Scanner
(d) Keyboard
Show Answer & Explanation

Answer: (b) Console

Explanation:

  • The Console class has the readPassword() method.
  • So the answer is (b) Console.

Download Chapter MCQs: Class 12 Computer Science File Handling

Chapter MCQs with Answers for Class 12 Computer Science

Explore reliable practice questions for File Handling tailored for Class 12 Computer Science learners. Use these multiple-choice formats to evaluate preparedness and strengthen problem-solving skills.

Expert Practice Material for Class 12 Computer Science

Built using the official NCERT book for Class 12, these Computer Science objective sets provide reliable academic guidance. Pair your practice with our recommended NCERT solutions to master optimal problem-solving approaches.

Complete Your Chapter Revision

Follow up your worksheet practice by attempting the interactive online Computer Science MCQ test for this chapter to evaluate your execution speed. All platform resources are free to access.

FAQs

Where can I access latest CBSE Class 12 Computer Science File Handling MCQs Set 02?

You can get most exhaustive CBSE Class 12 Computer Science File Handling MCQs Set 02 for free on StudiesToday.com. These MCQs for Class 12 Computer Science are updated for the 2026-27 academic session as per CBSE examination standards.

Are Assertion-Reasoning and Case-Study MCQs included in the Computer Science Class 12 material?

Yes, our CBSE Class 12 Computer Science File Handling MCQs Set 02 include the latest type of questions, such as Assertion-Reasoning and Case-based MCQs. 50% of the CBSE paper is now competency-based.

How do practicing Computer Science MCQs help in scoring full marks in Class 12 exams?

By solving our CBSE Class 12 Computer Science File Handling MCQs Set 02, Class 12 students can improve their accuracy and speed which is important as objective questions provide a chance to secure 100% marks in the Computer Science.

Do you provide answers and explanations for CBSE Class 12 Computer Science File Handling MCQs Set 02?

Yes, Computer Science MCQs for Class 12 have answer key and brief explanations to help students understand logic behind the correct option as its important for 2026 competency-focused CBSE exams.

Can I practice these Computer Science Class 12 MCQs online?

Yes, you can also access online interactive tests for CBSE Class 12 Computer Science File Handling MCQs Set 02 on StudiesToday.com as they provide instant answers and score to help you track your progress in Computer Science.