C++ Programming Test By Kishor Raut - August 13, 2021 FacebookTwitterPinterestWhatsApp Welcome to your C++ Programming Test 1. What will be output for the following code? class Box { int capacity; public: void print(); friend void show(); bool compare(); friend bool lost(); };A. 1B. 2C. 3D. 4 2. Which keyword is used to represent a friend function?A. friendB. FriendC. friend_funcD. Friend_func 3. Which of the following is correct about friend functions?A. Friend functions use the dot operator to access members of a class using class objectsB. Friend functions can be private or publicC. Friend cannot access the members of the class directlyD. All of the above 4. Pick the correct statement.A. Friend functions are in the scope of a classB. Friend functions can be called using class objectsC. Friend functions can be invoked as a normal functionD. Friend functions can access only protected members not the private members 5. Where does keyword ‘friend’ should be placed?A. function declarationB. function definitionC. main functionD. block function 6. Space taken by bitset bs is less than?A. bool bs[N]B. vector bs(N)C. Both A and BD. None of the above 7. What is true about bitset?A. A bitset is an array of boolB. A limitation of bitset is, N must be known at compile timeC. As bitset stores the same information in compressed manner the operation on bitset are faster than that of array and vector.D. All of the above 8. The size of bitset is fixed at compile time that is, it can’t be changed at runtime.A. TRUEB. FALSEC. Can be true and falseD. Can not say 9. Which bitset method tests whether all bits from bitset are set or not?A. bitset::any()B. bitset::test()C. bitset::all()D. bitset::operator[] 10. Which bitset method toggles all bits from bitset?A. bitset::count()B. bitset::flip()C. bitset::test()D. bitset::to_ullong() 11. bitset::hash() used for?A. Convert hash value to unsigned longB. Returns hash value based on the provided bitset.C. Reports the size of the hash.D. Reset hash value to zero. 12. Which of the following is the limitation of bitset over vector bool?A. SpaceB. SizeC. TypeD. Speed 13. Which operator is used to access the nth bit in a bitset?A. $B. #C. [ ]D. * 14. How many ways are there for constructing a bitset?A. 1B. 2C. 3D. 4 15. What is the default value of a bitset?A. 0B. 1C. -1D. infinite Time is Up!