Home

DRDO - C++ Programming 1000+ MCQ [Solved] PDF Download

Thursday 9th of March 2023

Sharing is caring

1. 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
2. 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
3. We cannot have the address of a constructor.
A. True
B. False
C.
D.
Answer : A
4. The ?: can be used to replace
A. if-else statement
B. wild cards
C. no meaning in C++
D. returns the value
Answer : A
5. 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
6. Overloaded functions
A. Are a group of functions with the same name
B. All have the same number and types of arguments
C. Make life simpler for programmer
D. May fail unexpectedly due to stress
Answer : A
7. In a class, only the member function can access data, which is not accessible to outside. This feature is called:
A. Data security
B. Data hiding
C. Data manipulation
D. Data definition
Answer : B
8. The exception is processed using
A. unexpected()
B. perform()
C. catch()
D. try()
Answer : C
9. The signature of a function is
A. The return type
B. The number and type of arguments
C. The class of a function
D. None of the above
Answer : D
10. The members of a class can be made private by
A. declaring them private
B. by default they are private
C. by declaring them in the beginning of the program immediately after main()
D. they are always public
Answer : A
11. Member function cannot be called from within a constructor.
A. True
B. False
C.
D.
Answer : A
12. When you overload an arithmetic assignment operator, the result
A. Goes in the object to the right of the operator
B. Goes in the object to the left of the operator
C. Goes in the object of which the operator is a member
D. Must be returned
Answer : B
13. Data objects can be initialized when allocating memory using 'new'.
A. True
B. False
C.
D.
Answer : A
14. 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
15. _______ argument(s) are passed in case of unary overloaded operators.
A. Two
B. One
C. No
D. None of the above
Answer : B
16. 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
17. cc ___________ option is used only to create object file
A. -a
B. -o
C. -c
D. none of these
Answer : B
18. Static member functions have file scope.
A. True
B. False
C.
D.
Answer : A
19. 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
20. 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
21. In C++, the exception handler is invoked with a-
A. try block
B. throw exception
C. catch function
D. abort()
Answer : B
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. Which of the following is true about const member functions?
A. const members can be invoked on both const as well as nonconst objects
B. const members can be invoked only on const objects and not on nonconst objects
C. nonconst members can be invoked on const objects as well as nonconst objects
D. none of the above
Answer : B
24. 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
25. 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
26. In C++, identifiers have to be declared at the beginning of the blocks.
A. True
B. False
C.
D.
Answer : A
27. 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
28. A destructor can have arguments like constructor.
A. True
B. False
C.
D.
Answer : B
29. 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
30. A direct access file is:
A. A file in which recoreds are arranged in a way they are inserted in a file
B. A file in which records are arranged in a particular order
C. Files which are stored on a direct access storage medium
D. None of the above
Answer : C
31. 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
32. In C++, the keyword auto can be used for
A. Automatic assignment of data to object during instantiation
B. Automatic call of a function
C. To declare a local variable
D. It is not a keyword in C++
Answer : C
33. If class A is friend of class B and if class B is friend of class C, which of the following is true?
A. Class C is friend of class A
B. Class A is friend of class C
C. Class A and Class C do not have any friend relationship
D. None of the above
Answer : B
34. Class is similar to a variable.
A. True
B. False
C.
D.
Answer : B
35. main() returns a value of type
A. real
B. char
C. int
D. null
Answer : C
36. A normal C++ operator that acts in a special way on newly defined data types is said to be
A. Glorified
B. Encapsulated
C. Classified
D. Overloaded
Answer : D
37. 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
38. 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
39. 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
40. this' pointer has to be used while accessing data members in a member function.
A. True
B. False
C.
D.
Answer : A
41. 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
42. Element double Array[7] is which element of the array?
A. sixth
B. seventh
C. eighth
D. impossible to tell
Answer : C
43. The member of a structure can be directly accessed by
A. ->
B. dot operator
C. ::
D. >>
Answer : B
44. Static data member occurs in only class scope.
A. True
B. False
C.
D.
Answer : B
45. 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
46. The following syntax is valid. void inline gram_ panchayat :: show_gram_ panchayat_info().
A. True
B. False
C.
D.
Answer : B
47. 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
48. Protected members cannot be inherited.
A. True
B. False
C.
D.
Answer : B
49. The member of a structure can be accessed through a pointer by
A. ->
B. dot operator
C. ::
D. >>
Answer : A
50. 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

Sharing is caring