Exam 10: Defining Classes
Exam 1: Introduction to Computer and C++ Programming56 Questions
Exam 2: C++ Basics57 Questions
Exam 3: More Flow of Control45 Questions
Exam 4: Procedural Abstraction and Functions That Return a Value53 Questions
Exam 5: Functions for All Sub Tasks54 Questions
Exam 6: Io Streams As an Introduction to Objects and Classes52 Questions
Exam 7: Arrays48 Questions
Exam 8: Strings and Vectors69 Questions
Exam 9: Pointers and Dynamic Arrays39 Questions
Exam 10: Defining Classes61 Questions
Exam 11: Friends, Overloaded Operators, and Arrays in Classes56 Questions
Exam 12: Separate Compilation and Namespaces41 Questions
Exam 13: Pointers and Linked Lists64 Questions
Exam 14: Recursion48 Questions
Exam 15: Inheritance53 Questions
Exam 16: Exception Handling47 Questions
Exam 17: Templates35 Questions
Exam 18: Standard Template Library59 Questions
Select questions type
Which of the following is the correct function definition header for the getAge function which is a member of the Person class?
(Multiple Choice)
4.9/5
(35)
Two different structure definitions may have the same member names.
(True/False)
4.7/5
(30)
A data type consisting of data members and operations on those members which can be used by a programmer without knowing the implementation details of the data type is called
(Multiple Choice)
4.8/5
(43)
If you have a class with a member function called displayostream& out), that will send the values in the class to the parameter stream, and you need to call that function from within another member function, how would you call it to print the data to the screen? ___________________________
(Short Answer)
4.9/5
(33)
When several items variables or variables and functions) are grouped together into a single package, that is known as ______________.
(Short Answer)
4.8/5
(39)
When a structure contains another structure variable as one of its members, it is known as a ___________________.
(Short Answer)
4.9/5
(40)
A structure can only be passed to a function as a call-by-value parameter
(True/False)
4.9/5
(42)
The assignment operator may not be used with objects of a class.
(True/False)
4.8/5
(38)
Given the following class definition and the following member function header, which is the correct way to output the private data?
Class Person
{
Public:
Void outputPersonostream& out);
Private:
Int age;
Float weight;
Int id;
};
Void Person::outputPersonostream& out)
{
//what goes here?
}
(Multiple Choice)
4.8/5
(37)
A structure variable is a collection of smaller values called ____________ values
(Short Answer)
4.8/5
(38)
Given the following strucure definitions, what is the correct way to print the person's birth year?
Struct DateType
{
Int day;
Int month;
Int year;
}
Struct PersonType
{
Int age;
Float weight;
DateType birthday;
}
PersonType person;
(Multiple Choice)
4.9/5
(38)
Given the following class, what would be the best declaration for a mutator function that allows the user of the class to change the age?
Class Wine
{
Public:
Wine);
Int getAge);
Float getCost);
Private:
Int age;
Float cost;
}
(Multiple Choice)
4.9/5
(46)
It is possible to have multiple private labels in a class definition.
(True/False)
4.8/5
(31)
A struct variable is declared differently from a predefined type such as an int.
(True/False)
4.9/5
(41)
A derived class is more specific than its parent, or base class.
(True/False)
4.8/5
(29)
Given the following class definition, how would you declare an object of the class, so that the object automatically called the default constructor?
Class ItemClass
{
Public:
ItemClass);
ItemClassint newSize, float newCost);
Int getSize);
Float getCost);
Void setSizeint newSize);
Void setCostfloat newCost);
Private:
Int size;
Float cost;
};
(Multiple Choice)
4.8/5
(38)
If you design a class with private data members, and do not provide mutators and accessors, then
(Multiple Choice)
4.9/5
(42)
Showing 41 - 60 of 61
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)