Midterm 1 Flashcards
What value will the function eof return if there are more characters to be read in the input stream?
false
It is possible for a structure variable to be a member of another structure variable.
true
What will inFile.fail( ) return if the file associated with the stream inFile cannot be opened?
true
The data members of a class are usually placed in the private section of a class.
true
The expression s->m; indicates that s is a structure pointer and m is a structure member.
true
If the implementation of a member function calls another member function, you do not need to use dot notation.
true
A constructor cannot specify a return type.
true
The implementation of the member functions cannot access the private section of the class.
false
Object-oriented design first identifies the objects required in a problem.
true
q In object-oriented design, it is considered a correct procedure to implement a little, then test.
true
- When passing a file stream object to a function, you should always pass it by reference.
true
- You must use the private access specification for all data members of a class.
true
- By default, when an object is assigned to another, each member of one object is copied to its counterpart in the other object.
true
A static member variable can be used when there are no objects of the class in existence.
true
A class may have this many default constructor(s).
at most one
Which of the following assigns a value to the hourlyWage member of employee[2]
employee[2].hourlyWage = 100.00;
Passing a structure as a constant reference parameter to a function does this
guarantees not to result in changes to the structure’s members
This data type can be used to create files and write information to them but cannot be used to read information from them.
ofstream
Class type declarations (the class interface) are usually stored here
in their own header files
A class is a(n) ________ that is defined by the programmer
data type
If the compiler encounters the line #ifndef BUTTON_H
go to the next line
Which is the best prototype for a member function of a person class that returns true if the person object’s age is greater than that of another person object. Assume that age is a data member of the person class.
bool isOlderThan (const person &p) const;
The first line of the implementation file time.cpp for a class called Time could be
include “time.h”
What is the code that associates the input file stream inf with the file myFile.txt?
#define aFile “myFile.txt” ...ifstream inf; inf.open (aFile);