Why structures are defined globally ?
You save many lines of code by not rewriting an identical structure definition in each function that uses it.
You will never change its definition.
It is required in C++.
All of the above.
What will be the output of this program ?
# include
using namespace std;
int main ( )
{
struct ShoeType {
char style;
double price;
};
ShoeType shoe1,shoe2;
shoe1.style='Adidas';
shoe1.price=9.99;
cout<
shoe2=shoe1;
shoe2.price=shoe2.price/9;
cou<
return 0;
}
Adidas $9.99
Adidas $1.11
Adidas $9.11
Adidas $11.11
None of the mentioned
What is the use of structures in C++ ?
Provides a way to bind data and function together.
Provides a way to group data elements.
Provides a way to break the data elements into functions.
Provides a way to allocate data elements.
Which of the following is the correct syntax to access the member 'roll no' of a structure variable named 's1' ?
s1.roll no
roll no.s1
s1.roll no( )
roll no. s1( )
What will be used when terminating a structure ?
:
;
;;
What is needed to access the elements of the structure ?
The instance of the structure
Structure name
Struct keyword
Structure tag
Which of the following is a properly defined structure ?
Struct {int a;}
Struct a_struct {int a;}
Struct a_struct int a;
Which operator is used to access a structure member ?
. (dot) operator
= (assignment) operator
, (comma) operator
:: (scope) operator
What is the other name of declaration of structure ?
Structure creator
Structure signifier
Structure specifier
None of these
What is the alterantive name of data elements in structures ?
Objects
Members
Datas