File Input Output MCQs

296 questionsC-ProgramPage 33 of 33

Practice free File Input Output multiple-choice questions with instant answer feedback and step-by-step solutions. Click an option to check yourself, reveal the full explanation, and work through all 296 questions — no login required.

Question 289easy
What are the first and second arguments of fopen?
Question 290easy
In a variable length argument function, the declaration "..." can . . . . . . . .
Question 291hard
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    srand(time(NULL));
    printf("%d\n", rand());
    return 0;
}
Advertisement
Question 292hard
What will be the output of the following C code?
#include <stdio.h>
#include <string.h>
int main()
{
    char line[3];
    FILE *fp;
    fp = fopen("newfile.txt", "r");
    while (fgets(line, 3, fp))
    fputs(line, stdout);
    return 0;
}
Question 293medium
What will be the output of the following C code?
char str[] = "Hello Nancy“;
printf(“\n %.7s”, str) ;
Question 294hard
What will be the output of the following C code?
#include <stdio.h>
int main(int argc, char **argv)
{
    char *s = "myworld";
    int i = 3;
    printf("%10.*s", i, s);
}
Advertisement
Question 295easy
What is the syntax of ungetc()?
Question 296easy
scanf() is a predefined function in. . . . . . . .header file.