18)struct base {int a,b;
base();
int virtual function1();
}
struct derv1:base{
int b,c,d;
derv1()
int virtual function1();
}
struct derv2 : base
{int a,e;
}
base::base()
{
a=2;b=3;
}
derv1::derv1(){
b=5;
c=10;d=11;}
base::function1()
{return(100);
}
derv1::function1()
{
return(200);
}
main()
base ba;
derv1 d1,d2;
printf("%d %d",d1.a,d1.b)
o/p is
a)a=2;b=3;
b)a=3; b=2;
c)a=5; b=10;
d)none
19) for the above program answer the following q's
main()
base da;
derv1 d1;
derv2 d2;
printf("%d %d %d",da.function1(),d1.function1(),d2.function1
());
o/p is
a)100,200,200;
b)200,100,200;
c)200,200,100;
d)none
20)struct {
int x;
int y;
}abc;
you can not access x by the following
1)abc-->x;
2)abc[0]-->x;
abc.x;
(abc)-->x;
a)1,2,3
b)2&3
c)1&2
d)1,3,4



18)struct base {int a,b; base(); int virtual function1(); } struct derv1:base{ int b,c,d; derv..

Answer / naresh s

18) d
o/p is
2 5
19)
d
o/p is
100 200 100
20) none
Answer is 1,2 & 4.

Is This Answer Correct ?    7 Yes 0 No

Post New Answer

More C Interview Questions

Explain what standard functions are available to manipulate strings?

0 Answers  


What is the auto keyword good for?

0 Answers  


Write a program to print ASCII code for a given digit.

0 Answers   EXL, HCL,


what is the difference between static variable and register variable?

3 Answers  


Write a c code segment using a for loop that calculates and prints the sum of the even integers from 2 to 30, inclusive?

4 Answers  






what is computer engg

1 Answers  


difference between function & structure

9 Answers   Verizon,


What is Bitwise Operator and how it works?

1 Answers  


Is this program statement valid? INT = 10.50;

0 Answers  


The process of repeatedly running a set of computer instructions until some condition is specifed a) condition b) sequential condition c) global d) iteration

0 Answers  


f(x,y,z) { y = y+1; z = z+x; } main() { int a,b; a = 2 b = 2; f(a+b,a,a); print a; } what is the value of 'a' printed

5 Answers  


How can you determine the maximum value that a numeric variable can hold?

0 Answers  


Categories