Join Our WhatsApp Group Join Subscribe Now!

OOP 313304 Practical No.23: Write programs to read and write from/to file using Constructor ,Open()

OOP 313304 Practical No.23: Write programs to read and write from/to file using Constructor ,Open()

 OOP 313304 Practical No.23: Write programs to read and write from/to file using Constructor, Open()

Files store the output of a program and help to perform various operations on it. Files help store these data permanently on a storage device.

OOP 313304

Exercise:

1. Write output for the following code

Answer: 
The content of a text file testout.txt is set with the data:
Welcome to javaTpoint.
C++ Tutorial.
2.Write a program in C++ in which open a file read and write mode ad display the content on

Answer:




3. output screen using function open()

Answer:


4.Write a program in C++ in which open a file read and write mode ad display the content on output screen using constructor.

Answer:


Result

The program writes specific content to a file named testout.txt and successfully creates or overwrites the file if it opens correctly.

Practical Related Questions

1. Which operator is used to insert the data into file?
a) >> 
b) <<
c) < 
d) none of the mentioned

Answer:

b) <<

2. Which function is used to position back from the end of file object?
a) seekg ()
b) seekp()
c) both seekg() & seekp() 
d) none of the mentioned

Answer:

c) both seekg() & seekp() 

3. Write a C++ program to Read and Display File's Content.

Answer:


4. Write a C++ program to List Files in Current Directory.

Answer:


5.What is the return type open() method?

a)int
b)char
c)bool
d) float

Answer:

c) bool

6. Complete the following table:

Answer:


Conclusion

We successfully completed OOP 313304 Practical No.23 and Write programs to read and write from/to file using  Constructor, Open().

About the Author

Hi everyone, I'm Suraj Diware, and I'm passionate about helping students succeed in MSBTE programs. This blog is dedicated to providing clear and concise explanations of MSBTE curriculum topics, along with practical tips and resources to sup…

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.