Exercise: Objects And Classes

Questions for: Objects And Classes

Which of the following statements is correct about the program given below?
class Bix
{
    public:
    static void MyFunction();
};
int main()
{
    void(*ptr)() = &Bix::MyFunction;
    return 0; 
}
A:
The program reports an error as pointer to member function cannot be defined outside the definition of class.
B:
The program reports an error as pointer to static member function cannot be defined.
C:
The program reports an error as pointer to member function cannot be defined without object.
D:
The program reports linker error.
Answer: D
No answer description is available. Let's discuss.
Which of the following is the only technical difference between structures and classes in C++?
A:
Member function and data are by default protected in structures but private in classes.
B:
Member function and data are by default private in structures but public in classes.
C:
Member function and data are by default public in structures but private in classes.
D:
Member function and data are by default public in structures but protected in classes.
Answer: C
No answer description is available. Let's discuss.
Which of the following means "The use of an object of one class in definition of another class"?
A:
Encapsulation
B:
Inheritance
C:
Composition
D:
Abstraction
Answer: C
No answer description is available. Let's discuss.
Which of the following can be overloaded?
A:
Object
B:
Functions
C:
Operators
D:
Both B and C
Answer: D
No answer description is available. Let's discuss.
What does a class hierarchy depict?
A:
It shows the relationships between the classes in the form of an organization chart.
B:
It describes "has a" relationships.
C:
It describes "kind of" relationships.
D:
It shows the same relationship as a family tree.
Answer: C
No answer description is available. Let's discuss.
Ad Slot (Above Pagination)
Quiz