0% found this document useful (0 votes)
22 views1 page

C, C++ Questions: Ans. B

The document discusses C and C++ concepts including: 1) Calling a virtual method through a base class pointer initialized with a derived class object will call the derived class method. 2) A code sample using a macro to calculate circle area for different radii outputs the correct area values. 3) Different pointer declarations - int(*p)[10] is a pointer to an array of 10 ints, int*f() is a function returning a pointer to int, int(*pf)() is a pointer to a function returning int, and int*p[10] is an array of 10 pointers to int.

Uploaded by

Rajesh Verma
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views1 page

C, C++ Questions: Ans. B

The document discusses C and C++ concepts including: 1) Calling a virtual method through a base class pointer initialized with a derived class object will call the derived class method. 2) A code sample using a macro to calculate circle area for different radii outputs the correct area values. 3) Different pointer declarations - int(*p)[10] is a pointer to an array of 10 ints, int*f() is a function returning a pointer to int, int(*pf)() is a pointer to a function returning int, and int*p[10] is an array of 10 pointers to int.

Uploaded by

Rajesh Verma
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

C,C++ Questions

1. Base class has some virtual method and derived class has a method with the same name. If we initialize the base class pointer with derived object,. calling of that virtual method will result in which method being called? a. Base method b. Derived method.. Ans. b 2. For the following C program #define AREA(x)(3.14*x*x) main() {float r1=6.25,r2=2.5,a; a=AREA(r1); printf("\n Area of the circle is %f", a); a=AREA(r2); printf("\n Area of the circle is %f", a); } What is the output? Ans. Area of the circle is 122.656250 Area of the circle is 19.625000 3. What do the following statements indicate. Explain. int(*p)[10] int*f() int(*pf)() int*p[10]

Refer to: -- Kernighan & Ritchie page no. 122 -- Schaum series page no. 323 4. void main() { int d=5; printf("%f",d); } Ans: Undefined

You might also like