Deck 9: Records Structs

ملء الشاشة (f)
exit full mode
سؤال
The components of a struct are called the ____ of the struct.

A) variables
B) identifiers
C) elements
D) members
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
Typically, in a program, a struct is defined ____ in the program.

A) in the main function
B) before the definitions of all the functions
C) after the definitions of all the functions
D) in any function
سؤال
A function can return a value of the type array.
سؤال
Which of the following struct definitions is correct in C++?

A) struct studentType
<strong>Which of the following struct definitions is correct in C++?</strong> A) struct studentType   B) struct studentType   C) int struct studentType   D) struct studentType   <div style=padding-top: 35px>
B) struct studentType
<strong>Which of the following struct definitions is correct in C++?</strong> A) struct studentType   B) struct studentType   C) int struct studentType   D) struct studentType   <div style=padding-top: 35px>
C) int struct studentType
<strong>Which of the following struct definitions is correct in C++?</strong> A) struct studentType   B) struct studentType   C) int struct studentType   D) struct studentType   <div style=padding-top: 35px>
D) struct studentType
<strong>Which of the following struct definitions is correct in C++?</strong> A) struct studentType   B) struct studentType   C) int struct studentType   D) struct studentType   <div style=padding-top: 35px>
سؤال
In structs, you access a component by using the struct name together with the relative position of the component.
سؤال
The syntax for accessing a struct member is structVariableName____.

A) .memberName
B) *memberName
C) [memberName]
D) $memberName
سؤال
Consider the following statements: <strong>Consider the following statements:   personalInfo person1, person2; CommonInfo person3, person4; Which of the following statements is valid in C++?</strong> A) person1 = person3; B) person2 = person1; C) person2 = person3; D) person2 = person4; <div style=padding-top: 35px> personalInfo person1, person2;
CommonInfo person3, person4;
Which of the following statements is valid in C++?

A) person1 = person3;
B) person2 = person1;
C) person2 = person3;
D) person2 = person4;
سؤال
Aggregate input/output operations are allowed on a struct variable.
سؤال
Consider the following struct definition: struct rectangleData
{
Double length;
Double width;
Double area;
Double perimeter;
};
Which of the following variable declarations is correct?

A) rectangle rectangleData;
B) struct rectangleData();
C) rectangleData myRectangle;
D) rectangleData rectangle = new rectangleData();
سؤال
You can declare struct variables when you define a struct.
سؤال
An array name and index are separated using ____.

A) curly brackets
B) square brackets
C) a dot
D) a comma
سؤال
A function can return a value of the type struct.
سؤال
Relational operations can be used on struct variables.
سؤال
In C++, the ____ symbol is an operator, called the member access operator.

A) :(colon)
B) .(dot)
C) ,(comma)
D) $ (dollar sign)
سؤال
A struct is typically a ____ data structure.

A) simple
B) dynamic
C) heterogeneous
D) linked
سؤال
Data in a struct variable must be read one member at a time.
سؤال
To access a structure member (component), you use the struct variable name together with the member name; these names are separated by a dot (period).
سؤال
Consider the following statements: struct rectangleData
{
Double length;
Double width;
Double area;
Double perimeter;
};
RectangleData bigRect;
Which of the following statements correctly initializes the component length of bigRect?

A) bigRect = {10};
B) bigRect.length = 10;
C) length[0]= 10;
D) bigRect[0]= 10
سؤال
Consider the following statements: struct rectangleData
{
Double length;
Double width;
Double area;
Double perimeter;
};
RectangleData bigRect;
Which of the following statements is valid in C++?

A) cin >> bigRect;
B) cin >> bigRect.length;
C) perimeter = 2 * (length + width);
D) area = length * width;
سؤال
You can use an assignment statement to copy the contents of one struct into another struct of the same type.
سؤال
Consider the following function prototype: int seqSearch(const listType& list, int searchItem);
The actual parameter cannot be modified by ____.

A) seqSearch
B) listType
C) list
D) searchItem
سؤال
A struct variable can be passed as a parameter ____.

A) only by const
B) only by reference
C) only by value
D) either by value or by reference
سؤال
Memory is allocated for struct variables only when you ____________________ them.
سؤال
Consider the following statements. struct circleData
{
Double radius;
Double area;
Double circumference;
};
CircleData circle;
Which of the following statements is valid in C++?

A) cin >> circle.radius;
Circle.area = 3.14 * radius * radius;
B) cin >> circle.radius;
Circle.area = 3.14 * circle.radius * radius;
C) cin >> circle;
D) cin >> circle.radius;
سؤال
Consider the following statements: <strong>Consider the following statements:   applianceType applianceList[25]; Which of the following best describes applianceList?</strong> A) It is a multidimensional array. B) It is a struct. C) It is an array of structs. D) It is a struct of arrays. <div style=padding-top: 35px> applianceType applianceList[25];
Which of the following best describes applianceList?

A) It is a multidimensional array.
B) It is a struct.
C) It is an array of structs.
D) It is a struct of arrays.
سؤال
If a variable is passed by ____________________, then when the formal parameter changes, the actual parameter also changes.
سؤال
Arrays are passed by ____________________ only.
سؤال
A list has two items associated with it: ____.

A) the length and the references
B) the values and the references
C) the indexes and the length
D) the values and the length
سؤال
Consider the following statements: <strong>Consider the following statements:   paintType paint; What is the data type of paint.supplier?</strong> A) string B) paintType C) supplierType D) struct <div style=padding-top: 35px> paintType paint;
What is the data type of paint.supplier?

A) string
B) paintType
C) supplierType
D) struct
سؤال
You can assign the value of one struct variable to another struct variable of ____ type.

A) a simple data
B) the same
C) an array
D) any
سؤال
Which of the following aggregate operations can be executed on array variables?

A) Arithmetic
B) Assignment
C) Function returning a value
D) Parameter passing by reference
سؤال
Consider the following statements: struct rectangleData
{
Double length;
Double width;
Double area;
Double perimeter;
};
RectangleData bigRect;
RectangleData smallRect;
Which of the following statements is legal in C++?

A) if (bigRect == smallRect)
B) if (bigRect != smallRect)
C) if (bigRect.length == width)
D) if (bigRect.length == smallRect.width)
سؤال
Consider the following statements: <strong>Consider the following statements:   applianceType applianceList[25]; Which of the following statements correctly initializes the cost of each appliance to 0?</strong> A) applianceList.cost = 0; B) applianceList.cost[25] = 0; C) for (int j = 1; j < 25; j++) ApplianceList.cost[j] = 0; D) for (int j = 0; j < 25; j++) ApplianceList.cost[j] = 0; <div style=padding-top: 35px> applianceType applianceList[25];
Which of the following statements correctly initializes the cost of each appliance to 0?

A) applianceList.cost = 0;
B) applianceList.cost[25] = 0;
C) for (int j = 1; j < 25; j++)
ApplianceList.cost[j] = 0;
D) for (int j = 0; j < 25; j++)
ApplianceList.cost[j] = 0;
سؤال
Consider the following struct definition:
const int ARRAY_SIZE = 1000;
struct listType
{
int listElem[ARRAY_SIZE];
int listLength;
};
The statement that declares intList to be a struct variable of type listType is ____________________.
سؤال
A struct is a(n) ____________________, not a declaration.
سؤال
Which of the following is an allowable aggregate operation on a struct?

A) Arithmetic
B) Assignment
C) Input/output
D) Comparison
سؤال
The following statement defines a struct houseType with a total of ____________________ member(s).
struct houseType
{
string style;
int numOfBedrooms;
int numOfBathrooms;
int numOfCarsGarage;
int yearBuilt;
};
سؤال
Consider the following statements: <strong>Consider the following statements:   studentType1 student1, student2; Struct studentType2 StudentType2 student3, student4; Which of the following statements is valid in C++?  </strong> A) student2 = student3; B) student1 = student4; C) student2.ID = ID; D) student1.ID = student3.ID; <div style=padding-top: 35px> studentType1 student1, student2;
Struct studentType2
StudentType2 student3, student4;
Which of the following statements is valid in C++?
<strong>Consider the following statements:   studentType1 student1, student2; Struct studentType2 StudentType2 student3, student4; Which of the following statements is valid in C++?  </strong> A) student2 = student3; B) student1 = student4; C) student2.ID = ID; D) student1.ID = student3.ID; <div style=padding-top: 35px>

A) student2 = student3;
B) student1 = student4;
C) student2.ID = ID;
D) student1.ID = student3.ID;
سؤال
Consider the following statements: struct rectangleData
{
Double length;
Double width;
Double area;
Double perimeter;
};
RectangleData bigRect;
Which of the following statements is valid in C++?

A) cin >> bigRect.length >> width;
B) cout << bigRect.length;
C) cout << bigRect;
D) cout << length;
سؤال
To compare struct variables, you compare them ____.

A) by reference
B) by value
C) index-wise
D) member-wise
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/40
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 9: Records Structs
1
The components of a struct are called the ____ of the struct.

A) variables
B) identifiers
C) elements
D) members
D
2
Typically, in a program, a struct is defined ____ in the program.

A) in the main function
B) before the definitions of all the functions
C) after the definitions of all the functions
D) in any function
B
3
A function can return a value of the type array.
False
4
Which of the following struct definitions is correct in C++?

A) struct studentType
<strong>Which of the following struct definitions is correct in C++?</strong> A) struct studentType   B) struct studentType   C) int struct studentType   D) struct studentType
B) struct studentType
<strong>Which of the following struct definitions is correct in C++?</strong> A) struct studentType   B) struct studentType   C) int struct studentType   D) struct studentType
C) int struct studentType
<strong>Which of the following struct definitions is correct in C++?</strong> A) struct studentType   B) struct studentType   C) int struct studentType   D) struct studentType
D) struct studentType
<strong>Which of the following struct definitions is correct in C++?</strong> A) struct studentType   B) struct studentType   C) int struct studentType   D) struct studentType
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
5
In structs, you access a component by using the struct name together with the relative position of the component.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
6
The syntax for accessing a struct member is structVariableName____.

A) .memberName
B) *memberName
C) [memberName]
D) $memberName
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
7
Consider the following statements: <strong>Consider the following statements:   personalInfo person1, person2; CommonInfo person3, person4; Which of the following statements is valid in C++?</strong> A) person1 = person3; B) person2 = person1; C) person2 = person3; D) person2 = person4; personalInfo person1, person2;
CommonInfo person3, person4;
Which of the following statements is valid in C++?

A) person1 = person3;
B) person2 = person1;
C) person2 = person3;
D) person2 = person4;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
8
Aggregate input/output operations are allowed on a struct variable.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
9
Consider the following struct definition: struct rectangleData
{
Double length;
Double width;
Double area;
Double perimeter;
};
Which of the following variable declarations is correct?

A) rectangle rectangleData;
B) struct rectangleData();
C) rectangleData myRectangle;
D) rectangleData rectangle = new rectangleData();
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
10
You can declare struct variables when you define a struct.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
11
An array name and index are separated using ____.

A) curly brackets
B) square brackets
C) a dot
D) a comma
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
12
A function can return a value of the type struct.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
13
Relational operations can be used on struct variables.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
14
In C++, the ____ symbol is an operator, called the member access operator.

A) :(colon)
B) .(dot)
C) ,(comma)
D) $ (dollar sign)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
15
A struct is typically a ____ data structure.

A) simple
B) dynamic
C) heterogeneous
D) linked
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
16
Data in a struct variable must be read one member at a time.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
17
To access a structure member (component), you use the struct variable name together with the member name; these names are separated by a dot (period).
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
18
Consider the following statements: struct rectangleData
{
Double length;
Double width;
Double area;
Double perimeter;
};
RectangleData bigRect;
Which of the following statements correctly initializes the component length of bigRect?

A) bigRect = {10};
B) bigRect.length = 10;
C) length[0]= 10;
D) bigRect[0]= 10
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
19
Consider the following statements: struct rectangleData
{
Double length;
Double width;
Double area;
Double perimeter;
};
RectangleData bigRect;
Which of the following statements is valid in C++?

A) cin >> bigRect;
B) cin >> bigRect.length;
C) perimeter = 2 * (length + width);
D) area = length * width;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
20
You can use an assignment statement to copy the contents of one struct into another struct of the same type.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
21
Consider the following function prototype: int seqSearch(const listType& list, int searchItem);
The actual parameter cannot be modified by ____.

A) seqSearch
B) listType
C) list
D) searchItem
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
22
A struct variable can be passed as a parameter ____.

A) only by const
B) only by reference
C) only by value
D) either by value or by reference
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
23
Memory is allocated for struct variables only when you ____________________ them.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
24
Consider the following statements. struct circleData
{
Double radius;
Double area;
Double circumference;
};
CircleData circle;
Which of the following statements is valid in C++?

A) cin >> circle.radius;
Circle.area = 3.14 * radius * radius;
B) cin >> circle.radius;
Circle.area = 3.14 * circle.radius * radius;
C) cin >> circle;
D) cin >> circle.radius;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
25
Consider the following statements: <strong>Consider the following statements:   applianceType applianceList[25]; Which of the following best describes applianceList?</strong> A) It is a multidimensional array. B) It is a struct. C) It is an array of structs. D) It is a struct of arrays. applianceType applianceList[25];
Which of the following best describes applianceList?

A) It is a multidimensional array.
B) It is a struct.
C) It is an array of structs.
D) It is a struct of arrays.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
26
If a variable is passed by ____________________, then when the formal parameter changes, the actual parameter also changes.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
27
Arrays are passed by ____________________ only.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
28
A list has two items associated with it: ____.

A) the length and the references
B) the values and the references
C) the indexes and the length
D) the values and the length
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
29
Consider the following statements: <strong>Consider the following statements:   paintType paint; What is the data type of paint.supplier?</strong> A) string B) paintType C) supplierType D) struct paintType paint;
What is the data type of paint.supplier?

A) string
B) paintType
C) supplierType
D) struct
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
30
You can assign the value of one struct variable to another struct variable of ____ type.

A) a simple data
B) the same
C) an array
D) any
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
31
Which of the following aggregate operations can be executed on array variables?

A) Arithmetic
B) Assignment
C) Function returning a value
D) Parameter passing by reference
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
32
Consider the following statements: struct rectangleData
{
Double length;
Double width;
Double area;
Double perimeter;
};
RectangleData bigRect;
RectangleData smallRect;
Which of the following statements is legal in C++?

A) if (bigRect == smallRect)
B) if (bigRect != smallRect)
C) if (bigRect.length == width)
D) if (bigRect.length == smallRect.width)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
33
Consider the following statements: <strong>Consider the following statements:   applianceType applianceList[25]; Which of the following statements correctly initializes the cost of each appliance to 0?</strong> A) applianceList.cost = 0; B) applianceList.cost[25] = 0; C) for (int j = 1; j < 25; j++) ApplianceList.cost[j] = 0; D) for (int j = 0; j < 25; j++) ApplianceList.cost[j] = 0; applianceType applianceList[25];
Which of the following statements correctly initializes the cost of each appliance to 0?

A) applianceList.cost = 0;
B) applianceList.cost[25] = 0;
C) for (int j = 1; j < 25; j++)
ApplianceList.cost[j] = 0;
D) for (int j = 0; j < 25; j++)
ApplianceList.cost[j] = 0;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
34
Consider the following struct definition:
const int ARRAY_SIZE = 1000;
struct listType
{
int listElem[ARRAY_SIZE];
int listLength;
};
The statement that declares intList to be a struct variable of type listType is ____________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
35
A struct is a(n) ____________________, not a declaration.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
36
Which of the following is an allowable aggregate operation on a struct?

A) Arithmetic
B) Assignment
C) Input/output
D) Comparison
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
37
The following statement defines a struct houseType with a total of ____________________ member(s).
struct houseType
{
string style;
int numOfBedrooms;
int numOfBathrooms;
int numOfCarsGarage;
int yearBuilt;
};
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
38
Consider the following statements: <strong>Consider the following statements:   studentType1 student1, student2; Struct studentType2 StudentType2 student3, student4; Which of the following statements is valid in C++?  </strong> A) student2 = student3; B) student1 = student4; C) student2.ID = ID; D) student1.ID = student3.ID; studentType1 student1, student2;
Struct studentType2
StudentType2 student3, student4;
Which of the following statements is valid in C++?
<strong>Consider the following statements:   studentType1 student1, student2; Struct studentType2 StudentType2 student3, student4; Which of the following statements is valid in C++?  </strong> A) student2 = student3; B) student1 = student4; C) student2.ID = ID; D) student1.ID = student3.ID;

A) student2 = student3;
B) student1 = student4;
C) student2.ID = ID;
D) student1.ID = student3.ID;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
39
Consider the following statements: struct rectangleData
{
Double length;
Double width;
Double area;
Double perimeter;
};
RectangleData bigRect;
Which of the following statements is valid in C++?

A) cin >> bigRect.length >> width;
B) cout << bigRect.length;
C) cout << bigRect;
D) cout << length;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
40
To compare struct variables, you compare them ____.

A) by reference
B) by value
C) index-wise
D) member-wise
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.