C Programming - Input / Output
Exercise : Input / Output - Yes / No Questions
1.
stderr, stdin, stdout are FILE pointers
Answer: Option
Explanation:
Yes, these will be declared like
The corresponding stdio.h variable is FILE* stdin;
The corresponding stdio.h variable is FILE* stdout;
The corresponding stdio.h variable is FILE* stderr;
2.
A file written in text mode can be read back in binary mode.
Answer: Option
Explanation:
The difference is that text files contain lines (or records) of text and each of these has an end-of-line marker automatically appended to the end of it whenever you indicate that you have reached the end of a line.
Binary files are not broken up into separate lines or records so the end-of line marker is not written when writing to a binary file.
So, we cannot read the correct the data in binary mode.
3.
Will the following program work?
#include<stdio.h>
int main()
{
int n=5;
printf("n=%*d\n", n, n);
return 0;
}
Answer: Option
Explanation:
It prints n= 5
4.
Can we specify a variable filed width in a scanf() format string?
Answer: Option
Explanation:
In scanf() a * in a format string after a % sign is used for the suppression of assignment. That is, the current input field is scanned but not stored.
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers