0% found this document useful (0 votes)
5 views5 pages

Chap 11pdf

Uploaded by

ap0740772
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views5 pages

Chap 11pdf

Uploaded by

ap0740772
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Chapter 11 File Handling

(Std. 12th E.M.)


Textbook Exercise
(1) Which of the following statements is true?
(A) Volatile storage lasts only a few seconds.
(B) Volatile storage is lost when a computer is shutdown.
(C) Computer disks are volatile storage devices.
(D) All of these
(2) Which of the following refers to a collection of data stored on a non-volatile device in a
Computer system?
(A) File (B) application (C) volatile data (D) hard disk
(3) The data hierarchy occurs in which of the following order from the smallest to largest?
(A) file : character : field : record (B) file : character : record : field
(C) character : field : file : record (D) character : field : record : file
(4) Which of the following is true about streams?
(A) Streams always flow in two directions
(B) Streams are channels through which the data flow
(C) Only one stream can be open in a program at a time.
(D) All of these
(5) Which of the following is used as a separator between fields of a record?
(A) Path (B) delimiter (C) variable (D) space
(6) Scanner class can be used to for performing which of the following operations?
(A) accept input from the keyboard (B) read from the file
(C) Parse a string separated by delimiters (D) All of these

12 (General) | March – 2015

(7) By using which method of file output stream classes writes b length bytes form the
specified byte array in Java ?
(A) void write (int b) (B) void write (byte [] b)
(C) void write (int length) (D) void write (byte length)
(8) Which of the following refers to a collection of data stored on a non-volatile device in a
Computer system?
(A) File (B) Application (C) Volatile data (D) Hard disk
(9) Which method of scanner class of Java, scans the next token of the input as line?
(A) Boolean has Next() (B) int nextInt()
(C) Float next float() (D) string nextline()
(10) Which work can be done in file or directory in Java file class?
(A) Create (B) Rename (C) Delete (D) All of these
(11) Which stream is used to make text files and program codes in Java?
(A) byte stream (B) binary stream (C) character stream (D) input stream
(12) By which method of file class in Java returns true if the directory exists, otherwise returns
false?
(A) boolean exists() (B) booleanisFile()
(C) booleanisDirectory() (D) String[]list()

Page 1
12 (Science) | March – 2015

(13) Which file class method is used to return the number of bytes in that file?
(A) long byte () (B) long file () (C) long number () (D) long length ()
(14) Which class is the base for writing a character stream?
(A) Impress (B) Writer (C) Calc (D) Draw
(15) What occurs when there is a failed I/O operation in writer class?
(A) IO Base (B) IO throw (C) IO Class (D) IO Exception
(16) Which abstract class defines the functionality that is available for all character input
stream?
(A) Text class (B) Void class (C) Reader class (D) Writer class
(17) Which File Input Stream method is used to read a byte of data from this input stream?
(A) void read( ) (B) read void( ) (C) void close( ) (D) int read( )
(18) Which type of storage values store in variables are lost when computer is shutdown?
(A) Voltage storage (B) Non-voltage storage (C) Volatile storage (D) Non-volatile storage
(19) Which class provides a method for reading password?
(A) Write class (B) Scanner Input class (C) Reader class (D) Console class
(20) Which scanner class method is used to scan the next token of the input as “Int”?
(A) int next Int( ) (B) int has Next( ) (C) void int( ) (D) int next( )
(21) Which file class method is used to return the path to the file or directory?
(A) String get Name( ) (B) String get File( )
(C) String get Directory( ) (D) String get Path( )
(22) Data stored in files is often called as what?
(A) Persistent data (B) Personal data (C) Provision data (D) Public data
(23) Which of the following is an example of binary file?
(A) C (B) mp3 (C) txt (D) java
(24) Which class encapsulates information about the properties of a file or a directory?
(A) java.out.file (B) java.in.file (C) java.file.io (D) java.io.File
(25) Which file class method is used to return true, if the file or directory is hidden?
(A) boolean is Hidden( ) (B) boolean exists( )
(C) boolean is File( ) (D) boolean is Directory( )

12 (General) | March – 2016


(26) Storage device of a computer system can be broadly classified into which categories?
(A) Volatile storage (B) Non-volatile storage
(C) Both (A) and (B) (D) Binary storage
(27) From the following which is not binary file extension?
(A) .jpeg (B) .mp3 (C) .class (D) .txt
(28) Which method of file class returns true value if the file or directory is hidden in Java?
(A) boolean is Hidden() (B) boolean is File()
(C) long length() (D) boolean exists()
(29) When we write data to stream, which type of stream is known in Java?
(A) Writer stream (B) Output stream (C) Input stream (D) Reader stream
(30) Character stream is classified into how many classes?
(A) 1 (B) 2 (C) 3 (D) 4
(31) The data hierarchy occurs in which of the following order from the smallest to largest
piece of data?
(A) file : character : record : field (B) file : character : field : record
Page 2
(C) character : field : file ; record (D) character : field : record : file

12 (Science) | March – 2016

(32) Storage device of computer system can be broadly classified into which of the following
category?
(A) Volatile storage (B) Non-volatile storage
(C) Both (A) and (B) (D) Dynamic storage
(33) File can exists on which of the following permanent storage device?
(A) Hard disk (B) Compact disc (C) Optical disc (D) All of these
(34) Which of the following extension is used for binary files?
(A) .jpeg (B) .mp3 (C) .class (D) All of these
(35) In Java, which class encapsulates information about the properties of a file or a directory?
(A) java.io.object.File (B) java.lang.File
(C) java.util.File (D) java.io.File
(36) In Java, which method of file class returns true if file exists, otherwise returns false?
(A) boolean FileDir() (B) boolean isFile()
(C) boolean listFile() (D) boolean getFile()
(37) Java supports which type of streams?
(A) Byte stream (B) Character stream (C) Both (A) and (B) (D) Binary stream
(38) In Java, which of the following is a subclass of Reader class?
(A) InputStreamReader (B) BufferedReader
(C) Both (A) and (B) (D) Output stream
(39) In Java, which method of file Writer class is used to close the stream?
(A) void close() (B) int break() (C) void terminate() (D) quit()
(40) In Java, scanner class can be used to perform which of the following operations?
(A) Read from the file (B) Parse a string separated by delimeters
(C) Accept input form keyboard (D) All of these
(41) In Java, which of the following is used as a separator between fields of a record?
(A) Space (B) Variable (C) Delimiter (D) Path
(42) In Java, which method of console class reads a single line of text from the console?
(A) String PrintLine() (B) Char getLine()
(C) Char Print() (D) String readLine()
(43) In Java, int read() method returns what to identify the end of data in the stream ?
(A) 0 (B) 1 (C) –1 (D) Null
(44) Which of the following refers to a collection of data stored on a non-volatile device in a
computer system?
(A) File (B) Volatile data (C) Hard disk (D) Application

1. In _________ storage values stored in variables are lost when a computer is shutdown.
Ans. Volatile
2. Apart from variables, objects and their references are generally stored in _________.
Ans. RAM
3. _________storage is permanent storage.
Ans. Non-volatile
4. Data stored in files is often called _______ data.
Ans. persistent

Page 3
5. Files can be further classified broadly into _________ categories.
Ans. two
6. In the _________ files the data has been encoded using a scheme such as ASCII or Unicode.
Ans. Text
7. __________ files contain data that has not been encoded as text.
Ans. Binary
8. The Binary files extensions examples are __________.
A. jpeg B. mp3 C. class D. All of these
9. The java classes are present in package.
Ans. Java.io
10. Java uses the concepts of ___________ in file handling.
Ans. streams
11. _________ class can be used to access attributes of files and directories.
Ans. File
12. There are nearly ________ that can be used to perform various operations on a file or a directory.
Ans. 30 methods
13. A programmer can do ________ a file or a directory.
A. create B. rename C. delete D. All of these
14. In Linux, ”passwd” file is present in _______ directory stores the information of the users existing in the
system.
Ans. “/etc”
15. _________ method of file class returns true if the directory exists, otherwise returns false.
Ans. boolean isDirectory()
16. The ______ class provides a method for reading.
Ans. Console
17. The Console class belongs to _______ package.
Ans. java.io
18. _________method of Console class is used to write a formatted string to this console’s output stream
using the specified format string and arguments.
Ans. Console printf(String format, Object args)
19. _______ method of Console class reads a single line of text from the console.
Ans. String readLine()
20. The ______ class encapsulates information about the properties of a file or a directory.
Ans. java.io.file
21. Scanner class is used for performing which of the following operations ?
Ans. Read from a file
22. Which method is used to close FileOutputStream class?

Ans. void close( )


23. Which value is returned by Boolean isFile( ) method of the class?

Ans. true or false


24. Which of the following is used as a separator between fields of a record?
Ans. delimiter

Page 4
Page 5

You might also like