Chapter 12: Arrays and Structures - Online Test

Q1.

What will be the output of this program?

#include <iostream>

using namespace std;

struct ShoeType

{

string name;

double price;

};

int main()

{

ShoeType shoe1, shoe2;

shoe1.name = "Adidas";

shoe1.price = 9.99;

cout<< shoe1.name<< " # "<< shoe1.price<<endl;

shoe2 = shoe1;

shoe2.price = shoe2.price / 9;

cout<< shoe2.name<< " # "<< shoe2.price;

return 0;

Answer : Option A
Explaination / Solution:
No Explaination.


Q2. Which of the following is a properly defined structure?
Answer : Option D
Explaination / Solution:
No Explaination.


Q3.

A structure declaration is given below.

struct employee

{

int empno;

char ename[10];

}e[5];

Using above declaration which of the following statement is correct.

Answer : Option A
Explaination / Solution:
No Explaination.


Q4. Which of the following cannot be a structure member?
Answer : Option B
Explaination / Solution:
No Explaination.


Q5. When accessing a structure member ,the identifier to the left of the dot operator is the name of
Answer : Option A
Explaination / Solution:
No Explaination.