C Programming Quiz

Quiz on File Handling in C

Time left: 300 seconds

Q.1. Which of the following true about FILE *fp

Select Your Option

fp is a pointer of FILE type and FILE is a structure that store following information about opened file.

Q.2. When fopen() is not able to open a file, it returns

Select Your Option

fopen() returns NULL if it is not able to open the given file due to any of the reasons like file not present, inappropriate permissions, etc.

Q.3. In fopen(), the open mode “wx” is sometimes preferred “w” because.
1) Use of wx is more efficient. 2) If w is used, old contents of file are erased and a
new empty file is created. When wx is used, fopen()
returns NULL if file already exists.

Select Your Option

In C, fopen() is used to open a file in different modes. To open a file in write mode, “w” is specified. When mode “w” is specified, it creates an empty file for output operations

Q.4. FILE reserved word is?

Select Your Option

It is a type name defined in stdio.h

Q.5. What will be the output of the following snippet?

f = None
for i in range (5):
    with open ("data.txt", "W") as f:
    if i > 2:
        break;
    print (f.closed);                        


Select Your Option

Q.6. The readlines() method returns:

Select Your Option

Every line is stored in a list and returned.

Q.7. Which of the following is not a valid mode to open a file?

Select Your Option

Use r+, w+ or a+ to perform both read and write operations using a single file object.

Q.8. Information stored on a storage device with a specific name is called a _____.

Select Your Option

File is storage device in which Information is Stored.

Q.9. Which function is used to read single line from file?

Select Your Option

The readline function reads a single line from the file fh = open(“filename”, “r”)

Q.10. In file handling, what does this term means "r, a"?

Select Your Option

Q.11. getc() returns EOF when

Select Your Option

In C/C++, getc() returns EOF when end of file is reached. getc() also returns EOF when it fails. So, only comparing the value returned by getc() with EOF is not sufficient to check for actual end of file.

Q.12. fseek() should be preferred over rewind() mainly because

Select Your Option

the file position indicator of an input stream back to the beginning using rewind(). But there is no way to check whether the rewind() was successful.

Q.13. Which of the following statements is/are true?

Select Your Option

Q.14. What does CSV stand for?

Select Your Option

A Comma Separated Values (CSV) file is a plain text file that contains a list of data.

Q.15. Which of the following modes will refer to binary data?

Select Your Option

Instructions:-

  1. This Quiz is based on File Handling in C
  2. Each correct answer will carry 2 points
  3. Once an option is selected you cannot select any other, So choose wisely
  4. Do not refresh the page as it will reset the quiz
  5. Once the time is up the quiz will automatically get submitted with no of Question responded
  6. Your total score alongwith your name will be shown after submission of the Quiz
  7. Wish you ALL THE BEST 👍👍

START

Results:-

Hi




Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post