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

6/15

Page

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

What does the following C code snippet mean?
int ungetc(int c, FILE *stream)

Select an option to see the answer and solution.

Which is the best way to generate numbers between 0 to 99?

Select an option to see the answer and solution.

Which of the following is an invalid method for input?

Select an option to see the answer and solution.

What error will be generated on using incorrect specifier for the datatype being read?

Select an option to see the answer and solution.

In C language, FILE is of which data type?

Select an option to see the answer and solution.

Which types of input are accepted in toupper(c)?

Select an option to see the answer and solution.

Which among the following is correct function call for rand() and random()?

Select an option to see the answer and solution.

what is the return value of fputs()?

Select an option to see the answer and solution.

What will be the output of the following C code?
#include <stdio.h>
#include <stdarg.h>
int f(char c, ...);
int main()
{
    char c = 97, d = 98;
    f(c, d);
    return 0;
}
int f(char c, ...)
{
    va_list li;
    va_start(li, c);
    char d = va_arg(li, int);
    printf("%c\n", d);
    va_end(li);
}

Select an option to see the answer and solution.

What will be the output of the following C statement?
int sscanf(char *string, char *format, arg1, arg2, ...)

Select an option to see the answer and solution.

The syntax of fgets is char *fgets(char *line, int maxline, FILE *fp). Which is true for fgets?

Select an option to see the answer and solution.

What does the following C code snippet mean?
char *gets(char *s)

Select an option to see the answer and solution.

Which functions is declared in ?

Select an option to see the answer and solution.

What does scanf() function return?

Select an option to see the answer and solution.

What will be the output of the following C code?
#include <stdio.h>
int main()
{
    FILE *fp = stdout;
    stderr = fp;
    fprintf(stderr, "%s", "hello");
}

Select an option to see the answer and solution.

What is the use of symbol * in the control string as shown [=%[*][width] [modifiers] type=]?

Select an option to see the answer and solution.

Which of the following function can be used to terminate the main function from another function safely?

Select an option to see the answer and solution.

For a typical program, the input is taken using . . . . . . . .

Select an option to see the answer and solution.

What is the return value of putchar()?

Select an option to see the answer and solution.

What will be the output of the following C code?
#include <stdio.h>
int f(char chr, ...);
int main()
{
    char c = 97;
    f(c);
    return 0;
}
int f(char c, ...)
{
    printf("%c\n", c);
}

Select an option to see the answer and solution.