Exam 10: Classes and Data Abstraction
Exam 1: An Overview of Computers and Programming Languages50 Questions
Exam 2: Basic Elements of C++50 Questions
Exam 3: Input/Output50 Questions
Exam 4: Control Structures I (Selection)50 Questions
Exam 5: Control Structures II (Repetition)50 Questions
Exam 6: User-Defined Functions50 Questions
Exam 7: User-Defined Simple Data Types, Namespaces, and the string Type50 Questions
Exam 8: Arrays and Strings50 Questions
Exam 9: Records (structs)50 Questions
Exam 10: Classes and Data Abstraction50 Questions
Exam 11: Inheritance and Composition50 Questions
Exam 12: Pointers, Classes, Virtual Functions, Abstract Classes, and Lists50 Questions
Exam 13: Overloading and Templates50 Questions
Exam 14: Exception Handling50 Questions
Exam 15: Recursion50 Questions
Exam 16: Linked Lists50 Questions
Exam 17: Stacks and Queues50 Questions
Exam 18: Searching and Sorting Algorithms50 Questions
Exam 19: Binary Trees50 Questions
Exam 20: Graphs50 Questions
Exam 21: Standard Template Library (STL)50 Questions
Select questions type
In C++,class is a reserved word and it defines only a data type.
Free
(True/False)
4.8/5
(36)
Correct Answer:
True
In C++ terminology,a class object is the same as a class instance.
Free
(True/False)
4.8/5
(44)
Correct Answer:
True
Non-static member variables of a class are called the ____________________ variables of the class.
Free
(Short Answer)
4.8/5
(33)
Correct Answer:
instance
A C++ implementation file has the extension ____________________.
(Short Answer)
4.8/5
(44)
A(n)____________________ statement is required by any program that uses a header class file,as well as by the implementation file that defines the operations for that class.
(Short Answer)
4.8/5
(34)
If an object is declared in the definition of a member function of the class,then the object can access both the public and private members of the class.
(True/False)
4.8/5
(33)
Figure 2:
class rectangleType
{
public:
void setLengthWidth(double x, double y);
//Postcondition: length = x; width = y;
void print() const;
//Output length and width;
double area();
//Calculate and return the area of the rectangle;
double perimeter();
//Calculate and return the parameter;
rectangleType();
//Postcondition: length = 0; width = 0;
rectangleType(double x, double y);
//Postcondition: length = x; width = y;
private:
double length;
double width;
};
-Consider the accompanying class definition in Figure 2.Which of the following variable declarations is correct?
(Multiple Choice)
4.7/5
(40)
Given the declaration
class myClass
{
public:
void print(); //Output the value of x;
MyClass();
private:
int x;
};
myClass myObject;
The following statement is legal.
myObject.x = 10;
(True/False)
4.8/5
(30)
If an object is created in a user program,then the object can access both the public and private members of the class.
(True/False)
4.8/5
(36)
Classes were specifically designed in C++ to handle ____________________.
(Short Answer)
4.9/5
(37)
The public members of a class must be declared before the private members.
(True/False)
4.9/5
(35)
A destructor has the character ____,followed by the name of the class.
(Multiple Choice)
4.8/5
(46)
A ____ sign in front of a member name on a UML diagram indicates that this member is a protected member.
(Multiple Choice)
4.9/5
(45)
Figure 1:
-Consider the UML class diagram shown in the accompanying figure.According to the UML class diagram,how many private members are in the class?

(Multiple Choice)
4.8/5
(40)
If a function of a class is static,it is declared in the class definition using the keyword static in its ____.
(Multiple Choice)
5.0/5
(38)
Showing 1 - 20 of 50
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)