ExamTray App is now Available on Google Play EXAMTRAY android app link

 

00:00:00

C Programming Tutorial - C File Operations Online Test 1

Instructions

Total Questions: 20

Total Minutes: 20

This ExamTray Free Online Exam or MCQ Quiz tests your C File Read Write Modes, Functions like FOPEN, FCLOSE, FPRINTF, FSCANF, FGETS,FPUTS. Examples are given as questions and answers. Easily Attend Competitive Exams and Job Interview Questions.

All the Best

1) What is the need for a File when you can store anything in memory.?
2) What is the keyword used to declare a C file pointer.?
3) What is a C FILE data type.?
4) Where is a file temporarily stored before read or write operation in C language.?
5) Choose a correct statement about C file operation program.?
int main()
{
    FILE *fp;
    char ch;
    fp=fopen("readme.txt","r");
    while((ch=fgetc(fp)) != EOF)
    {
        printf("%c",ch);
    }
}
6) What is the need for closing a file in C language.?
7) If a FILE pointer is NULL what does it mean.?
FILE *fp;
fp=fopen("abc.txt","w");
8) Choose a correct statement about FGETS in C program.?
int main()
{
    FILE *fp;
    char str[80];
    fp=fopen("readme.txt","r");
    while(fgets(str,80,fp) != NULL)
    {
        printf("%s",str);
    }
    fclose(fp);
}
9) Choose a correct statement about C file "R" mode operation using fopen.
fopen("abc.txt","r");
10) Choose a correct statement about File Write Mode "w".
File *fp;
fp=fopen("abc.txt","w");
11) Choose a correct statement about C File Mode "w+".
FILE *p;
p=fopen("abc.txt","r+");
12) Choose a correct statement about C file mode "w+".
FILE *fp;
fp=fopen("abc.txt","w+");
13) Choose a correct statement about C file mode "a".
FILE *fp;
fp=fopen("abc.txt","a");
14) Choose a correct statement about C file mode "a+".
FILE *fp;
fp=fopen("abc.txt","a+);
15) Choose a correct statement about opening a file in binary mode for reading.
FILE *fp;
fp=fopen("abc.txt","rb");
16) What is the syntax for writing a file in C using binary mode.?
FILE *fp;
17) What are the C functions used to read or write a file in Text Mode.?
18) What are the C functions used to read or write a file in Binary Mode.?
19) What is the C function used to move current pointer to the beginning of file.?
FILE *fp;
20) Choose a correct syntax for FSCANF and FPRINTF in c language.?