iGET

C Programming - MCQ Practice Questions

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

972 questions | 100% Free

Q.681Easy

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

Q.682Easy

Which function is used to close a file in C?

Q.683Easy

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

Q.684Medium

What does fgets() function do?

Q.685Medium

Which function writes formatted data to a file?

Q.686Medium

What is the purpose of ftell() function?

Q.687Medium

Which function sets the file position to a specific location?

Q.688Medium

What does feof() function check?

Q.689Medium

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

Q.690Medium

Which mode allows both reading and writing without truncating?

Q.691Medium

What does fwrite() function return?

Q.692Medium

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

Q.693Medium

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

Q.694Medium

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

Q.695Hard

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

Q.696Hard

Which of the following correctly implements appending to a file?

Q.697Easy

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

Q.698Easy

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

Q.699Easy

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

Q.700Medium

Which function is used to read a string from a file, including whitespace characters, up to a maximum length?