File Handling MCQ Questions Class 12 Computer Science with Answers

Question: Storage devices of a computer can be broadly classified into_______categories.

  • a) One
  • b) Two
  • c) Three
  • d) Four

Answer: Two

Question: _______storage is temporary.

  • a) Volatile
  • b) Non-volatile
  • c) Movable
  • d) Immovable

Answer: Volatile

Question: In_______storage values stored in variables are lost when a computer is shutdown.

  • a) Volatile
  • b) Non-volatile
  • c) Movable
  • d) Immovable

Answer: Volatile

Question: A Java program that stores a value in a________uses Random Access Memory (RAM).

  • a) Cell
  • b) Program
  • c) Variable
  • d) All of these

Answer: Variable

Question: Apart from variables, objects and their references are generally stored in______

  • a) ROM
  • b) PROM
  • c) RAM
  • d) Hard Disk

Answer: RAM

Question: Once the program terminates or the computer shuts down, the data is________from RAM.

  • a) Stored
  • b) Lost
  • c) Available
  • d) Accessible

Answer: Lost

Question: _______storage is permanent storage.

  • a) Volatile
  • b) Non-volatile
  • c) Movable
  • d) Immovable

Answer: Non-volatile

Question: Data is not_______when a computer loses power in a Non-volatile storage.

  • a) Stored
  • b) Lost
  • c) Available
  • d) Accessible

Answer: Lost

Question: When a Java program is saved on a disk, it is using______storage.

  • a) Temporary
  • b) Provisional
  • c) Conditional
  • d) Permanent

Answer: Permanent

Question: A computer_______is a collection of data stored on a non-volatile device.

  • a) File
  • b) Desktop
  • c) Directory
  • d) Device

Answer: File

Question: _______exist on permanent storage devices, such as hard disks, USB drives, optical disks and compact discs.

  • a) Files
  • b) Manuals
  • c) Directories
  • d) Devices

Answer: Files

Question: Data stored in files is often called_______data.

  • a) Text
  • b) Persistent
  • c) Informative
  • d) Binary

Answer: Persistent

Question: Files can be further classified broadly into_______categories.

  • a) One
  • b) Two
  • c) Three
  • d) Four

Answer: Two

Question: ______files contain data that can be read in a text editor.

  • a) Text
  • b) Manuscript
  • c) Memo
  • d) Binary

Answer: Text

Question: In the_______files the data has been encoded using a scheme such as ASCII or Unicode.

  • a) Text
  • b) Memo
  • c) Informative
  • d) Binary

Answer: Text

Question: ______files can be data files that contain facts, such as payroll file that contains employee numbers, names and salaries.

  • a) Binary
  • b) Memo
  • c) Program
  • d) Text

Answer: Text

Question: Some_______files can be program files or application files mat store software instructions.

  • a) Binary
  • b) Memo
  • c) Program
  • d) Text

Answer: Text

Question: are examples of editors through which text files can be created.

  • a) G edit
  • b) vi
  • c) pico
  • d) All of these

Answer: All of these

Question: The extensions of the files created through the above editor can have an extension like_________

  • a) Text
  • b) Java
  • c) C
  • d) All of these

Answer: All of these

Question: _____files contain data that has not been encoded as text.

  • a) Binary
  • b) Memo
  • c) Informative
  • d) Text

Answer: Binary

Question: The contents of a_______file are in binary format, which means the data is access terms of bytes.

  • a) Binary
  • b) Memo
  • c) Informative
  • d) Text

Answer: Binary

Question: The Binary files extensions examples are_______

  • a) Jpeg
  • b) Mp3
  • c) Class
  • d) All of these

Answer: All of these

Question: Java language supports various operations that can be performed on file or on_______

  • a) Programs
  • b) Attributes
  • c) Directories
  • d) Queries

Answer: Directories

Question: _______operations that can be performed on files using Java programs.

  • a) Determining the path of a file or a directory
  • b) Opening a file
  • c) Writing to a file
  • d) All of these

Answer: All of these

Question: _______operations that can be performed on files using Java programs.

  • a) Reading from a file
  • b) Closing or deleting a file
  • c) Querying the attributes of a file
  • d) All of these

Answer: All of these

Question: Java provides built-in_______that contains methods to help with the tasks related to file.

  • a) Variables
  • b) Packages
  • c) Classes
  • d) Devices

Answer: Classes

Question: The Java classes are present in package.

  • a) Java, bytes
  • b) Java.io
  • c) Java.util
  • d) Java.method

Answer: Java.io

Question: Java uses the concepts of______in file handling.

  • a) File systems
  • b) Streams
  • c) Packages
  • d) Classes

Answer: Streams

Question: Java provides_____different categories of java classes to perform I/O operations on bytes and characters.

  • a) One
  • b) Two
  • c) Three
  • d) Four

Answer: Two

Question: Which of the following is not a Binary file extension ?

  • a) Jpeg
  • b) Mp3
  • c) Class
  • d) txt

Answer: txt

Question: Which of the following is not a Text file extension ?

  • a) Txt
  • b) Java
  • c) Jpeg
  • d) C

Answer: Jpeg

Question: The_______class encapsulates information about the properties of a file or a directory.

  • a) Java.io.file
  • b) Java.oi.file
  • c) Java.util.io
  • d) Java.io.util

Answer: Java.io.file

Question: ________class can be used to access attributes of files and directions.

  • a) File
  • b) I/O
  • c) Java
  • d) util

Answer: File

Question: A programmer can do______a file or a directory.

  • a) Create
  • b) Rename
  • c) Delete
  • d) All of these

Answer: All of these

Question: The creation of a file Object that belongs to_____class does not imply that the file or directory exists.

  • a) File
  • b) I/O
  • c) Java
  • d) Util

Answer: File

Question: The______of a file can also be accessed like its permissions, length of a file or last modification time.

  • a) Features
  • b) Attributes
  • c) Qualities
  • d) Traits

Answer: Attributes

Question: A file________encapsulates a path name or reference to a physical file or a directory on the hard disk.

  • a) Method
  • b) Class
  • c) Object
  • d) Handler

Answer: Object

Question: There are nearly______that can be used to perform various operations on a file or a directory.

  • a) 25 methods
  • b) 30 methods
  • c) 35 methods
  • d) 20 methods

Answer: 30 methods

Question: _______does not provide any method to read from a file or write into a file.

  • a) File class
  • b) File method
  • c) File object
  • d) File operator

Answer: File class

Question: There are several_______classes to perform to read from a file or write into a file.

  • a) File
  • b) Stream
  • c) Package
  • d) Object

Answer: Stream

Question: By using the file class, one can create a______to any file by providing its absolute path in string format or by providing the relative path.

  • a) Location
  • b) Reference
  • c) Stream
  • d) Object

Answer: Reference

Question: The file class provides_______constructors to refer a file or a directory.

  • a) File (String path)
  • b) File (String directory_path, String file_name)
  • c) File (File directory, String file_name)
  • d) All of these

Answer: All of these

Question: In Linux, “password” file is present in_______directory stores the information of the users existing in the system.

  • a) “/etc”
  • b) “/pwd”
  • c) “/file”
  • d) “/dir”

Answer: “/etc”

Question: Suppose one wants to display its attributes, then its Java file object can be created using_______ways.

  • a) One
  • b) Two
  • c) Three
  • d) Four

Answer: Three

Question: _______method of file class returns true if the file or directory exists, otherwise returns false.

  • a) Boolean exists( )
  • b) Boolean is File()
  • c) Boolean is Directory( )
  • d) Boolean is Hidden( )

Answer: Boolean exists( )

Question: ______method of file class returns true if the file exists, otherwise returns false.

  • a) Boolean exists ( )
  • b) Boolean is File( )
  • c) Boolean is Directory( )
  • d) Boolean is Hidden( )

Answer: Boolean is File( )

Question: _____method of file class returns true if the directory exists, otherwise returns false.

  • a) Boolean exists( )
  • b) Boolean is File( )
  • c) Boolean is Directory( )
  • d) Boolean is Hidden( )

Answer: Boolean is Directory( )

Question: _______method of file class returns true if the file or directory is hidden.

  • a) Boolean exists ( )
  • b) Boolean is File( )
  • c) Boolean is Directory( )
  • d) Boolean is Hidden( )

Answer: Boolean is Hidden( )

Question: ______method of file class returns the absolute path of the file exists or directory.

  • a) String[ ] list( )
  • b) String get Path( )
  • c) String get Name( )
  • d) String get Absolute Path()

Answer: String get Absolute Path()

Question: ________method of file class returns the name of the file or directory referred by the object.

  • a) String[ ] list( )
  • b) String get Path( )
  • c) String get Name( )
  • d) String get Absolute Path()

Answer: String get Name( )

Question: _______method of file class returns the path to the file or directory.

  • a) String[ ] Hst( )
  • b) String get Path( )
  • c) String get Name( )
  • d) String get Absolute Path()

Answer: String get Path( )

Question: _______method of file class returns the name of the files and directories in a directory.

  • a) String[ ] list( )
  • b) String get Path( )
  • c) String get Name( )
  • d) String get Absolute Path()

Answer: String[ ] list( )

Question: _______method of file class returns the number of bytes in that file.

  • a) Long length( )
  • b) File[ ] list Files( )
  • c) Both (A) and (B)
  • d) None of these

Answer: Long length( )

Question: ________method of file class returns an array of abstract path names denoting the files in the directory.

  • a) Long length ( )
  • b) File[ ] list Files( )
  • c) Both (A) and (B)
  • d) None of these

Answer: File[ ] list Files( )

Question: ______method to list all the files present in a directory.

  • a) Display()
  • b) List( )
  • c) Dir()
  • d) Files()

Answer: List( )

Question: To modify a file or display the contents of a file, the concept of______has to be understood.

  • a) Files
  • b) Streams
  • c) Packages
  • d) Objects

Answer: Streams

Question: Java uses______classes to carry out read and write operations on files.

  • a) Files
  • b) Streams
  • c) Packages
  • d) Objects

Answer: Streams

Question: ______is an input device.

  • a) Monitor
  • b) Speaker
  • c) Keyboard
  • d) Plotter

Answer: Keyboard

Question: ______is an output device.

  • a) Monitor
  • b) Speaker
  • c) Keyboard
  • d) Plotter

Answer: Monitor

Question: ________can be classified as both input and output device as data can be stored and read from the files.

  • a) Monitor
  • b) Speaker
  • c) Keyboard
  • d) Hard disk

Answer: Hard disk

Question: _________are manufactured by various companies and come with different storage capacities like 500GB or 1 TB.

  • a) Monitor
  • b) Speaker
  • c) Keyboard
  • d) Hard disk

Answer: Hard disk

Question: ______can be connected using different cables like USB or SATA.

  • a) Hard disk
  • b) Scanner
  • c) Printer
  • d) Mouse

Answer: Hard disk

Question: A Java programmer does not need to worry about the technical details like type of______or its capacity while developing a program to perform read / write operations over the files

  • a) Hard disk
  • b) Scanner
  • c) Printer
  • d) Mouse

Answer: Hard disk

Question: The above point is possible because Java language provides functionality of______

  • a) Files
  • b) Streams
  • c) Directories
  • d) Objects

Answer: Streams

Question: A______is an abstract representation of an input or output device that is used as a source or destination for data.

  • a) File
  • b) Directory
  • c) Stream
  • d) Disk

Answer: Stream

Question: Visualize a______as a sequence of bytes that flows into the program or that flows out of the program.

  • a) File
  • b) Directory
  • c) Stream
  • d) Disk

Answer: Stream

Question: One can write data or read data using_______

  • a) Files
  • b) Streams
  • c) Directories
  • d) Objects

Answer: Streams

Question: When data is written to stream, the stream is called an________

  • a) Output stream
  • b) Input stream
  • c) I/O stream
  • d) Both (A) and (B)

Answer: Output stream

Question: The_______can transfer data from the program to a file on a hard disk or a monitor or to some other computer over the network.

  • a) Output stream
  • b) Input stream
  • c) I/O stream
  • d) Both (A) and (B)

Answer: Output stream

Question: An______is used to read data from an external device to the program.

  • a) Output stream
  • b) Input stream
  • c) I/O stream
  • d) Both (A) and (B)

Answer: Input stream

Question: _______can transfer data from keyboard or from the file on a hard disk to the program.

  • a) Output stream
  • b) Input stream
  • c) I/O stream
  • d) Both (A) and (B)

Answer: Input stream

Question: The main reason for using streams for input or output operations is to make our program independent of the_______involved.

  • a) Hard Disks
  • b) Keyboards
  • c) Printers
  • d) Devices

Answer: Devices

Question: _______is advantage of using streams.

  • a) Programmer does not need to worry about the technical details of the device.
  • b) The program can work for a variety of input/ output devices without any changes to the source code.
  • c) Both (A) and (B)
  • d) None of these

Answer: Both (A) and (B)

Question: To understand byte streams and character streams, one needs to differentiate between character and byte______

  • a) Representation
  • b) Collection
  • c) Numbers
  • d) Particulars

Answer: Representation

Question: If ‘5’ is represented as a Character, its ASCII value will be______

  • a) 51
  • b) 52
  • c) 53
  • d) 54

Answer: 53

Question: If 5 is represented as a character, its binary representation will be_______

  • a) 53
  • b) 5
  • c) 101
  • d) 00110101

Answer: 00110101

Question: If ‘5’ is represented as a binary number, then its value will be______

  • a) 53
  • b) 5
  • c) Five
  • d) 101

Answer: 5

Question: If ‘5* is represented as a binary number, then its binary representation will be_______

  • a) 00000101
  • b) 11001100
  • c) 10101100
  • d) 11111000

Answer: 00000101

Question: A character is generally stored using ASCII or Unicode format but when it is used for calculation purpose and then it’s________value is meaningful.

  • a) Binary
  • b) Actual
  • c) Objective
  • d) Text

Answer: Binary

Question: In the statement int i = 32, the_____is true.

  • a) Declares ‘i’ as an integer type variable
  • b) That T stores number 32.
  • c) Both (A) and (B)
  • d) None of these

Answer: Both (A) and (B)

Question: The number 32 can be represented as two separate_______’3′ and ‘2’.

  • a) Numbers
  • b) Values
  • c) Characters
  • d) All of these

Answer: Characters


Discover more from EduGrown School

Subscribe to get the latest posts sent to your email.