MCC - CIS162AB - C++ Level I
Study Guide for Test 2![]()
Completion of the study guide is NOT required, so it will not be turned in or submitted electronically. However, completing the study guide will help students prepare for the exam. In addition, the completed study guide may be used on the actual exam, because exams are open book and notes. If you can't find the answer to any of the questions, please feel free to ask your classmates and/or instructor.
Switch and For Loops:
What are the valid data types that can be used in the controlling expression of a switch statement?
Why is the switch statement good for processing menu choices (value must be equal)?
Can the break statement be used in switch, while, do-while and for-loops?
What does the break statement do in while, do-while, and for-loops?
What does the continue statement do in while, do-while, and for-loops?
What are the three parts of the for-loop definition?
In the initialization action, if the controlling variable is not already defined, can it be defined as a local variable of the for-loop?
File Processing:
Why use files?
What is sequential file processing?
What is the definition of an object?
What is the definition of a class?
What does the open member function do?
What does the close member function do?
When should the close member function be used?
What is considered the external filename?
What is considered the internal filename?
What is passed to the open function as an argument, the internal or external name?
What filename is declared when declaring an ifstream or ofstream object?
When should the fail member function be used?
Does the compiler require using the fail member function or is it a good practice?
The eof flag is set when the program attempts to read past the end of file.
How should we use the eof member function in a program?
When calling a member function the following syntax is used:
objectName.memberName(arguments).
For example, in the function call outFile.open("outfile.dat"),
outfile is the objectName,
open is the memberName, and
outfile.dat is the argument.
Be sure you understand the three parts and the significance of the dot (.) operator
Formatting Functions, Maniuplators, Char Functions:
Can the formatting flags (right, showpoint, etc.) be used when writing to a file?
Can the formatting functions (precision, width, etc) be used when writing to a file?
Which formatting function is needed to right align numeric information?
What are manipulators?
What characters are considered whitespace?
What do the toupper() and tolower() functions do?
What do the isupper() and islower() functions test for?
Arrays:
What is an array?
Each array element is referenced by an index, which is sometimes also called a subscript.
What is the declared size of an array?
If the declared size is stored in a variable like MAX_SIZE, must it have the const modifier?
When an array is declared, is the declared size stored anywhere by C++ automatically?
Is the first element in the array referenced with and index of zero or one?
When does an index become an out of range index?
Who must check for an out of range condition, C++ or the programmer?
For an array declared as int student[5], how many int elements are declared?
In the same array, what index value would reference the last valid array element (declared size - 1)?
In the same array, what would be the first index value that would be considered out-of-range?
What type of parameter in a function definition is used to pass the address of where the array begins?
Can a single array element be passed to a function?
Why is an array parameter more like a call-by-reference than a call-by-value parameter?
What modifier can be used with an array parameter to simulate a call-by-value?
Why do we need to pass the declared size to a function?
Why do we need to keep track of how many items were loaded into a partially filled array?
Why do we need to pass the number used or the number items loaded to a function?
What is a sequential search?
What are multidimensional arrays?
How many subscripts [] are needed to reference a particular element in a multidimensional array?
What row and column in a multidimensional array would the element
qty[2][2] be located (1st, 2nd, 3rd, etc)?
C-strings and String class:
What is a cstring variable?
What is the base type of cstrings arrays?
What is the Null character and what's its purpose in cstring processing?
What is the purpose of the cstring functions strlen, strcpy, strcmp, strncpy, strncmp?
What is the maximum number of characters that should be placed in a cstring variable (size – 1)?
Why isn't the number of characters stored in a cstring variable equal to declared size?
What is the class string used for?
What are the equivalents of strcpy, strlen, and strcmp for the class string?
Object-Oriented Programming:
What is the purpose of a structure?
What is included in a structure definition?
What is a class?
What is an object?
What should be included in a class definition?
Where should the actual class function definitions be entered?
How are member variables and functions referenced after declaring an object?
What is the difference between public and private variables?
What is the difference between public and private functions?
What is the purpose of accessor functions?
How many values should accessors return?
What is a constructor?
What are rules in naming constructors?
Should constructors be public or private?
Can constructors be overloaded?
Can constructors return a value?
When are constructors called?
Can constructors be called explicitly?
Does the compiler define a default constructor if one is not defined by the programmer?
What is a destructor?
What are rules in naming destructors?
When are destructors called?
What is an abstract data type (ADT)?
What does the interface tell us about an ADT?
What does the implementation tell us about an ADT?
Why are functions named as friend functions of a class?
Do friend functions gain access to the public or private variables and functions?
What is the definition of inheritance when talking about classes?
What is a base and derived class?
What is a parent and child class?
How are protected classes members inherited in the derived class?
Separate File Compilation:
What is stored in the interface file?
What is stored in the implementation file?
What is stored in the application file?
What is the purpose of #ifndef, #define, and #endif?
In what order should they be entered into a program?