Assessment Tool
Lecture 17: Structures
Content Tested: Applications of Structures
Lecture Content:
-
Data Structures
-
Heterogeneous structures
-
Type definitions
-
Field selection
-
Structs as parameters
Goals:
-
Develop ability to apply principles and generalizations already learned
to new problems and situations
-
Learn concepts and theories
-
Develop capacity to think for oneself
Assessment Technique: Application Cards
Purpose:
Instructors can find out how well students understand possible applications
of structures and defining new types.
Activity:
In today's lecture we saw how to define a new type using a struct.
Please give examples of applications that might use structs. After
giving the examples, please write the C code for defining structures of
these types.
Here are two examples:
A complex number type containing a real part and an imaginary part.
typedef struct {
double real; /* real
part */
double imag; /* imaginary
part */
} complex_t; /*
One convention is to name new types with name_t */
A student record type containing an ID, a grade point average, and year
in school.
typedef struct {
int id;
/* id number unique for each student */
double gpa; /*
grade point average */
int year;
/* year in school (1 = freshman, 2 = sophomore,
3 = junior, 4 = senior, 5 = other */
} student_t;
Possible Uses of Activity:
-
Have students write applications individually and submit these to the instructor
anonymously. The instructor reads the applications and the class
discusses possible larger applications or functions that might use these
data structures.
-
Each student writes an application and explains their application to the
rest of the class.
-
Break students into small groups (2-4 people) and have each group find
five or more applications. Have each group explain their applications
to the rest of the class.