Quiz A data type can be declared as a structure using the keyword___________ Que
ID: 3877881 • Letter: Q
Question
Quiz
A data type can be declared as a structure using the keyword___________
Question 2 (3 points)
A structure field can be accessed by specifying the______________________
, followed by a____________________
, followed by the_________________________
Question 3 (1 point)
Passing a structure to a function using pass-by-reference could be overly time-consuming if the structure is complicate or contains arrays.
Question 3 options:
Save
Question 4 (2 points)
A structure is a collection of one or more ______________________
, possibly of different types, grouped together under a single ___________________________
for convient handling.
Save
Question 5 (2 points)
____________________________________can be used to give a name to some existing type, and this name can then be used to declare variables of that
Question 6 (1 point)
The overhead of passing a structure to a function using pass-by-value can be overcome by instead passing the address of a structure (pass-by-reference).
Question 6 options:
Save
Question 7 (1 point)
A structure can be used as part of the definition of another structure - a structure within a structure, called a nested structure.
Question 7 options:
Save
Question 8 (1 point)
Which statement could be used to access the year field of a dynamically declared date structure variable with the following struct declaration:
typedef struct date{
int month;
int day;
int year } Date;
Question 8 options:
my_date.year
my_date->year
my_date*year
&my_date.year
Save
Question 9 (1 point)
A structure may be nested as deeply as you want with the dot (.) operator associating nested access from___________________________
to ___________________________
Question 10 (1 point)
Which statement could be used to access the year field of a statically declared date structure variable with the following struct declaration:
typedef struct date{
int month;
int day;
int year } Date;my_date.year
Question 10 options:
my_date.year
my_date->year
my_date*year
(*my_date).year
Save
Question 11 (1 point)
The period (.) used to access the specific members of a structure is referred to as a _____________________________________________
True FalseExplanation / Answer
Q-1
A data type can be declared as a structure using the keyword___________
Answer- struct
Explanation- Structure is a user defined data type.It is used to combine
logically relted data of different data types.
To declare a structure STRUCT keyword is used.
Q-2
A structure field can be accessed by specifying the______________________
, followed by a____________________
, followed by the_________________________
Answer- Structure name, followed by a dot (.) i.e. structure member operator,
followed by Member name.
Explanation-we use Dot (.) operator in between "Structure name " & "Member name" to access structure
Example:
#include<stdio.h>
struct Vehicle
{
int wheels;
char vname[20];
char color[10];
}v1 = {2,"Activa","Black"};
int main()
{
printf("Vehicle No of Wheels : %d",v1.wheels);
printf("Vehicle Name : %s",v1.vname);
printf("Vehicle Color : %s",v1.color);
return(0);
}
output:
Vehicle No of Wheels : 2
Vehicle Name : Activa
Vehicle Color : Black
Q-3
Passing a structure to a function using pass-by-reference could be overly
time-consuming if the structure is complicate or contains arrays.
True
False
Answer- True
Explanation- if the structure is complicated or it contain array then it will be
best to use pass by reference.this could be time consuming.
Q-4
A structure is a collection of one or more ______________________
Answer-logically related data of different data types.
Explanation- We use structure when we need a single data type which can hold
collection of values of different data types.
Example:
struct student
{
int rollno;
char name[20];
double avg;
}
In above Example we have three different variables of different data type which are combine in
a single data type, stucture named student.
Q-5
_____________can be used to give a name to some existing
type, and this name can then be used to declare variables of that
Answer: typdef
Explanation:we can use "typedef" to provide another name to existing name
and we can use this name throughout the program.
Syntax:
typedef <Existing Name> <Another Name>
Example: typedef int BOOL marks;
BOOL status; //using another name
int value; //using real name
NOTE: As per the chegg policy i have provided the answer of FOUR question with additional one.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.