Professional Documents
Culture Documents
Structures
1. Email *
2. You can declare struct variables when you define a struct. 1 point
True
False
3. In structs, you access a component by using the struct name together with the relative position of the 1 point
component
True
False
https://docs.google.com/forms/d/19zZZhWB7eIPmOSc12wko9mzVnRr7KhfHPhqgK8uP9aA/edit 1/14
4/6/23, 5:00 PM Structures
4. To access a structure member (component), you use the struct variable name together with the member 1 point
True
False
5. You can use an assignment statement to copy the contents of one struct variable into another struct variable 1 point
of the same type.
True
False
True
False
https://docs.google.com/forms/d/19zZZhWB7eIPmOSc12wko9mzVnRr7KhfHPhqgK8uP9aA/edit 2/14
4/6/23, 5:00 PM Structures
True
False
True
False
True
False
https://docs.google.com/forms/d/19zZZhWB7eIPmOSc12wko9mzVnRr7KhfHPhqgK8uP9aA/edit 3/14
4/6/23, 5:00 PM Structures
True
False
simple
homogenous
heterogeneous
multi
https://docs.google.com/forms/d/19zZZhWB7eIPmOSc12wko9mzVnRr7KhfHPhqgK8uP9aA/edit 4/14
4/6/23, 5:00 PM Structures
12. The components of a struct are called the ____ of the struct. 1 point
variables
identifiers
elements
members
https://docs.google.com/forms/d/19zZZhWB7eIPmOSc12wko9mzVnRr7KhfHPhqgK8uP9aA/edit 5/14
4/6/23, 5:00 PM Structures
rectangle rectangleData;
struct rectangleData();
rectangleData myRectangle;
rectangleData rectangle.length;
in any function
https://docs.google.com/forms/d/19zZZhWB7eIPmOSc12wko9mzVnRr7KhfHPhqgK8uP9aA/edit 6/14
4/6/23, 5:00 PM Structures
16. An array name and its index are separated using ____. 1 point
curly braces
square brackets
a dot
a comma
.memberName
*memberName
[memberName]
$memberName
https://docs.google.com/forms/d/19zZZhWB7eIPmOSc12wko9mzVnRr7KhfHPhqgK8uP9aA/edit 7/14
4/6/23, 5:00 PM Structures
Which of the following statements correctly initializes the member length of bigRect?
bigRect = {10};
bigRect.length = 10;
length[0]= 10;
bigRect[0]= 10
19. In C++, the ____ symbol is an operator, called the member access operator. 0 points
:(colon)
.(dot)
,(comma)
$ (dollar sign)
https://docs.google.com/forms/d/19zZZhWB7eIPmOSc12wko9mzVnRr7KhfHPhqgK8uP9aA/edit 8/14
4/6/23, 5:00 PM Structures
rectangleData bigRect;
https://docs.google.com/forms/d/19zZZhWB7eIPmOSc12wko9mzVnRr7KhfHPhqgK8uP9aA/edit 9/14
4/6/23, 5:00 PM Structures
21. 20. Consider the following statements: struct personalInfo { string name; int age; double height; double 1 point
person1 = person3;
person2 = person1;
person2 = person3;
person2 = person4;
22. . If a variable is passed by ____________________, then when the formal parameter changes, the actual 1 point
parameter also changes.
23. Consider the following struct definition: const int ARRAY_SIZE = 1000; struct listType { int 1 point
listElem[ARRAY_SIZE]; int listLength; };
The statement that declares intList to be a struct variable of type listType is ____________________.
https://docs.google.com/forms/d/19zZZhWB7eIPmOSc12wko9mzVnRr7KhfHPhqgK8uP9aA/edit 10/14
4/6/23, 5:00 PM Structures
24. Memory is allocated for struct variables only when you ____________________ them. 1 point
25. The following statement defines a struct houseType with a total of ____________________ member(s). 1 point
struct houseType { string style; int numOfBedrooms; int numOfBathrooms; int numOfCarsGarage; int
yearBuilt; };
27. Consider the following statements: struct supplierType { string name; int supplierID; }; struct paintType { 1 point
supplierType supplier; string color; string paintID; }; paintType paint; What is the data type of paint.supplier?
string
paintType
supplierType
struct
https://docs.google.com/forms/d/19zZZhWB7eIPmOSc12wko9mzVnRr7KhfHPhqgK8uP9aA/edit 11/14
4/6/23, 5:00 PM Structures
28. Consider the following statements: struct supplierType { string name; int supplierID; }; struct applianceType { 1 point
supplierType supplier; string modelNo; double cost; }; applianceType applianceList[25]; Which of the
following statements correctly initialize the cost of each applianceList element to 0?
applianceList.cost = 0;
applianceList.cost[25] = 0;
29. A list has two items associated with it: ____. 1 point
https://docs.google.com/forms/d/19zZZhWB7eIPmOSc12wko9mzVnRr7KhfHPhqgK8uP9aA/edit 12/14
4/6/23, 5:00 PM Structures
30. Which of the following is an allowable aggregate operation on struct variables? 1 point
Arithmetic
Assignment
Input/output
Comparison
Forms
https://docs.google.com/forms/d/19zZZhWB7eIPmOSc12wko9mzVnRr7KhfHPhqgK8uP9aA/edit 13/14
4/6/23, 5:00 PM Structures
https://docs.google.com/forms/d/19zZZhWB7eIPmOSc12wko9mzVnRr7KhfHPhqgK8uP9aA/edit 14/14