C Programming - File Access
Question 1
|
The first and second arguments of fopen are
A character string containing the name of the file & the second argument is the mode.
| |
A character string containing the name of the user & the second argument is the mode.
| |
A character string containing file poniter & the second argument is the mode.
| |
None of the mentioned of the mentioned
|
Question 2
|
For binary files, a ___ must be appended to the mode string.
Nothing
| |
“b”
| |
“binary”
| |
“01″
|
Question 3
|
If there is any error while opening a file, fopen will return
Nothing
| |
EOF
| |
NULL
| |
Depends on compiler
|
Question 4
|
Which is true about getc.getc returns?
The next character from the stream referred to by file pointer
| |
EOF for end of file or error
| |
Both a & b
| |
Nothing.
|
Question 5
|
When a C program is started, O.S environment is responsible for opening file and providing pointer for that file?
Standard input
| |
Standard output
| |
Standard error
| |
All of the menitoned
|
Question 6
|
FILE is of type ______ ?
int type
| |
char * type
| |
struct type
| |
None of the mentioned
|
Question 7
|
What is the meant by ‘a’ in the following operation? fp = fopen(“Random.txt”, “a”);
Attach
| |
Append
| |
Apprehend
| |
Add
|
Question 8
|
Which of the following mode argument is used to truncate?
a
| |
f
| |
w
| |
t
|
Question 9
|
Which type of files can’t be opened using fopen()?
.txt
| |
.bin
| |
.c
| |
None of the mentioned
|
Question 10
|
Which of the following fopen statements are illegal?
fp = fopen(“abc.txt”, “r”);
| |
fp = fopen(“/home/user1/abc.txt”, “w”);
| |
fp = fopen(“abc”, “w”);
| |
None of the mentioned
|
Question 11
|
What does the following segment of code do? fprintf(fp, “Copying!”);
It writes “Copying!” into the file pointed by fp
| |
It reads “Copying!” from the file and prints on display
| |
It writes as well as reads “Copying!” to and from the file and prints it
| |
None of the mentioned
|
Question 12
|
FILE reserved word is
A structure tag declared in stdio.h
| |
One of the basic datatypes in c
| |
Pointer to the structure defined in stdio.h
| |
It is a type name defined in stdio.h
|
Question 13
|
. What is the output of this C code?
Compilation error
| |
45
| |
Nothing
| |
Depends on the standard
|
Question 14
|
What is the output of this C code?
Compilation error
| |
45
| |
Nothing
| |
Depends on the standard
|
Question 15
|
stdout, stdin and stderr are
File pointers
| |
File desciptors
| |
Streams
| |
Structure
|
Question 16
|
Which of the following statements about stdout and stderr are true?
Same
| |
Both connected to screen always.
| |
Both connected to screen by default.
| |
stdout is line buffered but stderr is unbuffered.
|
Question 17
|
What is the output of this C code?
45 65
| |
65 45
| |
65
| |
Compilation error
|
Question 18
|
What is the output of this C code?
45 65
| |
65 45
| |
65
| |
Compilation error
|
Question 19
|
What is the output of this C code?
45 65
| |
65 45
| |
45
| |
Compilation error
|
Check Your Answers:
1. A
2. B
3. C
4. C
5. D
6. C
7. B
8. C
9. D
10. D
11. A
12. D
13. C
14. B
15. A
16. C
17. B
18. A
19. A
0 comments:
Post a Comment