Vidyalelo
C Programming · all questions

File Input Output
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

296

Questions

15/15

Page

Pick an option on a question to see the right answer and solution.

Within main, return expr statement is equivalent to . . . . . . . .

Select an option to see the answer and solution.

ungetc() can be used only with getc().

Select an option to see the answer and solution.

calloc() returns storage that is initialized to.

Select an option to see the answer and solution.

puts() does the following when it writes to stdout.

Select an option to see the answer and solution.

What will be the output of the following C code?
#include <stdio.h>
int main()
{
    char buf[12];
    stderr = stdin;
    fscanf(stderr, "%s", buf);
    printf("%s\n", buf);
}

Select an option to see the answer and solution.

Which of the following statement is true?

Select an option to see the answer and solution.

Control string specifies the type and format of the data that has to be obtained from the keyboard.

Select an option to see the answer and solution.

What form the data must be entered for the given C code?
scanf(“%d / %d”, &n1,&n2);

Select an option to see the answer and solution.

What are the first and second arguments of fopen?

Select an option to see the answer and solution.

In a variable length argument function, the declaration "..." can . . . . . . . .

Select an option to see the answer and solution.

What will be the output of the following C code?
#include <stdio.h>
int main()
{
    srand(time(NULL));
    printf("%d\n", rand());
    return 0;
}

Select an option to see the answer and solution.

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;
}

Select an option to see the answer and solution.

What will be the output of the following C code?
char str[] = "Hello Nancy“;
printf(“\n %.7s”, str) ;

Select an option to see the answer and solution.

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);
}

Select an option to see the answer and solution.

What is the syntax of ungetc()?

Select an option to see the answer and solution.

scanf() is a predefined function in. . . . . . . .header file.

Select an option to see the answer and solution.