Loading...

C++ Multiple Choice Questions

Our C++ questions and answers focuses on all areas of C++ programming language covering 100+ topics in C++

C++ File Management MCQ | Set 2

C++ File Management | Set 2


11. Which of the following is not used to seek file pointer?

a) ios::set
b) ios::end
c) ios::cur
d) ios::beg



12. Which of the following is the default mode of the opening using the ifstream class?

a) ios::in
b) ios::out
c) ios::app
d) ios::trunc



13. Which of the following is the default mode of the opening using the fstream class?

a) ios::in
b) ios::out
c) ios::in|ios::out
d) ios::trunc



14. Which function is used in C++ to get the current position of file pointer in a file?

a) tell_p()
b) get_pos()
c) get_p()
d) tell_pos()



15. Which function is used to reposition the file pointer?

a) moveg()
b) seekg()
c) changep()
d) go_p()



16. Which of the following is used to move the file pointer to start of a file?

a) ios::beg
b) ios::start
c) ios::cur
d) ios::first



17. It is not possible to combine two or more file opening mode in open () method.

a) True
b) False
c) May be
d) None of these



18. Which of these is the correct statement about eof() ?

a) Returns true if a file open for reading has reached the next character.
b) Returns true if a file open for reading has reached the next word.
c) Returns true if a file open for reading has reached the end.
d) Returns true if a file open for reading has reached the middle.



19. Which of the following true about FILE *fp

a) FILE is a structure and fp is a pointer to the structure of FILE type
b) FILE is a buffered stream
c) FILE is a keyword in C for representing files and fp is a variable of FILE type
d) FILE is a stream



20. Which of the following methods can be used to open a file in file handling?

a) Using Open ( )
b) Constructor method
c) Destructor method
d) Both A and B



- Related Topics