Which of the following statements are true regarding C ++ ?
(a) Overloading gives the capability to an existing operator to operate on other data types.
(b) Inheritance in object oriented programming provides support to reusability.
(c) When object of a derived class is defined, first the constructor of derived class is executed then constructor of a base class is executed.
(d) Overloading is a type of polymorphism.
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: C. (a), (b) and (d) only
Explanation
Overloading extends operators to new types and is a form of polymorphism; inheritance supports reuse. The base constructor runs before the derived one, so (c) is false.
More Programming Languages and Computer Graphics questions
- Which of the following are legal C statements? (a) int *P = &44; (b) int *P = &r; (c) int P = &a; (d) int P = a;
- On a 32-bit x86 machine: typedef struct { union { unsigned char a; unsigned short b; } U; unsigned char c; } S; S B[10]; S *p = &B[4]; S *q…
- Class Good has a field m and a method public boolean equals(Good n) { return n.m == m; }. In main: Good m1 = new Good(22), m2 = new Good(22…
- Consider the following function ) : f n unsigned int (unsigned int )( b = 0 unsigned int ; while (n) { b+ = n&1 ; n ≫>= 1 ; } return b;} ``…
- Consider a raster system with resolution 640 by 480 . What size is frame buffer (in bytes) for this system to store 12 bits per pixel?
- Consider the following statements regarding 2D transforms in computer graphics: 1 0 [ ] 2 × 2 S1 : is a matrix that reflects 0 −1 2D X (mir…