Quiz on File Handling in C!
2. Basic operations performed on files is/are__________
(a) opening a file
(b) reading data from file
(b) reading data from file
(c) closing a file
(d) all the above
3. ftell() is used to__________
4. fopen() is used to_________
(a) create a new file
(b) open an existing file
(b) open an existing file
(c) both
(d) none
5. What does FILE *fp indicate?
6. The mode r is used to open a file for__________
7. The mode a is used to open a file for__________
8. The mode w+ is used for__________operations.
(a) reading
(b) writing
(b) writing
(c) both
(d) none
9. If a non-existing file is opened in read mode then__________occurs.
10. When end of file is reached getc() returns__________
(a) -1
(b) EOF
(b) EOF
(c) both
11. What is the first argument of function fprintf()?
12.
Status-inquiry
library functions are__________
(a)
feof
(b)
ferror
(c)
both
(d)
none
13.
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
14.
The feof() function is used to test__________condition.
15.
feof() returns a non-zero integer value if__________
(a)
error occurs
(b)
all the data has been read
(c)
both
16. The ferror() function is used to report__________
(a) status of file indicated
(b) status of error in file
(c) none
17. ferror() takes__________as argument.
18. If an error is detected by ferror(),then it returns __________
(a) zero integer
(b) non zero integer
(c) can't say
19. fopen() returns__________ value when file can't be opened using fopen().
(a) NULL
(b) -1
(c) 0
(d) can't say
20. fseek(fp,0L,1) indicates __________
(a) stays at the beginning
(b) stays at the end
(c) stays at the current position
21. fseek(fp,-m,1) indicates __________
22. fseek() returns __________ value when file pointer moves beyond the file boundaries.
23.
rewind() is used for__________
24.
The first byte in a file is numbered __________
25.
fseek() function is used to__________
To know the answer click here.
16. The ferror() function is used to report__________
(a) status of file indicated
(b) status of error in file
(c) none
17. ferror() takes__________as argument.
18. If an error is detected by ferror(),then it returns __________
(a) zero integer
(b) non zero integer
(c) can't say
19. fopen() returns__________ value when file can't be opened using fopen().
(a) NULL
(b) -1
(c) 0
(d) can't say
20. fseek(fp,0L,1) indicates __________
(a) stays at the beginning
(b) stays at the end
(c) stays at the current position
21. fseek(fp,-m,1) indicates __________
(a)
Go backward by m bytes
(b)
Go forward by m bytes
(c)
none
22. fseek() returns __________ value when file pointer moves beyond the file boundaries.
(a)
error0
(b)
-1
(c)
0
(d)
none
(a)
reset the position to start of file
(b)
reset the position to end of file
(c)
none
(a)
1
(b)
0
(c)
can't say
(a)
set the position to start of file
(b)
set the position to end of file
(c)
set the position to desired point in file
(d)
none
To know the answer click here.