structure struct keyword in C++ programming MCQs quiz question for exam with Solution
1.
Which of the following accesses a variable in structure b?
A. b->var;
B. b.var;
C. b-var;
D. b>var;
3. Which of the following is a properly defined struct?
A. struct {int a;}
B. struct a_struct {int a;}
C. struct a_struct int a;
D. struct a_struct {int a;};
A. b->var;
B. b.var;
C. b-var;
D. b>var;
3. Which of the following is a properly defined struct?
A. struct {int a;}
B. struct a_struct {int a;}
C. struct a_struct int a;
D. struct a_struct {int a;};
4.
What will be the output of this code?
struct ShoeType
{
char
style;
double
price;
};
ShoeType shoe1,shoe2;
shoe1.style='A';
shoe1.price=9.99;
cout<<shoe1.style<<" $
"<<shoe1.price<<endl;
shoe2= shoe1;
shoe2.price= shoe2.price/9;
cout<<shoe2.style<<" $
"<<shoe2.price<<endl;
|
SOLUTION
1.
Which of the following accesses a variable in structure b?
B. b.var;
3. Which of the following is a properly defined struct?
D. struct a_struct {int a;};
B. b.var;
3. Which of the following is a properly defined struct?
D. struct a_struct {int a;};
4.
What will be the output of this code?
|
0 comments:
Post a Comment