Q: Which header file is used to create the pseudo random generator?
Solution: cstdlib header file is used to create pseudo random number. C++11 standard added random header file as well to generate random numbers.
Q: Which is a constant defined inheader file?
Solution: RAND_MAX is a constant defined infor deciding the maximum random number that can be produced.
Q: How many parameters are available in srand function?
Solution: There is one parameter available in srand function. That is an integer value to be used as seed by the pseudo-random number generator algorithm.
Q: Which operator is used to produce a certain number in a specific range?
Solution: In C++, modulo operator is denoted by %.
Q: Which can be used to create a random number without duplication?
Solution: Time can be used to create a random number without duplication.
Q: Which header file is required to use file I/O operations?
Solution:header file is needed to use file I/O operations in C++. This header file contains all the file I/O operations definition.
Q: Which of the following is used to create an output stream?
Solution: ofstream is used to create an output stream in C++ file handling operations. Ofstream objects are used to read files.
Q: Which of the following is used to create a stream that performs both input and output operations?
Solution: fstream is used to create a stream that performs both input and output operations in C++ file handling.
Q: Which of the following is not used as a file opening mode?
Solution: ios::trunc is used to truncate a file if it exists. It is not a file opening mode.
Q: Which of the following statements are correct? 1) It is not possible to combine two or more file opening mode in open() method. 2) It is possible to combine two or more file opening mode in open() method. 3) ios::in and ios::out are input and output file opening mode respectively.
Solution: C++ allows to use one or more file opening mode in a single open() method. ios::in and ios::out are input and output file opening mode respectively.
You Have Score    | /10 |