1. The order that struct members are defined does not affect the order in which
ID: 3763166 • Letter: 1
Question
1. The order that struct members are defined does not affect the order in which they are accessed a. true b. false
2. A struct is accessed by the struct variable name, the name of the struct, and the struct member name a. true b. false
3. Given: struct animal { bool mammalian; string habitat; int longevity; }; animal cat; Which of the following correctly initializes cat? a. mammalian = true; habitat = “house”; longevity = 12; b. cat.mammalian = true; cat.habitat = “house” cat.longevity = true; c. animal.cat.mammalian = true; animal.cat.habitat = “house”; animal.cat.longevity = 12; d. all the above may be used
4. Use the struct animal defined above and the statements: animal cat; animal dog; Which of the following statements are valid in C++? a. cat = dog; b. cat.mammalian = dog.mammalian; cat.habitat = dog.habitat; cat.longivity = dog.longivity; c. both a and b d. false
Explanation / Answer
1. option-a.(true)
2. option-a.(true?)
3.option-b. is correct way of initializing a structure .
4.option-b is valid
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.