Unit_B

Page 1

UNIT-5 Q.1 A __________ is a place on the disk where a group of related data is stored. (a) disk (b) file (c) both (d) none Q.2 Basic operations performed on files is/are__________ (a) opening a file (b) reading data from file (c) closing a file (d) all the above Q.3 getw() is used to__________ (a) read an integer from a file (b) read a string from a file (c) none Q.4 ftell() is used to__________ (a) give the current position of a file (b) give the specified character position (c) none Q.5 fopen() is used to__________ (a) create a new file (b) open an existing file (c) both (d) none Q.6 What does FILE *fp indicate? (a) fp as a pointer to datatype FILE (b) FILE as a pointer to datatype fp (c) none Q.7 The mode r is used to open a file for__________ (a) read only (b) write only (c) none Q.8 The mode a is used to open a file for__________ (a) read (b) adding data (c) none Q.9 The mode w+ is used for__________operations. (a) reading (b) writing (c) both (d) none Q.10 If a non-existing file is opened in read mode then__________occurs. (a) Error (b) new file is created (c) none Q.11 Standard i/o routines are __________ (a) fopen() (b) getw() (c) rewind() (d) all of these Q.12 When end of file is reached getc() returns__________ (a) -1 (b) EOF (c) both


Q.13 The function putc() is used for__________ purpose (a) read a character (b) both (c) write a character (d) none Q.14 The first argument in fprintf() is used for__________ (a) file pointer (b) file name (c) both (d) none Q.15 Status-inquiry library functions are__________ (a) feof (b) ferror (c) both (d) none Q.16 Which of the following is an error situation? (a) Device overflow (b) opening file with invalid file name (c) Attempting to write to a write-protected file (d) all the above Q.17 The feof() function is used to test__________condition (a) end of file (b) start of file (c) none Q.18 feof() returns a non-zero integer value if__________ (a) error occurs (b) all the data has been read (c) both Q.19 The ferror() function is used to report__________ (a) status of file indicated (b) status of error in file (c) none Q.20 ferror() takes__________as argument. (a) pointer (b) file name (c) file pointer (d) any one of these Q.21 If an error is detected by ferror(),then it returns __________ (a) zero integer (b) non zero integer (c) can't say Q.22 fopen() returns__________ value when file can't be opened using fopen(). (a) NULL (b) -1 (c) 0 (d) can't say Q.23 fseek(fp,0L,1) indicates __________ (a) stays at beginning (b) stays at end (c) stays at current position Q.24 fseek(fp,-m,1) indicates __________ (a) Go backward by m bytes (b) Go forward by m bytes (c) none 98


Q.25 fseek() returns __________ value when file pointer moves beyond the file boundaries. (a) error0 (b) -1 (c) 0 (d) none Q.26 rewind() is used for__________ (a) reset the position to start of file (b) reset the position to end of file (c) none Q.27 The first byte in a file is numbered __________ (a) 1 (b) 0 (c) can't say Q.28 fseek()s used for__________ (a) sets the position to start of file (b) sets the position to end of file (c) sets the position to desired point in file (d) none Q.29 getc() is used to__________ (a) Read a character (b) read a string (c) none Q.30 To store data in a file in the secondary memory __________is/are needed to OS. (a) Filename (b) Data Structure (c) Purpose (d) All these Answers 1. 5. 9. 13. 17. 21. 25. 29.

(b) (c) (c) (c) (a) (b) (b) (a)

2. 6. 10. 14. 18. 22. 26. 30.

(d) (a) (a) (a) (b) (a) (a) (d)

3. 7. 11. 15. 19. 23. 27.

99

(a) (a) (d) (c) (a) (c) (b)

4. 8. 12. 16. 20. 24. 28.

(a) (b) (b) (d) (c) (a) (c)


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.