Test Series - cpp

Test Number 93/102

Q: Where are standard C libraries defined in C++?
A. Container
B. std namespace
C. list
D. iterators
Solution: Every element of the c library is defined within the std namespace.
Q: Which of the following have their changes in their declaration related to constness of parameter?
A. strchr
B. string
C. memory
D. strcybrk
Solution: These are the items which will have their change in declaration related to constness of parameter. They are strchr, strpbrk, strrchr, strstr, memchr.
Q: How many elements does a floating point number is composed of?
A. 1
B. 2
C. 3
D. 4
Solution: The floating point number composed of four elements. They are sign, Base, Significand and Exponent.
Q: How does the limits.h header file can be represented in C++?
A. limits
B. limit
C. climits
D. dlimits
Solution: Any standard library of C can be written in C++ by using ‘c’ in front of header file name and omitting the ‘.h’. for example  can be written as .
Q: Pick out the correct syntax of the header file that can be used with C++.
A. #include
B. #include
C. Both #include & #include
D. #include
Solution: The C header file that is ending with h can only be used in C++.
Q: How many groups of output of operation are there in c++?
A. 1
B. 2
C. 3
D. 4
Solution: There are two groups of output operation in c++. They are formatted output and unformatted output.
Q: Pick out the correct objects about the instantiation of output stream.
A. cout
B. cerr
C. clog
D. all of the mentioned
Solution: cout, cerr and clog are the standard objects for the instantiation of output stream class.
Q: What is meant by ofstream in c++?
A. Writes to a file
B. Reads from a file
C. Writes to a file & Reads from a file
D. delete a file
Solution: ofstream is a stream class to write on files.
Q: How many types of output stream classes are there in c++?
A. 1
B. 2
C. 3
D. 4
Solution: There are three output stream classes in c++. They are ostream, ofstream and ostrstream.
Q: What must be specified when we construct an object of class ostream?
A. stream
B. streambuf
C. memory
D. steamostream
Solution: If you construct an object of class ostream, you must specify a streambuf object to the constructor.

You Have Score    /10