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

8/15

Page

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

Which of the following macro extracts an argument from the variable argument list (ie ellipsis) and advance the pointer to the next argument?

Select an option to see the answer and solution.

calloc() initialize memory with all bits set to zero.

Select an option to see the answer and solution.

Which of the following snippet will effectively generate random numbers?

Select an option to see the answer and solution.

The statement prog < infile causes . . . . . . . .

Select an option to see the answer and solution.

What is the use of getchar()?

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(...);
int main()
{
    char c = 97;
    f(c);
    return 0;
}
int f(...)
{
    va_list li;
    char c = va_arg(li, char);
    printf("%c\n", c);
}

Select an option to see the answer and solution.

Which of the following data-types are promoted when used as a parameter for an ellipsis?

Select an option to see the answer and solution.

What is the value of EOF?

Select an option to see the answer and solution.

Which of these is a correct way to generate numbers between 0 to 1(inclusive) randomly?

Select an option to see the answer and solution.

log(x) function defined in math.h header file is . . . . . . . .

Select an option to see the answer and solution.

ungetc() may be used with . . . . . . . .

Select an option to see the answer and solution.

What will be the output of the following C code?
#include <stdio.h>
#include <math.h>
void main()
{
    int k = sqrt(-4);
    printf("%d\n", k);
}

Select an option to see the answer and solution.

stdout, stdin and stderr are . . . . . . . .

Select an option to see the answer and solution.

What will be the output of the following C code?
#include <stdio.h>
#include <ctype.h>
int main()
{
    char i = 9;
    if (isdigit(i))
        printf("digit\n");
    else
        printf("not digit\n");
        return 0;
}

Select an option to see the answer and solution.

Which of the following causes an error?

Select an option to see the answer and solution.

Which header file includes a function for variable number of arguments?

Select an option to see the answer and solution.

fputs() adds newline character.

Select an option to see the answer and solution.

For binary files, a . . . . . . . . must be appended to the mode string.

Select an option to see the answer and solution.

The type va_list in an argument list is used . . . . . . . .

Select an option to see the answer and solution.

The standard header . . . . . . . . is used for variable list arguments (...) in C.

Select an option to see the answer and solution.