Assessment Tool
Lecture 19: Strings
Content Tested: String library functions
Lecture Content:
-
String constants
-
Null-terminated array representation
-
String library
-
String initializers
-
Arrays of strings
Goals:
-
Develop analytic skills
-
Develop ability to draw reasonable inferences from observations
-
Improve memory skills
-
Develop appropriate study skills, strategies, and habits
-
Learn terms and facts of this subject
-
Learn concepts and theories of this subject
Assessment Technique: Categorizing Grids
Purpose:
This activity allows instructors to see if students understand the mapping
of operators they have seen and the new string functions.
Activity:
Today we learned about strings and the string library functions.
Fill in the grid below with the appropriate code using string library functions.
The column on the left assumes the variables a and b
are integers. The column on the right assumes a and b
are strings. You answers in the right column should be the analogous
operations on strings.
| int variables: |
string variables: |
| a = b |
|
| a == b |
|
| a = a + b |
|
| a < b |
|
| (double) a |
|
Possible Solutions:
| int variables: |
string variables: |
| a = b |
strcpy(a, b) |
| a == b |
strcmp(a, b) == 0 |
| a = a + b |
strcpy(a, b) |
| a < b |
strcmp(a, b) < 0 |
| (double) a |
strtod(a) |
Possible Uses of Activity:
-
Have students work in groups to complete this activity. The instructor
may want to circulate throughout the groups to ensure that each group is
making progress. After the groups have completed their lists, the
instructor can ask for votes on each item. It is important that the
instructor explains why each operation is analogous to the integer operations.
The a = a + b might be tough since with strings adding strings is like
concatenation.
-
Have students work individually on their lists and then form groups of
4-5 people to discuss their individual lists with other members of the
group.