0% found this document useful (0 votes)
12 views6 pages

File in C++ - Quizizz

Uploaded by

akshaysain940
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views6 pages

File in C++ - Quizizz

Uploaded by

akshaysain940
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Worksheets Name

File in C++
Class
Total questions: 25
Worksheet time: 7mins
Date
Instructor name: Rajalakshmi M

 Multiple Choice

1. By default all the files are opened in_____mode

a) can't say b) Binary

c) Text

 Multiple Choice

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

a) True b) False

 Multiple Choice

3. Which of the following is not a file opening mode

a) ios::nocreate b) ios::ate

c) ios::truncate d) ios::noreplace

 Multiple Choice

4. Due to ios::trunc mode the file is truncated to zero length

a) True b) False

 Multiple Choice

5. If we have object from of stream class then default mode of opening the file is__________

a) ios::in b) ios::out\ios::trunk

c) ios::out d) ios::in\ios::trunc
 Multiple Choice

6. _______is return tyoe of is_open() function

a) float b) char*

c) bool d) int

 Multiple Choice

7. If we have object from fstream class, then what is default mode of opening the file

a) ios::in\ios::trunc b) ios::in\ios::out

c) default mode depends on compiler

 Multiple Choice

8. To create an output stream we must declare the stream to be of class

a) none of these b) ofstream

c) iostream d) ifstream

 Multiple Choice

9. Streams that will be performing both input and output operation must be declared as class

a) f stream b) stdiostream

c) stdtream d) iostream

 Multiple Choice

10. To perform file I/O operations,we must use ________header file

a) <f stream> b) none of these

c) <of stream> d) <if stream>


 Multiple Choice

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

a) ios::end b) los::begl

c) ios::set d) ios::cur

 Multiple Choice

12. ios::trunc is used for

a) if the file is opened for output operation and it b) if the file is opened for output operation and it
already existed its previous content in deleted already existed then a new copy is created
and replaced by new one

 Multiple Choice

13. Which is correct syntax

a) My::open b) Myfile:open

c) Myfile.open

 Multiple Choice

14. Calling the stream member function sync() causes the immediate synchronization

a) False b) True

 Multiple Choice

15. eof() is used to get

a) file close b) easy code reivew

c) debug report d) end of file

 Multiple Choice

16. Which among is used for positioning relative to the beginnig of a stream

a) ios::start b) ios::beg

c) ios::beginning d) ios::begin
 Multiple Choice

17. Which function is used to reposition the file pointer

a) changep() b) seekg()

c) go_p() d) moveg()

 Multiple Choice

18. which function is used in c++ to get the current position of file pointer in a file

a) get_pos() b) tell_p()

c) get_p() d) tell_pos()

 Multiple Choice

19. What is use of eof()

a) returns true if a file open for reading has b) returns true if a file open for reading has
reached the next character reached the end

c) returns true if a file open for reading has


reached the next word

 Multiple Choice

20. what must be specified when we construct an object of class ostream

a) streambuf b) memory

c) stream d) none of the mentioned

 Fill in the Blank

21. what is meant by ofstream in c++

Ans.
 Fill in the Blank

22. what can be used to input a string with blankspace

Ans.

 Multiple Choice

23. how many group of output of operation are there in C++

a) 3 b) 1

c) 4 d) 2

 Multiple Choice

24. pick out the correct object about the instantiation of output stream

a) cerr b) all of the mentioned

c) cout d) clog

 Fill in the Blank

25. in order to open a file with a stream object we use its________function

Ans.
Answer Keys

1. c) Text 2. b) False 3. c) ios::truncate

4. a) True 5. b) ios::out\ios::trunk 6. c) bool

7. c) default mode depends on 8. b) ofstream 9. a) f stream


compiler

10. a) <f stream> 11. c) ios::set 12. a) if the file is opened for
output operation and it
already existed its
previous content in
deleted and replaced by
new one

13. c) Myfile.open 14. b) True 15. d) end of file

16. b) ios::beg 17. b) seekg() 18. b) tell_p()

19. b) returns true if a file open 20. a) streambuf 21. writes to a file, file
for reading has reached
the end

22. getline, inline 23. d) 2 24. b) all of the mentioned

25. member, member function

You might also like