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

9/15

Page

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

Which one of the following is correct syntax for opening a file.

Select an option to see the answer and solution.

What will be the output of the following C code (when 4 and 5 are entered)?
#include <stdio.h>
void main()
{
    int m, n;
    printf("enter a number");
    scanf("%d", &n);
    scanf("%d", &m);
    printf("%d\t%d\n", n, m);
}

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 i = 10, j = 3;
    printf("%d %d %d", i, j);
}

Select an option to see the answer and solution.

What will cos(x) return?

Select an option to see the answer and solution.

What will be the output of the following C code?
#include <stdio.h>
void main()
{
    int n;
    scanf("%d", n);
    printf("%d", n);
}

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("%h*d", &i);
    printf("%hd", i);
    return 0;
}

Select an option to see the answer and solution.

Choose the right statement for fscanf() and scanf()

Select an option to see the answer and solution.

What is the function of the mode ' w+'?

Select an option to see the answer and solution.

gets() does the following when it reads from stdin.

Select an option to see the answer and solution.

What is the qualifying input for the type specifier G?

Select an option to see the answer and solution.

Which of the following doesn't require an & for the input in scanf()?

Select an option to see the answer and solution.

For floating point numbers, the precision flag specifies the number of decimal places to be printed. When no precision modifier is specified, printf() prints . . . . . . . .

Select an option to see the answer and solution.

Which of the following is the correct syntax for calling function ungetc?
Assume int c and FILE *fp

Select an option to see the answer and solution.

Which of the following cannot be used with ungetc()?

Select an option to see the answer and solution.

Which character of pushback is guaranteed per file?

Select an option to see the answer and solution.

If the user enters 1 s 3.2, what value will be returned by the scanf()?
scanf("%d %f %c", &a, &b, &c);

Select an option to see the answer and solution.

String operation such as strcat(s, t), strcmp(s, t), strcpy(s, t) and strlen(s) heavily rely upon.

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 str[10] = "hello";
    char *p = strrchr(str, 'l');
    printf("%c\n", *(++p));
}

Select an option to see the answer and solution.

Which function will return the current file position for stream?

Select an option to see the answer and solution.

When a C program is started, O.S environment is responsible for opening file and providing pointer for that file?

Select an option to see the answer and solution.