Home

1000+ C++ Programming MCQ for GRE [Solved]

Thursday 9th of March 2023

Sharing is caring

1. An object is an allocated space in memory.
A. True
B. False
C.
D.
Answer : A
2. Inline functions_____________ call overload.
A. Increase
B. Reduce
C. None of the above are correct
D.
Answer : B
3. By using protected, one can create class members that are private to their class but
A. that can not be inherited and accessed by a derived class
B. that can still be inherited and accessed by a derived class
C. that can be public
D. none of the above
Answer : B
4. By default, C++ uses the following method of passing arguments
A. Call-by-Reference
B. Call-by-Value
C. Call-by-Pointer
D. None of the above
Answer : B
5. A pure virtual function is a virtual function that has
A. no definition in its base class
B. a definition in its base class
C. a definition in at least one derived class
D. definition in base class and at least one derived class
Answer : A
6. A constructor cannot be explicitly called.
A. True
B. False
C.
D.
Answer : A
7. When a language has the capacity to produce new data type, it is said to be
A. Reprehensible
B. Encapsulated
C. Overload
D. Extensible
Answer : D
8. Protected members cannot be inherited.
A. True
B. False
C.
D.
Answer : B
9. A copy constructor is used to copy an object member wise to another object of the same class.
A. True
B. False
C.
D.
Answer : A
10. Reference to an object behaves like a constant pointer.
A. True
B. False
C.
D.
Answer : B
11. Classes are useful because they
A. Are removed from memory when not in use
B. Permit data to be hidden from other classes
C. Bring together all aspects of an entity in one place
D. Can closely model objects in the real world
Answer : B
12. Which of the following can legitimately be passed to a function?
A. A constant
B. A variable
C. A structure
D. A header file
Answer : B
13. A class that contains at least one pure virtual function is called as
A. pure class
B. abstract class
C. base class
D. derived class
Answer : B
14. One of the important features of an abstract class is
A. it need not have any object
B. it should be used only as a derived class
C. it need not have any members
D. none of the above
Answer : A
15. In C++, identifiers have to be declared at the beginning of the blocks.
A. True
B. False
C.
D.
Answer : A
16. The exception is processed using
A. unexpected()
B. perform()
C. catch()
D. try()
Answer : C
17. _______ argument(s) are passed in case of binary overloaded operators.
A. Two
B. One
C. No
D. None of the above
Answer : A
18. Element double Array[7] is which element of the array?
A. sixth
B. seventh
C. eighth
D. impossible to tell
Answer : C
19. Static member functions have file scope.
A. True
B. False
C.
D.
Answer : A
20. this' pointer has to be used while accessing data members in a member function.
A. True
B. False
C.
D.
Answer : A
21. When one object initializes another object the following function is invoked
A. copy constructor
B. new
C. instantiation
D. none of the above
Answer : A
22. Public data members can be accessed
A. Only from the base class itself
B. Both form the base class and from its derived classes
C. From the class which is friend of the base class
D. None of the above are correct
Answer : B
23. new operator is used
A. To dynamically allocate storage
B. To statically allocate storage
C. To allocate storage for a new variable
D. None of the above are correct
Answer : C
24. The new operator always returns a void pointer.
A. True
B. False
C.
D.
Answer : A
25. Pick out the most appropriate statement
A. All variables must be declared before they are used
B. Variables in C++ need not be declared and the type can be assigned dynamically
C. Variables in C++ can be declared at the end of the program (before the main function terminates)
D. Variables can not be used explicitly in C++
Answer : A
26. Which of the following are good reasons to use an object oriented language?
A. You can define your data types
B. Program statements are simpler than in procedural languages.
C. An OO program can be taught to correct its own errors.
D. It's easier to conceptualize an OO program.
Answer : A
27. A function that is called automatically when an object is created is known as
A. instantiation
B. function prototype
C. constructor
D. structure
Answer : C
28. Friend function have access to the
A. private and protected members
B. public members only
C. private members only
D. None of the above are correct
Answer : B
29. _____________ operator must have one class object
A. +
B. new
C. all
D. None of these
Answer : B
30. In C++, an identifier must be initialized using constant expression.
A. True
B. False
C.
D.
Answer : B
31. Class is similar to a variable.
A. True
B. False
C.
D.
Answer : B
32. Dynamic memory can be allocated by the following declaration
A. new
B. volatile
C. static
D. ==
Answer : A
33. Organizing data with methods that operate on the data and creating a new data type is called encapsulation.
A. True
B. False
C.
D.
Answer : A
34. The ?: can be used to replace
A. if-else statement
B. wild cards
C. no meaning in C++
D. returns the value
Answer : A
35. The && and || operators
A. Compare two numeric values
B. Combine two numeric values
C. Compare two Boolean values
D. Combine two Boolean values
Answer : C
36. The characteristic that data can be manipulated only through member functions that are part of the class is called
A. Encapsulation
B. Data dependency
C. Inheritance
D. Instantiation
Answer : A
37. What is the output of the following program segment - for(i = 1, j = 0; i < 10; i++) j += i; cout <<i<<"
";

A. 10
B. 20
C. 55
D. there is an error in the program
Answer : A
38. The template function declaration specifies
A. template class
B. a generic class
C. exception
D. identifier
Answer : B
39. A destructor can have arguments like constructor.
A. True
B. False
C.
D.
Answer : B
40. Member function cannot be called from within a constructor.
A. True
B. False
C.
D.
Answer : A
41. The string table in C++ holds the
A. string constants in your program
B. program statements in string form
C. variables whose type is of string
D. none of the above
Answer : A
42. It is possible to allow non member function access to private members of a class by declaring it as
A. public
B. friend
C. private
D. not possible
Answer : B
43. Constructor returns void type value.
A. True
B. False
C.
D.
Answer : B
44. Static data member occurs in only class scope.
A. True
B. False
C.
D.
Answer : B
45. We can make function inline by using the keyword 'inline'.
A. True
B. False
C.
D.
Answer : A
46. ios containes a pointer to streambuf.
A. True
B. False
C.
D.
Answer : A
47. In C++, the exception handler is invoked with a-
A. try block
B. throw exception
C. catch function
D. abort()
Answer : B
48. You can read input that consists of multiple lines of text using
A. The normal cout<< combination
B. The cin.get() function with one argument
C. The cin.get() function with two argument
D. The cin.get() function with three argument
Answer : C
49. Pick out the most appropriate statement from the following
A. references are pointers
B. array of references can be created
C. you can not reference a reference variable
D. all of the above
Answer : C
50. iostream is inheried from istream, ostream and ios class.
A. True
B. False
C.
D.
Answer : B

Sharing is caring