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

4/15

Page

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

Which of the following statements about stdout and stderr are true?

Select an option to see the answer and solution.

What is the meaning of the following C statement?
printf(“%10s”, state);

Select an option to see the answer and solution.

What will be the output of the following C code?
#include <stdio.h>
int main()
{
    short int i;
    scanf("%*d", &i);
    printf("%hd", i);
    return 0;
}

Select an option to see the answer and solution.

On freeing a dynamic memory, if the pointer value is not modified, then the pointer points to.

Select an option to see the answer and solution.

void * malloc(size_t n) returns?

Select an option to see the answer and solution.

What does the following segment of C code do?
fprintf(fp, "Copying!");

Select an option to see the answer and solution.

Which of the following represents the function for scanf()?

Select an option to see the answer and solution.

Which of the following can be used for random number generation?

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 *s = "myworld";
    int i = 9;
    printf("%*s", i, s);
}

Select an option to see the answer and solution.

What will be the output of the following C statement?
fprintf(stderr, "error: could not open filen");

Select an option to see the answer and solution.

Which among the following is the odd one out?

Select an option to see the answer and solution.

The syntax of the scanf() is scanf("control string ", arg1,arg2,arg3,....,argn); the prototype of control string is

Select an option to see the answer and solution.

Output justification such as decimal point, numerical sign, trailing zeros or octal are specified.

Select an option to see the answer and solution.

function fabs defined math.h header file takes the argument of type integer.

Select an option to see the answer and solution.

What will be the output of the following C code considering user typed jkl?
#include <stdio.h>
int main()
{
    char n[20];
    fgets(n, 19, stdin);
    ungetc(n[0], stdin);
    printf("%s\n", n);
    return 0;
}

Select an option to see the answer and solution.

Which of the following is NOT a delimiter for an input in scanf?

Select an option to see the answer and solution.

Which is true about isupper(c), where c is an int that can be represented as an unsigned?
char or EOF.isupper(c) returns

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 = fabs(-87);
    printf("%d\n", k);
}

Select an option to see the answer and solution.

gets() function checks overflow run.

Select an option to see the answer and solution.

In linux, apart from including math header file, the program is successfully executed by which of the following?

Select an option to see the answer and solution.