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.681Hard

In competitive programming for GATE/ISRO 2025, which scenario would union be preferable over structure?

Q.682Easy

Which function is used to open a file in C?

Q.683Easy

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

Q.684Easy

Which function is used to close a file in C?

Q.685Easy

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

Q.686Medium

What does fgets() function do?

Q.687Medium

Which function writes formatted data to a file?

Q.688Medium

What is the purpose of ftell() function?

Q.689Medium

Which function sets the file position to a specific location?

Q.690Medium

What does feof() function check?

Q.691Medium

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

Q.692Medium

Which mode allows both reading and writing without truncating?

Q.693Medium

What does fwrite() function return?

Q.694Medium

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

Q.695Medium

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

Q.696Medium

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

Q.697Hard

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

Q.698Hard

Which of the following correctly implements appending to a file?

Q.699Easy

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

Q.700Easy

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