Exam 13: Introduction to Classes
Exam 1: Introduction to Computers and Programming47 Questions
Exam 2: Introduction to C62 Questions
Exam 3: Expressions and Interactivity45 Questions
Exam 4: Making Decisions51 Questions
Exam 5: Loops and Files60 Questions
Exam 6: Functions49 Questions
Exam 7: Arrays and Vectors56 Questions
Exam 8: Searching and Sorting Arrays30 Questions
Exam 9: Pointers47 Questions
Exam 10: Characters, C-Strings, and More About the String Class47 Questions
Exam 11: Structured Data46 Questions
Exam 12: Advanced File Operations38 Questions
Exam 13: Introduction to Classes54 Questions
Exam 14: More About Classes46 Questions
Exam 15: Inheritance, Polymorphism, and Virtual Functions43 Questions
Exam 16: Exceptions and Templates36 Questions
Exam 17: The Standard Template Library38 Questions
Exam 18: Linked Lists41 Questions
Exam 19: Stacks and Queues47 Questions
Exam 20: Recursion27 Questions
Exam 21: Binary Trees39 Questions
Select questions type
A __________ is a member function that is automatically called when a class object is __________.
Free
(Multiple Choice)
4.9/5
(44)
Correct Answer:
A
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(77);
return 0;
}
Free
(Multiple Choice)
4.8/5
(27)
Correct Answer:
B
A private member function is useful for tasks that are internal to the class but it is not directly called by statements outside the class.
Free
(True/False)
4.8/5
(39)
Correct Answer:
True
The following code shows an example of __________ class Point
{
Private:
Double y = 5.70;
Double z = 3.0;
Public:
Public member functions go here...
};
(Multiple Choice)
4.9/5
(23)
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.9/5
(33)
When the body of a member function is defined inside a class declaration, it is said to be
(Multiple Choice)
4.9/5
(34)
You must declare all data members of a class before you declare member functions.
(True/False)
4.9/5
(38)
A class is a(n) __________ that is defined by the programmer.
(Multiple Choice)
4.9/5
(32)
When a member function is defined outside of the class declaration, the function name must be qualified with the
(Multiple Choice)
4.8/5
(35)
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.7/5
(34)
The type of member function that may be called from a statement outside the class is
(Multiple Choice)
4.9/5
(25)
You must use the private access specification for all data members of a class.
(True/False)
4.8/5
(33)
In object-oriented programming, the object encapsulates both the data and the functions that operate on the data.
(True/False)
4.8/5
(28)
Whereas object-oriented programming centers on the object, procedural programming centers on functions.
(True/False)
4.9/5
(26)
Showing 1 - 20 of 54
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)