Home

C++ Programming MCQ Solved Paper for NDA

Thursday 9th of March 2023

Sharing is caring

1. 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
2. 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
3. Class members are _______________ by default
A. Private
B. protected
C. public
D. None of the above are correct
Answer : A
4. A base class is inherited by
A. derived class
B. inline function
C. constructor
D. none of the above
Answer : A
5. "[]" Operator is a unary operator.
A. True
B. False
C.
D.
Answer : A
6. Element double Array[7] is which element of the array?
A. sixth
B. seventh
C. eighth
D. impossible to tell
Answer : C
7. 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
8. One of the major disadvantage with late binding is
A. the source code should be made available at compile time
B. the program runs slower
C. dynamic variables can not be used in the program
D. static variables can not be used
Answer : B
9. ios containes a pointer to streambuf.
A. True
B. False
C.
D.
Answer : A
10. The ?: can be used to replace
A. if-else statement
B. wild cards
C. no meaning in C++
D. returns the value
Answer : A
11. 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
12. Delete operator is used
A. To allocate storage
B. To deallocate storage
C. To delete variable name
D. None of the above are correct
Answer : B
13. Private data members can be accessed
A. Only from the base class itself
B. Both from the base class and form its derived classes
C. From the class which is a friend of the base class
D. None of the above is correct
Answer : A
14. The template function declaration specifies
A. template class
B. a generic class
C. exception
D. identifier
Answer : B
15. _____________ operator must have one class object
A. +
B. new
C. all
D. None of these
Answer : B
16. A variable defined within a block is visible
A. From the point of definition onwards in the program
B. From the point of definition onwards in the function
C. From the point of definition onwards in the block
D. Throughout the function
Answer : C
17. The scope resolution operator is -
A. ::
B. ;
C. <<
D. ->
Answer : A
18. 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
19. 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
20. In C++, the exception handler is invoked with a-
A. try block
B. throw exception
C. catch function
D. abort()
Answer : B
21. Operator overloading is
A. Making C++ operators work with objects
B. Making C++ operators more then they can handle
C. Giving new meaning to existing c++ operators
D. Making new C++ operators
Answer : C
22. The following syntax is valid. void inline gram_ panchayat :: show_gram_ panchayat_info().
A. True
B. False
C.
D.
Answer : B
23. The member of a structure can be accessed through a pointer by
A. ->
B. dot operator
C. ::
D. >>
Answer : A
24. Scope resolution operator has the highest precedence.
A. True
B. False
C.
D.
Answer : A
25. In case of nested class, enclosing class can directly access the private data member of nested class.
A. True
B. False
C.
D.
Answer : A
26. Which of the following is not a component of file system
A. Access method
B. Auxiliary storage management
C. Free integrity mechanism
D. None of the above
Answer : C
27. 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
28. 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
29. Constructor returns void type value.
A. True
B. False
C.
D.
Answer : B
30. 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
31. Static data member occurs in only class scope.
A. True
B. False
C.
D.
Answer : B
32. By default, members cannot be inherited.
A. True
B. False
C.
D.
Answer : A
33. Which of the following relationship is known as inheritancerelationship?
A. ‘has-a’ relationship
B. ‘is-a’ relationship
C. association relationship
D. none of the above
Answer : A
34. 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
35. Class is similar to a variable.
A. True
B. False
C.
D.
Answer : B
36. 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
37. The getch() library function
A. Returns a character when any key is pressed
B. Returns a character when ENTER is pressed
C. Display a character on the screen when a key is pressed
D. Does not display a character on the screen
Answer : A
38. An object is an allocated space in memory.
A. True
B. False
C.
D.
Answer : A
39. The library function exit() causes an exit from
A. The loop in which it occurs
B. The block in which it occurs
C. The function in which it occurs
D. The program in which it occurs
Answer : D
40. A function that is called automatically when an object is destroyed is known as
A. instantiation
B. function prototype
C. constructor
D. destructor
Answer : D
41. 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
42. Private members of a structure can be accessed directly from the outside of the structure.
A. True
B. False
C.
D.
Answer : B
43. Objects get destroyed in the reverse order as they are created.
A. True
B. False
C.
D.
Answer : A
44. _______ argument(s) are passed in case of unary overloaded operators.
A. Two
B. One
C. No
D. None of the above
Answer : B
45. The binding that binds a function call at run time is called
A. early binding
B. run time binding
C. late binding
D. linking
Answer : C
46. A destructor can have a return type.
A. True
B. False
C.
D.
Answer : B
47. In a for loop with a multi-statement loop body, semicolons should appear following
A. The for statement itself
B. The closing brace in a multi-statement loop body
C. Each statement within the loop body.
D. The test expression
Answer : C
48. Reference to an object behaves like a constant pointer.
A. True
B. False
C.
D.
Answer : B
49. The members of a class by default are private.
A. True
B. False
C.
D.
Answer : A
50. Protected members cannot be inherited.
A. True
B. False
C.
D.
Answer : B

Sharing is caring