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
- C Files: file handling, existing file, reading, binary file, writes, returns, file pointer, file position
Key terms: file handling, existing file, reading, binary file, writes, returns
Sample questions with answers
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.
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.
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.