C Objective Interview Questions on Files
These C Objective Interview Questions On Files post providing basic, intermediate and Hard level examples in C Files. The Practice of these examples makes you good in C programming.
How is a file closed?
What is a random access file?
- Opening a file in random mode.
- A file can be accessed at random using fseek() function
- Both A and B
Pick out the correct statements in case of ftell function?
- Return character at particular location
- Return byte location of particular character
- Return 0 if no such location
- Return EOF if no such location.
What is the use of getw() and putw() functions?
- No such functions in file handling
- Used to work with string data in files
- Used to work with integer data in files
- None of above.
How many arguments fgets( ) is function taking to read a string?
Difference between gets() and fgets() functions
- gets() read a string including spaces from console
- fgets() read a specific set of characters into character array from file
- Both A and B correct
- Only B is correct.
Which of the following fopen statements is illegal?
- fp = fopen(“sample.txt”, “r”);
- fp = fopen(“/src/practice/test.txt”, “w”);
- fp = fopen(“abc”, “a”);
What does the following segment of code do?
- It writes “Java2Python” into the file pointed by fp
- It reads“Java2Python” from the file and prints on display
- It writes as well as reads “Java2Python” to and from the file and prints it
- No such file in C file system.
FILE reserved word is
- A structure in stdio.h header file
- Primitive type in C
- No such type in C
- It is a type name defined in stdio.h
stdout, stdin and stderr are
- File pointers
- File descriptors