Lab 5: Prelab Questions

Write out your answers for these questions on a separate piece of paper.


Written Questions

Question #1: A string is a sequence of ____________.

Question #2: The first character of a string is at index ____________.

Question #3: Many data types in C++ are implemented in ____________, which ____________ both data and actions.

Question #4: A(n) ____________ implements an operation of a class.

Question #5: The ____________ statement allows a program to selectively execute other statements.

Programming Exercises

Suppose that word is some string initialized to some value.

Code #1: Write an expression that evaluates to the first character of word.

Code #2: Write an expression that evaluates to the size of word.

Code #3: Write an expression that compares if word is less than anotherWord (which is also a string).

Code #4: Write an expression that evaluates to the first three characters of word (a substring). Assume that word is at least three characters long.

Code #5: Write an expression that indicates where one of f, s, or z (upper or lowercase) first occurs in word.


Lab Home Page | Lab Exercise | Homework Projects
© 2003 by Prentice Hall. All rights reserved.
Report all errors to Jeremy D. Frens.