iGET

C Programming - MCQ Practice Questions

Practice free C Programming multiple-choice questions with detailed answers and explanations. Perfect for competitive exam preparation.

978 questions | 100% Free

Q.1Easy

Which function is used to open a file in C?

Q.2Easy

What does the mode 'rb' mean in fopen()?

Q.3Easy

Which function is used to close a file in C?

Q.4Easy

Which mode opens a file for writing and truncates it if it exists?

Q.5Medium

What does fgets() function do?

Q.6Medium

Which function writes formatted data to a file?

Q.7Medium

What is the purpose of ftell() function?

Q.8Medium

Which function sets the file position to a specific location?

Q.9Medium

What does feof() function check?

Q.10Medium

What is the difference between fgetc() and getc()?

Q.11Medium

Which mode allows both reading and writing without truncating?

Q.12Medium

What does fwrite() function return?

Q.13Medium

What is the purpose of rewind() function in file handling?

Q.14Medium

Consider the code: FILE *fp = fopen("data.txt", "r"); if(fp == NULL) { printf("Error"); } What does this check?

Q.15Medium

What happens when fseek() is used with SEEK_END as origin?

Q.16Hard

Write a code snippet to read 100 bytes from a file. Which is correct?

Q.17Hard

Which of the following correctly implements appending to a file?

Q.18Easy

When opening a file in 'w' mode, what happens if the file already exists?

Q.19Easy

Which of the following file modes in fopen() allows reading only?

Q.20Easy

In file handling, what does the 'b' flag in file modes like 'rb' or 'wb' indicate?