Become a GOLD member of Deccansoft and get access to 40+ courses!!
NewBatches/Webinars
Packages
Gold Membership
Bestseller
Microsoft Azure Suite & Suite Plus
Power Platform Acadamy
New
Azure DevOps Expert & Expert Plus
MS.NET Foundation For Beginners
MS.NET Full Stack Developer
UI / Web Development
SQL Server & MSBI Tools
Software Testing
Courses
MS.NET Courses (Includes Live Project)
Complete C#, OOPs and Windows Programing
ASP.NET MVC Online Training
ASP.NET WebForms
ASP.NET Core
WCF incl. Web Services and Remoting
WPF incl. MVVM and Prism
LINQ and Entity Framework
Live Project Training for Developing Enterprise Application
Live Project using Ntier Arch (.NET5 + EF Core + Angular)
Microservices using .NET Core
Gold Membership
CareerStep IT Program
Client-side UI Technologies
Building Static Web Pages using HTML and CSS
JavaScript and HTML DOM
jQuery, AJAX and JSON
Building Interactive Web Pages using HTML5 and CSS3
BootStrap + Live Examples
AngularJS + Live Project
Angular + Typescript
ReactJS
KnockoutJS
Xamarin
SQL Server + MSBI
SQL Server 2017
Querying Data with Transact-SQL(70-761)
SQL Server Integration Service (SSIS)
SQL Server Reporting Service (SSRS)
SQL Service Analysis Service (SSAS)
Cloud Computing / Azure / AWS
AZ-900: Microsoft Azure Fundamentals
Azure Suite (AZ-104+AZ-204+AZ-305+ AZ-500)
AZ-104: Microsoft Azure Administrator
AZ-204: Developing Solutions for Microsoft Azure
AZ-305: Microsoft Azure Architect Technologies and Design
DP-203: Data Engineering on Microsoft Azure
Amazon Web Services (AWS)
DevOps Expert
AZ-400: Microsoft Azure DevOps
Docker by Sandeep Soni
Kubernetes by Sandeep Soni
Docker & Kubernetes by Rahul Rampurkar
IaC Using Terraform
Powershell
Microsoft Power Platform
Microsoft Power Platform
Data Analytics using PowerBI (DA-100)
Testing Tools
Manual Testing
Selenium Testing with Java(Live Training)
Others
Python Programming
C and Data Structure
Core Java
OOPs and C++
Advance Java
Complete Azure Training
Pricing
Videos
Testimonials
Azure Certification
Contact Us
Login
Login or Register
×
Sign In
Register
Forgot Password?
How did you find us
WhatsApp
YouTube
LinkedIn
Facebook
Telegram
Twitter
Google
Referred by Friend
Refresh
Input symbols
By clicking Register, you accept to the
terms and conditions
and that you have read our
privacy policy.
Recover Password
×
Submit
Enquiry Now
Where did you come to know about us
WhatsApp
YouTube
LinkedIn
Facebook
LinkedIn Ad
Email
Twitter
Google
Referred
Other
Refresh
Input symbols
IO Streams
Interview Questions and Answer
1. Which of the following is used to read or extracts the data present in the file?
Options:
a. Output stream
b. Input stream
c. Both a & b
d. None of the above
Reveal Answer
2. For which of the following classes fstream base class acts as a base class?
Options:
a. ifstream
b. istream
c. fstream
d. ostream
e. ostream
f. streambuf
g. ofstream
Reveal Answer
3. Which of the following function is used to determine whether the stream object is associated with a file?
Options:
a. buf
b. string
c. is_open
d. None of the above
Reveal Answer
4. Which class is used to inherit put() function from ostream?
Options:
a. ifstream
b. ofstream
c. fstream
d. both a & c
Reveal Answer
5. Ifstream contains open() with default output mode.
Options:
a. True
b. False
Reveal Answer
6. Which operator is defined in istream class?
Options:
a. Overloaded insertion operator
b. Overloaded extraction operator
c. Scope resolution operator
d. None of the above
Reveal Answer
7. What is the unit of data in a stream of Text?
Options:
a. A character
b. A string
c. Can be any data type
d. Integer
Reveal Answer
8. Binary stream is used for:
Options:
a. Printing output to the screen or printer
b. Graphics or word processing documents
c. Reading mouse-input
d. Receiving input from the keyboard
e. Reading & writing to the modem
f. Embedded software
Reveal Answer
9. Which file supports the character translations?
Options:
a. Binary file
b. Text file
c. Both a & b
d. None of the above
Reveal Answer
10. Which header file does not exist in the following list?
Options:
a. iostream.h
b. string.h
c. sstring.h
d. fstream.h
Reveal Answer
11. What is the output of the following program? #include <iostream> using namespace std; int main () { ofstream outfile ("Demo.txt"); for (int n = 0; n < 50; n++) { outfile << n; outfile.flush(); } cout << "Finished"; outfile.close(); return 0; }
Options:
a. Finished
b. Compile time error
c. Runtime error
d. Program will not run
Reveal Answer
12. Which header file is used to create or read data files?
Options:
a. ofstream.h
b. fstream.h
c. ifstream.h
d. istream.h
Reveal Answer
13. Multiple files can be opened by using constructor function of the class.
Options:
a. True
b. False
Reveal Answer
14. Before opening the files, the filestream object should be ………………….
Options:
a. Created
b. Initialised
c. Declared
d. Both b & c
Reveal Answer
15. What is the mode for appending the data to the end of file?
Options:
a. ios :: out
b. ios :: nocreate
c. ios :: app
d. ios :: ate
Reveal Answer
16. What is the mode for opening a file, in which opening a file fails if file does not exist?
Options:
a. ios::out
b. ios::nocreate
c. ios::noreplace
d. ios::trunk
Reveal Answer
17. Which operator should be used when a file is opened in more than 1 mode?
Options:
a. >> operator
b. << operator
c. || operator
d. | operator
Reveal Answer
18. Which method is used to get the position back from the end of file object?
Options:
a. seekp
b. tellp
c. seekg
d. both a & c
Reveal Answer
19. Which function gives the current location of the get pointer
Options:
a. tellg
b. seekg
c. tellp
d. seekp
Reveal Answer
20. Which part of the file does the put pointer set to when a file is opened in append mode?
Options:
a. At the beginning of the file
b. Anywhere in the file
c. At the end of the file
d. Middle of the file
Reveal Answer
21. What is the output of the following program? #include <iostream> using namespace std; int main () { char first, second; cout << "Enter any two words: "; first = cin.get(); cin.sync(); second = cin.get(); cout << first; cout << second << endl; return 0; }
Options:
a. First letter of the entered first word
b. First letter of the entered second word
c. First letter of entered two words.
d. Compile error
Reveal Answer
22. Which operator is used to reads the data character by character and assigns it to the specified location?
Options:
a. >> operator
b. << operator
c. < operator
d. None of the above
Reveal Answer
23. Which member function returns true at the end of file while reading?
Options:
a. fail()
b. bad()
c. good()
d. eof()
Reveal Answer
24. When does the fail() member function returns true?
Options:
a. At the end of the file while reading
b. If an invalid operation is attempted
c. When an input or output operation has failed.
d. If the file is not good
Reveal Answer
25. Which function is used to reset the error state?
Options:
a. clrscr()
b. clear()
c. clr()
d. reset()
Reveal Answer
Packages
Gold Membership
Microsoft Azure Suite &Suite Plus
Azure DevOps Expert &Expert Plus
MS.NET Foundation For Beginners
MS.NET Full Stack Developer
UI / Web Development
SQL Server & MSBI Tools
Software Testing
Resources
Blog
Deccansoft
AzureA2Z
Wall of Fame
On-Job Tech Support
About
About BestDotNetTraining
About Trainer
Testimonials
FAQ
Other links
About Us
Contact Us
Leave us a feedback
Sitemap
Privacy Policy
Terms & Conditions
Proudly Powered by