C Programming - Standard Input & Output
Question 1
|
Which among the following is odd one out?
printf
| |
fprintf
| |
putchar
| |
scanf
|
Question 2
|
For a typical program, the input is taken using.
scanf
| |
Files
| |
Command-line
| |
None of the mentioned
|
Question 3
|
What does the following command line signify? prog1|prog2
It runs prog1 first, prog2 second
| |
It runs prog2 first, prog1 second
| |
It runs both the programs, pipes output of prog1 to input of prog2
| |
It runs both the programs, pipes output of prog2 to input of prog1
|
Question 4
|
What is the default return-type of getchar()?
char
| |
int
| |
char *
| |
Reading character doesn’t require a return-type
|
Question 5
|
The value of EOF is_____.
-1
| |
0
| |
1
| |
10
|
Question 6
|
What is the use of getchar()?
The next input character each time it is called
| |
EOF when it encounters end of file.
| |
Both a & b
| |
None of the mentioned
|
Question 7
|
Which is true?
The symbolic constant EOF is defined in
| |
The value is typically -1,
| |
Both a & b
| |
Either a or b
|
Question 8
|
What is the use of putchar()?
The character written
| |
EOF is an error occurs
| |
Nothing
| |
Both a & b
|
Question 9
|
Which is true about function tolower?
The function tolower is defined in
| |
Converts an upper case letter to lower case
| |
returns other characters untouched
| |
None of the mentioned
|
Question 10
|
What is the output of this C code?
Compile time error
| |
Nothing
| |
0
| |
Undefined behaviour
|
Question 11
|
putchar(c) function/macro always outputs character c to the
screen
| |
standard output
| |
depends on the compiler
| |
Depends on the standard
|
Question 12
|
What is the output of this C code if following commands are used to run(considering myfile exists)? gcc -otest test.c ./test < myfile
Compile time error (after first command)
| |
d in the myfile file
| |
d on the screen
| |
Undefined behaviour
|
Question 13
|
What is the output of this C code if following commands are used to run(considering myfile exists)? gcc -otest test.c ./test > myfile
d 2 in myfile
| |
d 1 in myfile
| |
d in myfile and 1 in screen
| |
d in myfile and 2 in screen
|
Question 14
|
What is the output of this C code if following commands are used to run and if myfile does not exist? gcc -o test test.c ./test > myfile
d 2 in myfile
| |
d 1 in myfile
| |
Depends on the system
| |
Depends on the standard
|
Question 15
|
The statement prog <infile causes
prog to read characters from infile.
| |
prog to write characters to infile.
| |
infile to read characters from prog instead.
| |
Nothing
|
Check Your Answers:
1. D
2. D
3. C
4. B
5. A
6. C
7. C
8. D
9. D
10. B
11. B
12. C
13. B
14. B
15. A
0 comments:
Post a Comment