Home

NEET PG - C++ Programming 1000+ MCQ [Solved] PDF Download

Thursday 9th of March 2023

Sharing is caring

1. cc ___________ option is used only to create object file
A. -a
B. -o
C. -c
D. none of these
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. 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
4. _______ argument(s) are passed in case of binary overloaded operators.
A. Two
B. One
C. No
D. None of the above
Answer : A
5. 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
6. 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
7. The new operator always returns a void pointer.
A. True
B. False
C.
D.
Answer : A
8. 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
9. What is the value of Friday in the following - enum days { Monday, Tuesday, Wednesday = -1, Thursday, Friday, Saturday = 6, Sunday}
A. 1
B. 5
C. 0
D. -3
Answer : A
10. Protected members cannot be inherited.
A. True
B. False
C.
D.
Answer : B
11. 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
12. 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
13. The member of a structure can be accessed through a pointer by
A. ->
B. dot operator
C. ::
D. >>
Answer : A
14. 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
15. 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
16. 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
17. Data objects can be initialized when allocating memory using 'new'.
A. True
B. False
C.
D.
Answer : A
18. 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
19. 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
20. 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
21. iostream is inheried from istream, ostream and ios class.
A. True
B. False
C.
D.
Answer : B
22. Element double Array[7] is which element of the array?
A. sixth
B. seventh
C. eighth
D. impossible to tell
Answer : C
23. When accessing a structure member, the identifier to the left of the dot operator is the name of
A. Structure member
B. Structure tag
C. Structure variable
D. The keyword struct.
Answer : C
24. 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
25. 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
26. By default, members cannot be inherited.
A. True
B. False
C.
D.
Answer : A
27. "[]" Operator is a unary operator.
A. True
B. False
C.
D.
Answer : A
28. 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
29. Sharing of common information are achieved by the concept of
A. Virtual copying
B. Inheritance
C. Encapsulation
D. None of these
Answer : B
30. 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
31. 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
32. Static member functions have file scope.
A. True
B. False
C.
D.
Answer : A
33. A destructor can have a return type.
A. True
B. False
C.
D.
Answer : B
34. Member function cannot be called from within a constructor.
A. True
B. False
C.
D.
Answer : A
35. 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
36. 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
37. 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
38. Dynamic memory can be allocated by the following declaration
A. new
B. volatile
C. static
D. ==
Answer : A
39. Objects get destroyed in the reverse order as they are created.
A. True
B. False
C.
D.
Answer : A
40. 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
41. 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
42. 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
43. The template function declaration specifies
A. template class
B. a generic class
C. exception
D. identifier
Answer : B
44. We cannot have the address of a constructor.
A. True
B. False
C.
D.
Answer : A
45. 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
46. If a friend function is declared inside a class it can access all data members of the class.
A. True
B. False
C.
D.
Answer : A
47. 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
48. 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
49. The ?: can be used to replace
A. if-else statement
B. wild cards
C. no meaning in C++
D. returns the value
Answer : A
50. A destructor can have arguments like constructor.
A. True
B. False
C.
D.
Answer : B

Sharing is caring