Question: What (if anything) prints when the following statement is performed?Assume
the following variable declarations:
char s1[ 50 ] = "jack";
char s2[ 50 ] = "jill";
char s3[ 50 ];
cout << strlen(s1) + strlen(s2) << endl;
Question: What (if anything) prints when the following statement is performed?Assume
the following variable declarations:
char s1[ 50 ] = "jack";
char s2[ 50 ] = "jill";
char s3[ 50 ];
cout << strlen(s3) << endl;
Question: Class members are accessed via the ________ operator in conjunction with the
name of an object (or reference to an object) of the class or via the ___________ operator
in conjunction with a pointer to an object of the class
dot (.), arrow (->)
Question: Class members specified as _________ are accessible only to member
functions of the class and friends of the class
Private
Question: Class members specified as _________ are accessible anywhere an object of
the class is in scope
Public
Question: __________ can be used to assign an object of a class to another object of the
same class
Default memberwise assignment (performed by the assignment operator).
Question: Find the error(s) in the following and correct it (them).
Assume the following prototype is declared in class Time:
void ~Time(int);
~Time();
Question: Find the error(s) in the following and correct it (them).
The following is a partial definition of class Time:
class Time
{
public:
// function prototypes
private:
int hour = 0;
int minute = 0;
int second = 0;
}; // end class Time
Class Time
{
public:
// function prototypes
Time (int my_hour, int my_minute, int my_second)
{
|
|
hour=my_hour;
minute=my_minute;
second=my_second;
}
private:
int hour;
int minute;
int second;
}; // end class Time
Question: Find the error(s) in the following and correct it (them).
Assume the following prototype is declared in class Employee:
int Employee(const char *, const char *);
Employee(const char *, const char *);
Question: __________ must be used to initialize constant members of a class
Member initializers
Question: A nonmember function must be declared as a(n) __________ of a class to
have access to that class's private data members.
Friend
Question: The __________ operator dynamically allocates memory for an object of a
specified type and returns a __________ to that type.
New, pointer
Question: A constant object must be __________; it cannot be modified after it is
created
Initialized
Question: A(n) __________ data member represents class-wide information
Static
Question: An object's non-static member functions have access to a "self pointer" to the
object called the __________ pointer
This
Question: The keyword __________ specifies that an object or variable is not modifiable
after it is initialized
Const
Question: If a member initializer is not provided for a member object of a class, the
object's __________ is called