Exam 13: Introduction to Classes
Exam 1: Introduction to Computers and Programming44 Questions
Exam 2: Introduction to C++56 Questions
Exam 3: Expressions and Interactivity44 Questions
Exam 4: Making Decisions53 Questions
Exam 5: Loops and Files62 Questions
Exam 6: Functions49 Questions
Exam 7: Arrays53 Questions
Exam 8: Searching and Sorting Arrays20 Questions
Exam 10: Characters, C++-Strings, and More About the String Class42 Questions
Exam 11: Structured Data43 Questions
Exam 11: Structured Data50 Questions
Exam 12: Advanced File Operations38 Questions
Exam 13: Introduction to Classes46 Questions
Exam 14: More About Classes40 Questions
Exam 15: Inheritance, Polymorphism, and Virtual Functions38 Questions
Exam 16: Exceptions, Templates, and the Standard Template Library STL39 Questions
Exam 17: Linked Lists40 Questions
Exam 18: Stacks and Queues46 Questions
Exam 19: Recursion21 Questions
Exam 20: Binary Trees38 Questions
Select questions type
One purpose that constructor functions are often used for is to allocate memory that will be needed by the object.
(True/False)
4.8/5
(41)
What is the output of the following program?
#include <iostream>
using namespace std;
class TestClass
{
public:
TestClass(int x)
{ cout << x << endl; }
TestClass()
{ cout << "Hello!" << endl; }
};
int main()
{
TestClass test;
return 0;
}
(Multiple Choice)
4.8/5
(39)
If you do not declare an access specification, the default for members of a class is
(Multiple Choice)
4.9/5
(41)
Assuming that Rectangle is a class name, the statement Rectangle *BoxPtr;
(Multiple Choice)
4.8/5
(36)
Whereas object-oriented programming centers around the object, procedural programming centers around functions.
(True/False)
4.8/5
(32)
This type of member function may be called only from a function that is a member of the same class.
(Multiple Choice)
4.7/5
(26)
What is the output of the following program?
#include <iostream>
using namespace std;
class TestClass
{
private:
int val;
void showVal()
{ cout << val << endl; }
public:
TestClass(int x)
{ val = x; }
};
int main()
{
TestClass test(77);
test.showVal();
return 0;
}
(Multiple Choice)
4.9/5
(29)
When an object is defined without an argument list for its constructor, the compiler automatically calls the object's default constructor.
(True/False)
4.8/5
(31)
You must declare all data members of a class before you declare member functions.
(True/False)
4.9/5
(34)
If a local variable and a global variable have the same name within the same program, the _______ resolution operator must be used.
(Multiple Choice)
4.7/5
(39)
This directive is used to create an "include guard," which allows a program to be conditionally compiled. This prevents a header file from accidentally being included more than once.
(Multiple Choice)
4.8/5
(33)
If you do not declare a destructor function, the compiler will furnish one automatically.
(True/False)
4.8/5
(40)
This type of member function may be called from a statement outside the class.
(Multiple Choice)
4.8/5
(39)
When a member function is defined outside of the class declaration, the function name must be qualified with the:
(Multiple Choice)
4.8/5
(39)
Showing 21 - 40 of 46
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)