Tutorials - C++ Programming Quiz - Structures

Lesson 7: Structures

If you haven't already done so, be sure to read through Cprogramming.com's tutorial on Structures. Otherwise, best of luck with the quiz!

1. Which of the following accesses a variable in structure b?
A. b->var;
B. b.var;
C. b-var;
D. b>var;

2. Which of the following accesses a variable in a pointer to a structure, *b?
A. b->var;
B. b.var;
C. b-var;
D. b>var;

3. Which of the following is a properly defined struct?
A. struct {int a;}
B. struct a_struct {int a;}
C. struct a_struct int a;
D. struct a_struct {int a;};

4. Which properly declares a variable of struct foo?
A. struct foo;
B. foo var;
C. foo;
D. int foo;


Answer Key
Next lesson: Lesson 8, arrays