VKV SirTest Lab

File Handling: viva questions and MCQs

Computer Programming Lab (C), Unit 11. 100+ File Handling questions with explanations (Computer Programming Lab (C)). Topics: C Files. Take a free test now.

Topics

Key terms: file handling, existing file, reading, binary file, writes, returns

Sample questions with answers

  1. fopen returns NULL when:

    Options: A) Always   B) The file is empty   C) The file cannot be opened   D) The file opens successfully

    Answer: C) The file cannot be opened. Check for errors.

  2. Data in a file is accessed sequentially or:

    Options: A) Randomly using fseek   B) Only backwards   C) Only once   D) Never

    Answer: A) Randomly using fseek. Random access.

  3. In C file handling, "ftell()" means:

    Options: A) Tests whether the end-of-file indicator is set   B) Open a binary file for reading   C) Returns the current position in a file   D) Reads a line of text from a file

    Answer: C) Returns the current position in a file. ftell(): Returns the current position in a file.

Take a free File Handling test

All units of Computer Programming Lab (C)