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 |
Q.25 |
fseek() returns __________ value when file pointer moves beyond the file bound- |
aries. |
(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. (b) 2. (d) 3. (a) 4. (a) |
5. (c) 6. (a) 7. (a) 8. (b) |
9. (c) 10. (a) 11. (d) 12. (b) |
13. (c) 14. (a) 15. (c) 16. (d) |
17. (a) 18. (b) 19. (a) 20. (c) |
21. (b) 22. (a) 23. (c) 24. (a) |
25. (b) 26. (a) 27. (b) 28. (c) |
29. (a) 30. (d) |
Define structure employee that contain the fields (no, name ,address, salary) and the program allow the user to enter data for ten employees and then print employee data if the salary less than 5000 and the address is “omdraman”
ReplyDeleteDefine structure drug that contain the fields:
ReplyDelete• drug_name
• drug_id_comp
• address that contain the fields :
o Street
o City
• Expiration Date that contain the fields:
o Day
o Month
o Year
• Count
• Price
• Total_Drug_Price where : total_drug_price=price*count.
Write c program do the following :
ReplyDeletei. allow the user to insert data of 10 drugs data.
ii. Print the maximum and minimum of total_drug_price.
iii. Print all drug data.
iv. Display the drag data that have expire data
Define structure book that contain the fields:
ReplyDelete• book_tiltle
• book_edition
book_author that contain the fields:
• fist name
• last name
date that contain the fields:
• day
• month
• year
The program allow user to enter structure data and print the values of structure fields.