C-Plus-Plus Questions March 21, 2023 | No Comments 0 votes, 0 avg 215 123456789101112131415 C-Plus-Plus Questions 1 / 15 1. Which of the following is the correct definition of sorting? A. Sorting is a type of process in which the data or information is ordered into a specific order. Example increasing orders, decreasing. B. Sorting information or data only in increasing order C. Sorting is a type of process in which data elements are modified or manipulated D. None of the above 2 / 15 2. When will we use the function overloading? A. same function name but different number of arguments B. different function name but same number of arguments C. same function name but same number of arguments D. different function name but different number of arguments 3 / 15 3. What will be the output of the following C++ code? #include using namespace std; class Test { protected: int x; public: Test (int i):x(i) { } void fun() const { cout << "fun() const " << endl; } void fun() { cout << "fun() " << endl; } }; int main() { Test t1 (10); const Test t2 (20); t1.fun(); t2.fun(); return 0; } A. fun() fun() const B. fun() const fun() C. fun() fun() D. fun() const fun() const 4 / 15 4. What is the difference between delete and delete[] in C++? A. delete is syntactically correct but delete[] is wrong and hence will give an error if used in any case B. delete is used to delete normal objects whereas delete[] is used to pointer objects C. delete is a keyword whereas delete[] is an identifier D. delete is used to delete single object whereas delete[] is used to multiple(array/pointer of) objects 5 / 15 5. How can one implement the run-time Polymorphism in the C++ programming language? A. By using the Template B. By using the concepts of inheritance C. By using both the virtual functions and inheritance D. By using only the virtual functions 6 / 15 6. Under which pillar of OOPS does base class and derived class relationship come? A. Polymorphism B. inheritance C. Encapsulation D. Abstraction 7 / 15 7. dentify the correct definition of ‘*’ operator in pointer. A. Address of operator B. value of address operator C. multiplication operator D. all of the above 8 / 15 8. What did we call an array of the one-dimensional array? A. Single Dimensional array B. Multi-Dimensional array C. 2D Array (or 2-Dimensional array) D. Both A and B 9 / 15 9. What will be the output of the following C++ code? #include using namespace std; template T max (T &a, T &b) { cout << "Template Called "; return (a > b)? a : b; } template <> int max (int &a, int &b) { cout << "Called "; return (a > b)? a : b; } int main () { int a = 10, b = 20; cout << max (a, b); } A. Template Called 20 B. Called 20 C. Error D. Segmentation fault 10 / 15 10. Which of the following is not a type of inheritance? A. Multiple B. Multilevel C. Distributed D. Heirarchical 11 / 15 11. What will be the output of the following C++ code? #include using namespace std; int gcd (int a, int b) { int temp; while (b != 0) { temp = a % b; a = b; b = temp; } return(a); } int main () { int x = 15, y = 25; cout << gcd(x, y); return(0); } A. 15 B. 25 C. 375 D. 5 12 / 15 12. Which of the following options correctly explains the concept of Polymorphism? A. int func(float); float func(int, int, char); B. int func(int); int func(int); C. int func(int, int); float func1(float, float); D. None of the above 13 / 15 13. Which of the following can be considered as the object of an array? A. Index of an array B. Elements of the Array C. Functions of the Array D. All of the above 14 / 15 14. Pick the incorrect statement about inline functions in C++? A. Saves overhead of a return call from a function B. They are generally very large and complicated function C. These functions are inserted/substituted at the point of call D. They reduce function call overheads 15 / 15 15. Observer the given C++ program carefully and choose the correct output from the given options: #include #include using namespace std; int main() { cout<::value; // case A cout<::value; // case B cout<::value; // case c return 0; } A. 11O B. OO1 C. O1O D. none of the above Your score isThe average score is 32% LinkedIn Facebook VKontakte 0% Restart quiz By WordPress Quiz plugin Questions, Quiz