Oop 2
Oop 2
What is the access specifier used to define members of a class that are accessible
only within the class?
a) private
b) protected
c) public
d) internal
Answer: a) private
Which of the following statements is true about static member functions in C++?
a) They can access only static data members of a class
b) They can be called using an object of the class
c) They cannot be declared const
d) They can access private data members of a class
Answer: a) They can access only static data members of a class
Arrays:
What happens if you try to access an element outside the bounds of an array in C++?
a) The program crashes
b) The program continues to execute without any error
c) The program displays a warning message
d) The behavior is undefined
Answer: d) The behavior is undefined