SlideShare a Scribd company logo
1 of 15
Page 1
Multiple Choice Questions
Question 1.1. (TCO 1) What is the value of alpha[3] after the
following code executes?
int alpha[6] = {0};
int j;
for(j = 4; j >= 0; j--)
{
alpha[j] = j + 5;
if (j % 2 == 0)
alpha[j + 1] = alpha[j] + 3;
} (Points : 4)
5
8
9
10
Question 2.2. (TCO 1) After the following statements execute,
what are the contents of the matrix?
int matrix[3][2] = {0};
int j, k;
for (j = 0; j < 3; j++)
for (k = 0; k < 2; k++)
matrix[j][k] = j + k; (Points : 4)
0 0
1 1
2 2
0 1
2 3
4 5
0 1
1 2
2 3
1 1
2 2
3 3
Question 3.3. (TCO 1) After the following statements execute,
what are the contents of the matrix?
int matrix[4][3] = {0};
int j, k;
for (j = 0; j < 4; j++)
for (k = 0; k < 3; k++)
matrix[j][k] = 2 * j + k; (Points : 4)
0 2 4
1 3 5
2 4 6
3 5 7
0 1 2
1 2 3
2 3 4
3 4 5
0 2 4
2 4 6
4 6 8
6 8 10
0 1 2
2 3 4
4 5 6
6 7 8
Question 4.4. (TCO 1) Which of the following correctly
declares and initializes alpha to be an array of 4 rows and 3
columns with the component type int? (Points : 4)
int alpha[4][3] = {{0,1,2} {1,2,3} {2,3,4} {3,4,5}};
int alpha[4][3] = {0,1,2; 1,2,3; 2,3,4; 3,4,5};
int alpha[4][3] = {0,1,2: 1,2,3: 2,3,4: 3,4,5};
int alpha[4][3] = {{0,1,2}, {1,2,3}, {2,3,4}, {3,4,5}};
Question 5.5. (TCO 1) What is stored in alpha after the
following code executes?
int alpha[5] = {0};
int j;
for (j = 0; j < 5; j++)
{
alpha[j] = j + 5;
if ( j % 2 == 1) //see if j is an even number
alpha[j - 1] = alpha[j] + 2;
} (Points : 4)
alpha = {5, 6, 7, 8, 9}
alpha = {5, 6, 10, 8, 9}
alpha = {8, 6, 7, 8, 9}
alpha = {8, 6, 10, 8, 9}
Question 6.6. (TCO 1) Which of the following statements
declares alpha to be an array of 25 components of the type
int? (Points : 4)
int alpha[25];
int array alpha[25];
int alpha[2][5];
int array alpha[25][25];
Question 7.7. (TCO 2) A public member function of a class can
access _____. (Points : 4)
only other public members of the class.
public and nonpublic members of a class
only private members of a class
neither public nor private class members
Question 8.8. (TCO 2) If a member of a class is ____, you
cannot access it outside the class. (Points : 4)
public
automatic
private
static
Question 9.9. (TCO 2) Consider the following class definition.
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;
};
And consider this declaration.
rectangleType bigRect;
Which of the following statements is correct? (Points : 4)
rectangleType.print();
rectangleType::print();
bigRect.print();
bigRect::print();
Question 10.10. (TCO 2) In C++, the ____ is an operator called
the member access operator. (Points : 4)
.
,
::
#
Page 2
Multiple Choice
Question 1.1. (TCO 2) Suppose you have the following UML
class diagram of a class.
Which of the following is an accessor? (Points : 4)
incrementHours
setTime
getTime
clockType
Question 2.2. (TCO 2) Suppose you have the following UML
class diagram of a class.
According to the UML class diagram, which function is public
and doesn't return anything? (Points : 4)
incrementHours
equalTime
printTime
setTime
Question 3.3. (TCO 2) Consider the following declaration.
class myClass
{
public:
void print();
private:
int x;
};
myClass myObject;
Which statement is legal? (Points : 4)
myObject.print = 10;
myClass.print = 10;
myObject.print();
myClass.print();
Question 4.4. (TCO 3) Composition is a stronger form
of _____. (Points : 4)
inheritance
aggregation
instantiation
encapsulation
Question 5.5. (TCO 3) Composition and inheritance are two
fundamental ways of relating _____. (Points : 4)
classes
objects
class function members
class data members
Question 6.6. (TCO 3) Aggregation is also sometimes called
_____. (Points : 4)
inheritance
instantiation
composition
encapsulation
Question 7.7. (TCO 3) Which of the following statements is an
accurate example of composition? (Points : 4)
A car has an engine.
A car is an automobile.
A car is an object.
A car has a class.
Question 8.8. (TCO 4) If the derived class does not override a
public member function of the base class, you may specify a
call to that public member function that has parameters
by _____. (Points : 4)
using the name of the function and no parameter list
using only the name of the function
using the name of the function and the appropriate
parameter list
Public member functions cannot be accessed in a derived
class.
Question 9.9. (TCO 4) Which of the following is a valid
definition of the derived class bClass? (Points : 4)
class aClass: public bClass{ //...};
class bClass: public aClass{ //...};
class aClass::bClass{ //...};
class bClass::aClass{ //...}
Question 10.10. (TCO 4) Which of the following statements
correctly describes an example of multiple inheritance? (Points
: 4)
Mother and Father to Children
Animal to Reptile to Snake
Parent to Child
Animal to Mammal and Bird
Page 3
Multiple Choice
Question 1.1. (TCO 4) Which of the following relationships is
not a correct example of inheritance? (Points : 4)
Parent to Children
Aunt to Uncle
Grandparent to Grandchild
Father and Mother to Children
Question 2.2. (TCO 4) To overload a member function of the
base class, _____. (Points : 4)
the name of the function and the formal parameter list of
the corresponding function in the derived class must be same
the name of the function must be different, and the formal
parameter list of the corresponding function in the derived class
must be same
the name of the function and the formal parameter list of
the corresponding function in the derived class must be
different
the name of the function must be the same, and the formal
parameter list of the corresponding function in the derived class
must be different
Question 3.3. (TCO 4) Which of the following is not true about
public inheritance? (Points : 4)
All the public member functions of the base class become
the public member functions of the derived class.
All the public member variables of the base class become
the public member variables of the derived class.
All the public members of the base class become the public
members of the derived class.
The the public member variables of the base class become
the private member variables of the derived class.
Question 4.4. (TCO 5) What is the data type of pDist?
Distance * pDist; (Points : 4)
Distance
Const pointer to Distance
Pointer to Distance
Pointer to MAX
Question 5.5. (TCO 5) Given the definition of a class called
Employee and given an Employee pointer variable called
myData, which is pointing to an array of 20 Employee objects,
which of the following statements correctly accesses the
getSalary method of the last employee that takes no parameters
and returns a double value? (Points : 4)
cout << *(myData + 20).getSalary( );
cout << myData[20].getSalary( );
cout << myData->getSalary[19];
cout << myData[19].getSalary( );
Question 6.6. (TCO 5) What is wrong with the following C++
statements?
int* iptr;
double d = 123.321;
iptr = & d;
cout << *iptr; (Points : 4)
The cout statement does not contain an endl.
The space following the ampersand should not be there.
The iptr variable cannot be given an address of a double.
All of the above
Question 7.7. (TCO 5) Assume that Distance is a class. Which is
a valid statement to assign a new value to pDist?
Distance * pDist;
Distance d2(1, 2.3); (Points : 4)
pDist = d2;
pDist = *d2;
pDist = &d2;
pDist = #d2;
Question 8.8. (TCO 6) Which of the following operators may
not be overloaded? (Points : 4)
=
::
||
&&
Question 9.9. (TCO 6) What is a friend function? (Points : 4)
An overloaded operator
A function in a derived class that overrides a base class
function of the same name
A nonmember function of a class that has access to all the
members of the class
A function called by member function of a class
Question 10.10. (TCO 6) If a class uses dynamic memory
allocation, which statement is true? (Points : 4)
It must not use dynamic memory allocation in a copy
constructor.
All the allocated memory must be deallocated before the
object goes out of scope and the destructor is called.
It must not overload the assignment operator.
It must include the dynamic allocation in all
the constructors, and it must then deallocate all of the allocated
memory in the destructor.
Question 11.11. (TCO 6) Which of the following operators can
be overloaded? (Points : 4)
.
.*
::
++
Question 12.12. (TCO 7) Overriding a base-class member
function with a derived member function demonstrates the
concept of _____. (Points : 4)
overloading
inheritance
polymorphism
abstraction
Question 13.13. (TCO 7) If a function is declared virtual in a
base class, then _____. (Points : 4)
it must also be declared virtual in any derived classes
it must not be overridden in any derived classes
it remains virtual even if a derived class overrides it and
does not declare it as virtual
it must be overridden in all derived classes
Question 14.14. (TCO 7) Consider the following class
definitions.
class Employee { };
class Boss : public Employee { };
class Worker : public Employee { };
If the function double CalculateEarnings(); is declared as
virtual in the class Employee, which class then becomes
abstract? (Points : 4)
Boss
Employee
Worker
Both Boss and Worker
Question 15.15. (TCO 7) Which term is a correct definition of
run-time binding? (Points : 4)
Late binding
Independent binding
Dependent binding
Static binding
Question 16.16. (TCO 7) Polymorphism means _____. (Points :
4)
having the ability to use the same expression to denote
different operations
having multiple objects of the same class
that a derived class has more than one base class
creating new objects and classes from existing objects and
classes
Question 17.17. (TCO 8) In a multifile, object-oriented, C++
project, which file contains the class implementation? (Points :
4)
classname.hdr
classname.h
classname.def
classname.cpp
Question 18.18. (TCO 8) When creating a macro, which
preprocessor directive is used? (Points : 4)
ifndef
define
ifdef
endif
Question 19.19. (TCO 8) Class header files are usually
designated by what indicators? (Points : 4)
< >
( )
" "
' '
Question 20.20. (TCO 8) In a multifile, object-oriented, C++
project, which is the correct statement for the constructor
implementation, given that the constructor is correctly defined
in the class definition file? (Points : 4)
Classname:Classname{ }
Classname { }
Classname::Classname { }
Classname { }
Essay Questions
Question 1.1. (TCO 1) Given the following array declaration
and program statement, describe--in detail--the condition and
what potential problems could occur if a program containing
both was compiled and executed.
int array[5][4] = {0};
array[4][4] = 5; (Points : 10)
Question 2.2. (TCO 2) Explain the basic C++ syntax for
creating a class. Include an explanation of the private and
public section of a class and the class members. Include a code
segment to illustrate your answer. (Points : 10)
Question 3.3. (TCO 3) Write and explain the definition of what
composition is and how it is useful in writing an object-oriented
program. Also, explain how it is different from inheritance and
how both inheritance and composition are useful in developing
object-oriented programs. (Points : 10)
Question 4.4. (TCO 4) If a class is derived protected from a
base class, explain how this affects the inheritance of all the
public, protected, and private members of the base class by the
derived class. (Points : 10)
Question 5.5. (TCO 5) When dynamically allocating memory for
a specific data type, explain why a pointer variable of the same
data type must be used. Describe what happens if the memory
allocation is successful and what happens if it is
unsuccessful. (Points : 10)
Question 6.6. (TCO 6) List and describe three restrictions
regarding operator overloading. (Points : 10)
Question 7.7. (TCO 7) Define what is meant by the term run-
time binding, and list two other terms that are also used to
describe it. (Points : 10)
Question 8.8. (TCO 8) Describe and define what the
preprocessor statement is, how it is used, what part of the
development environment it interacts with, and provide a
syntactically correct example that describes what it
does. (Points : 10)

More Related Content

Similar to Page 1 Multiple Choice QuestionsQuestion 1.1. (TCO 1) What.docx

MX Server is my friend
MX Server is my friendMX Server is my friend
MX Server is my friendGabriel Daty
 
MX Server is my friend
MX Server is my friendMX Server is my friend
MX Server is my friendGabriel Daty
 
Cis 336 Extraordinary Success/newtonhelp.com
Cis 336 Extraordinary Success/newtonhelp.com  Cis 336 Extraordinary Success/newtonhelp.com
Cis 336 Extraordinary Success/newtonhelp.com amaranthbeg146
 
Spring 2014 CSCI 111 Final exam of 1 61. (2 points) Fl.docx
Spring 2014 CSCI 111 Final exam   of 1 61. (2 points) Fl.docxSpring 2014 CSCI 111 Final exam   of 1 61. (2 points) Fl.docx
Spring 2014 CSCI 111 Final exam of 1 61. (2 points) Fl.docxrafbolet0
 
CIS 336 Focus Dreams/newtonhelp.com
CIS 336 Focus Dreams/newtonhelp.comCIS 336 Focus Dreams/newtonhelp.com
CIS 336 Focus Dreams/newtonhelp.combellflower85
 
1z0 804 exam-java se 7 programmer ii
1z0 804 exam-java se 7 programmer ii1z0 804 exam-java se 7 programmer ii
1z0 804 exam-java se 7 programmer iiIsabella789
 
C++ Interview Question And Answer
C++ Interview Question And AnswerC++ Interview Question And Answer
C++ Interview Question And AnswerJagan Mohan Bishoyi
 
C++ questions And Answer
C++ questions And AnswerC++ questions And Answer
C++ questions And Answerlavparmar007
 
Using-Python-Libraries.9485146.powerpoint.pptx
Using-Python-Libraries.9485146.powerpoint.pptxUsing-Python-Libraries.9485146.powerpoint.pptx
Using-Python-Libraries.9485146.powerpoint.pptxUadAccount
 
Cis 336 Enhance teaching / snaptutorial.com
Cis 336    Enhance teaching / snaptutorial.comCis 336    Enhance teaching / snaptutorial.com
Cis 336 Enhance teaching / snaptutorial.comDavis104
 
CIS 336 Redefined Education--cis336.com
CIS 336 Redefined Education--cis336.comCIS 336 Redefined Education--cis336.com
CIS 336 Redefined Education--cis336.comagathachristie208
 
CIS336 Education for Service--cis336.com
CIS336 Education for Service--cis336.comCIS336 Education for Service--cis336.com
CIS336 Education for Service--cis336.comwilliamwordsworth11
 
CIS 336 Achievement Education --cis336.com
CIS 336 Achievement Education --cis336.comCIS 336 Achievement Education --cis336.com
CIS 336 Achievement Education --cis336.comagathachristie171
 
CIS 336 Inspiring Innovation -- cis336.com
CIS 336 Inspiring Innovation -- cis336.comCIS 336 Inspiring Innovation -- cis336.com
CIS 336 Inspiring Innovation -- cis336.comkopiko105
 
CIS 336 Imagine Your Future/newtonhelp.com   
CIS 336 Imagine Your Future/newtonhelp.com   CIS 336 Imagine Your Future/newtonhelp.com   
CIS 336 Imagine Your Future/newtonhelp.com   bellflower45
 
CIS 336 Start With a Dream /newtonhelp.com
CIS 336 Start With a Dream /newtonhelp.comCIS 336 Start With a Dream /newtonhelp.com
CIS 336 Start With a Dream /newtonhelp.comqwsdd2
 
CIS 336 Life of the Mind/newtonhelp.com   
CIS 336 Life of the Mind/newtonhelp.com   CIS 336 Life of the Mind/newtonhelp.com   
CIS 336 Life of the Mind/newtonhelp.com   bellflower3
 
CIS 336 PAPERS Education for Service--cis336papers.com
CIS 336 PAPERS Education for Service--cis336papers.comCIS 336 PAPERS Education for Service--cis336papers.com
CIS 336 PAPERS Education for Service--cis336papers.comKeatonJennings14
 
Cis 355 Enthusiastic Study - snaptutorial.com
Cis 355 Enthusiastic Study - snaptutorial.comCis 355 Enthusiastic Study - snaptutorial.com
Cis 355 Enthusiastic Study - snaptutorial.comGeorgeDixon100
 
CIS 355 Success Begins / snaptutorial.com
CIS 355 Success Begins / snaptutorial.comCIS 355 Success Begins / snaptutorial.com
CIS 355 Success Begins / snaptutorial.comRobinson070
 

Similar to Page 1 Multiple Choice QuestionsQuestion 1.1. (TCO 1) What.docx (20)

MX Server is my friend
MX Server is my friendMX Server is my friend
MX Server is my friend
 
MX Server is my friend
MX Server is my friendMX Server is my friend
MX Server is my friend
 
Cis 336 Extraordinary Success/newtonhelp.com
Cis 336 Extraordinary Success/newtonhelp.com  Cis 336 Extraordinary Success/newtonhelp.com
Cis 336 Extraordinary Success/newtonhelp.com
 
Spring 2014 CSCI 111 Final exam of 1 61. (2 points) Fl.docx
Spring 2014 CSCI 111 Final exam   of 1 61. (2 points) Fl.docxSpring 2014 CSCI 111 Final exam   of 1 61. (2 points) Fl.docx
Spring 2014 CSCI 111 Final exam of 1 61. (2 points) Fl.docx
 
CIS 336 Focus Dreams/newtonhelp.com
CIS 336 Focus Dreams/newtonhelp.comCIS 336 Focus Dreams/newtonhelp.com
CIS 336 Focus Dreams/newtonhelp.com
 
1z0 804 exam-java se 7 programmer ii
1z0 804 exam-java se 7 programmer ii1z0 804 exam-java se 7 programmer ii
1z0 804 exam-java se 7 programmer ii
 
C++ Interview Question And Answer
C++ Interview Question And AnswerC++ Interview Question And Answer
C++ Interview Question And Answer
 
C++ questions And Answer
C++ questions And AnswerC++ questions And Answer
C++ questions And Answer
 
Using-Python-Libraries.9485146.powerpoint.pptx
Using-Python-Libraries.9485146.powerpoint.pptxUsing-Python-Libraries.9485146.powerpoint.pptx
Using-Python-Libraries.9485146.powerpoint.pptx
 
Cis 336 Enhance teaching / snaptutorial.com
Cis 336    Enhance teaching / snaptutorial.comCis 336    Enhance teaching / snaptutorial.com
Cis 336 Enhance teaching / snaptutorial.com
 
CIS 336 Redefined Education--cis336.com
CIS 336 Redefined Education--cis336.comCIS 336 Redefined Education--cis336.com
CIS 336 Redefined Education--cis336.com
 
CIS336 Education for Service--cis336.com
CIS336 Education for Service--cis336.comCIS336 Education for Service--cis336.com
CIS336 Education for Service--cis336.com
 
CIS 336 Achievement Education --cis336.com
CIS 336 Achievement Education --cis336.comCIS 336 Achievement Education --cis336.com
CIS 336 Achievement Education --cis336.com
 
CIS 336 Inspiring Innovation -- cis336.com
CIS 336 Inspiring Innovation -- cis336.comCIS 336 Inspiring Innovation -- cis336.com
CIS 336 Inspiring Innovation -- cis336.com
 
CIS 336 Imagine Your Future/newtonhelp.com   
CIS 336 Imagine Your Future/newtonhelp.com   CIS 336 Imagine Your Future/newtonhelp.com   
CIS 336 Imagine Your Future/newtonhelp.com   
 
CIS 336 Start With a Dream /newtonhelp.com
CIS 336 Start With a Dream /newtonhelp.comCIS 336 Start With a Dream /newtonhelp.com
CIS 336 Start With a Dream /newtonhelp.com
 
CIS 336 Life of the Mind/newtonhelp.com   
CIS 336 Life of the Mind/newtonhelp.com   CIS 336 Life of the Mind/newtonhelp.com   
CIS 336 Life of the Mind/newtonhelp.com   
 
CIS 336 PAPERS Education for Service--cis336papers.com
CIS 336 PAPERS Education for Service--cis336papers.comCIS 336 PAPERS Education for Service--cis336papers.com
CIS 336 PAPERS Education for Service--cis336papers.com
 
Cis 355 Enthusiastic Study - snaptutorial.com
Cis 355 Enthusiastic Study - snaptutorial.comCis 355 Enthusiastic Study - snaptutorial.com
Cis 355 Enthusiastic Study - snaptutorial.com
 
CIS 355 Success Begins / snaptutorial.com
CIS 355 Success Begins / snaptutorial.comCIS 355 Success Begins / snaptutorial.com
CIS 355 Success Begins / snaptutorial.com
 

More from alfred4lewis58146

For this assignment, students will need to observe the activities th.docx
For this assignment, students will need to observe the activities th.docxFor this assignment, students will need to observe the activities th.docx
For this assignment, students will need to observe the activities th.docxalfred4lewis58146
 
For this assignment, select a human service organization from .docx
For this assignment, select a human service organization from .docxFor this assignment, select a human service organization from .docx
For this assignment, select a human service organization from .docxalfred4lewis58146
 
For this Assignment, read the case study for Claudia and find tw.docx
For this Assignment, read the case study for Claudia and find tw.docxFor this Assignment, read the case study for Claudia and find tw.docx
For this Assignment, read the case study for Claudia and find tw.docxalfred4lewis58146
 
For this assignment, download the A6 code pack. This zip fil.docx
For this assignment, download the A6 code pack. This zip fil.docxFor this assignment, download the A6 code pack. This zip fil.docx
For this assignment, download the A6 code pack. This zip fil.docxalfred4lewis58146
 
For this assignment, create infographic using the Canva website..docx
For this assignment, create infographic using the Canva website..docxFor this assignment, create infographic using the Canva website..docx
For this assignment, create infographic using the Canva website..docxalfred4lewis58146
 
For this assignment, compare  California during the Great Depression.docx
For this assignment, compare  California during the Great Depression.docxFor this assignment, compare  California during the Great Depression.docx
For this assignment, compare  California during the Great Depression.docxalfred4lewis58146
 
For this assignment, create a 10- to 12-slide presentation in Mi.docx
For this assignment, create a 10- to 12-slide presentation in Mi.docxFor this assignment, create a 10- to 12-slide presentation in Mi.docx
For this assignment, create a 10- to 12-slide presentation in Mi.docxalfred4lewis58146
 
For this assignment, begin by reading chapters 12-15 in Dr. Bells t.docx
For this assignment, begin by reading chapters 12-15 in Dr. Bells t.docxFor this assignment, begin by reading chapters 12-15 in Dr. Bells t.docx
For this assignment, begin by reading chapters 12-15 in Dr. Bells t.docxalfred4lewis58146
 
For this assignment, assume you are the new Secretary of Homelan.docx
For this assignment, assume you are the new Secretary of Homelan.docxFor this assignment, assume you are the new Secretary of Homelan.docx
For this assignment, assume you are the new Secretary of Homelan.docxalfred4lewis58146
 
For this assignment, address the following promptsIntroductor.docx
For this assignment, address the following promptsIntroductor.docxFor this assignment, address the following promptsIntroductor.docx
For this assignment, address the following promptsIntroductor.docxalfred4lewis58146
 
For this assignment, analyze the play by focusing on one of the .docx
For this assignment, analyze the play by focusing on one of the .docxFor this assignment, analyze the play by focusing on one of the .docx
For this assignment, analyze the play by focusing on one of the .docxalfred4lewis58146
 
For this assignment I would like you to answer these questions.docx
For this assignment I would like you to answer these questions.docxFor this assignment I would like you to answer these questions.docx
For this assignment I would like you to answer these questions.docxalfred4lewis58146
 
For the Weekly Reports I need 2 reports. For the First two weeks the.docx
For the Weekly Reports I need 2 reports. For the First two weeks the.docxFor the Weekly Reports I need 2 reports. For the First two weeks the.docx
For the Weekly Reports I need 2 reports. For the First two weeks the.docxalfred4lewis58146
 
For the shortanswer questions,you will need to respo.docx
For the shortanswer questions,you will need to respo.docxFor the shortanswer questions,you will need to respo.docx
For the shortanswer questions,you will need to respo.docxalfred4lewis58146
 
For the sake of argument (this essay in particular), lets prete.docx
For the sake of argument (this essay in particular), lets prete.docxFor the sake of argument (this essay in particular), lets prete.docx
For the sake of argument (this essay in particular), lets prete.docxalfred4lewis58146
 
For the proposal, each student must describe an interface they a.docx
For the proposal, each student must describe an interface they a.docxFor the proposal, each student must describe an interface they a.docx
For the proposal, each student must describe an interface they a.docxalfred4lewis58146
 
For the project, you will be expected to apply the key concepts of p.docx
For the project, you will be expected to apply the key concepts of p.docxFor the project, you will be expected to apply the key concepts of p.docx
For the project, you will be expected to apply the key concepts of p.docxalfred4lewis58146
 
For the past several weeks you have addressed several different area.docx
For the past several weeks you have addressed several different area.docxFor the past several weeks you have addressed several different area.docx
For the past several weeks you have addressed several different area.docxalfred4lewis58146
 
For the Mash it Up assignment, we experimented with different ways t.docx
For the Mash it Up assignment, we experimented with different ways t.docxFor the Mash it Up assignment, we experimented with different ways t.docx
For the Mash it Up assignment, we experimented with different ways t.docxalfred4lewis58146
 
For the first time in modern history, the world is experiencing a he.docx
For the first time in modern history, the world is experiencing a he.docxFor the first time in modern history, the world is experiencing a he.docx
For the first time in modern history, the world is experiencing a he.docxalfred4lewis58146
 

More from alfred4lewis58146 (20)

For this assignment, students will need to observe the activities th.docx
For this assignment, students will need to observe the activities th.docxFor this assignment, students will need to observe the activities th.docx
For this assignment, students will need to observe the activities th.docx
 
For this assignment, select a human service organization from .docx
For this assignment, select a human service organization from .docxFor this assignment, select a human service organization from .docx
For this assignment, select a human service organization from .docx
 
For this Assignment, read the case study for Claudia and find tw.docx
For this Assignment, read the case study for Claudia and find tw.docxFor this Assignment, read the case study for Claudia and find tw.docx
For this Assignment, read the case study for Claudia and find tw.docx
 
For this assignment, download the A6 code pack. This zip fil.docx
For this assignment, download the A6 code pack. This zip fil.docxFor this assignment, download the A6 code pack. This zip fil.docx
For this assignment, download the A6 code pack. This zip fil.docx
 
For this assignment, create infographic using the Canva website..docx
For this assignment, create infographic using the Canva website..docxFor this assignment, create infographic using the Canva website..docx
For this assignment, create infographic using the Canva website..docx
 
For this assignment, compare  California during the Great Depression.docx
For this assignment, compare  California during the Great Depression.docxFor this assignment, compare  California during the Great Depression.docx
For this assignment, compare  California during the Great Depression.docx
 
For this assignment, create a 10- to 12-slide presentation in Mi.docx
For this assignment, create a 10- to 12-slide presentation in Mi.docxFor this assignment, create a 10- to 12-slide presentation in Mi.docx
For this assignment, create a 10- to 12-slide presentation in Mi.docx
 
For this assignment, begin by reading chapters 12-15 in Dr. Bells t.docx
For this assignment, begin by reading chapters 12-15 in Dr. Bells t.docxFor this assignment, begin by reading chapters 12-15 in Dr. Bells t.docx
For this assignment, begin by reading chapters 12-15 in Dr. Bells t.docx
 
For this assignment, assume you are the new Secretary of Homelan.docx
For this assignment, assume you are the new Secretary of Homelan.docxFor this assignment, assume you are the new Secretary of Homelan.docx
For this assignment, assume you are the new Secretary of Homelan.docx
 
For this assignment, address the following promptsIntroductor.docx
For this assignment, address the following promptsIntroductor.docxFor this assignment, address the following promptsIntroductor.docx
For this assignment, address the following promptsIntroductor.docx
 
For this assignment, analyze the play by focusing on one of the .docx
For this assignment, analyze the play by focusing on one of the .docxFor this assignment, analyze the play by focusing on one of the .docx
For this assignment, analyze the play by focusing on one of the .docx
 
For this assignment I would like you to answer these questions.docx
For this assignment I would like you to answer these questions.docxFor this assignment I would like you to answer these questions.docx
For this assignment I would like you to answer these questions.docx
 
For the Weekly Reports I need 2 reports. For the First two weeks the.docx
For the Weekly Reports I need 2 reports. For the First two weeks the.docxFor the Weekly Reports I need 2 reports. For the First two weeks the.docx
For the Weekly Reports I need 2 reports. For the First two weeks the.docx
 
For the shortanswer questions,you will need to respo.docx
For the shortanswer questions,you will need to respo.docxFor the shortanswer questions,you will need to respo.docx
For the shortanswer questions,you will need to respo.docx
 
For the sake of argument (this essay in particular), lets prete.docx
For the sake of argument (this essay in particular), lets prete.docxFor the sake of argument (this essay in particular), lets prete.docx
For the sake of argument (this essay in particular), lets prete.docx
 
For the proposal, each student must describe an interface they a.docx
For the proposal, each student must describe an interface they a.docxFor the proposal, each student must describe an interface they a.docx
For the proposal, each student must describe an interface they a.docx
 
For the project, you will be expected to apply the key concepts of p.docx
For the project, you will be expected to apply the key concepts of p.docxFor the project, you will be expected to apply the key concepts of p.docx
For the project, you will be expected to apply the key concepts of p.docx
 
For the past several weeks you have addressed several different area.docx
For the past several weeks you have addressed several different area.docxFor the past several weeks you have addressed several different area.docx
For the past several weeks you have addressed several different area.docx
 
For the Mash it Up assignment, we experimented with different ways t.docx
For the Mash it Up assignment, we experimented with different ways t.docxFor the Mash it Up assignment, we experimented with different ways t.docx
For the Mash it Up assignment, we experimented with different ways t.docx
 
For the first time in modern history, the world is experiencing a he.docx
For the first time in modern history, the world is experiencing a he.docxFor the first time in modern history, the world is experiencing a he.docx
For the first time in modern history, the world is experiencing a he.docx
 

Recently uploaded

Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 

Recently uploaded (20)

Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 

Page 1 Multiple Choice QuestionsQuestion 1.1. (TCO 1) What.docx

  • 1. Page 1 Multiple Choice Questions Question 1.1. (TCO 1) What is the value of alpha[3] after the following code executes? int alpha[6] = {0}; int j; for(j = 4; j >= 0; j--) { alpha[j] = j + 5; if (j % 2 == 0) alpha[j + 1] = alpha[j] + 3; } (Points : 4) 5 8 9 10 Question 2.2. (TCO 1) After the following statements execute, what are the contents of the matrix? int matrix[3][2] = {0}; int j, k; for (j = 0; j < 3; j++) for (k = 0; k < 2; k++) matrix[j][k] = j + k; (Points : 4) 0 0 1 1 2 2 0 1 2 3
  • 2. 4 5 0 1 1 2 2 3 1 1 2 2 3 3 Question 3.3. (TCO 1) After the following statements execute, what are the contents of the matrix? int matrix[4][3] = {0}; int j, k; for (j = 0; j < 4; j++) for (k = 0; k < 3; k++) matrix[j][k] = 2 * j + k; (Points : 4) 0 2 4 1 3 5 2 4 6 3 5 7 0 1 2 1 2 3 2 3 4 3 4 5 0 2 4 2 4 6 4 6 8 6 8 10 0 1 2 2 3 4 4 5 6 6 7 8 Question 4.4. (TCO 1) Which of the following correctly
  • 3. declares and initializes alpha to be an array of 4 rows and 3 columns with the component type int? (Points : 4) int alpha[4][3] = {{0,1,2} {1,2,3} {2,3,4} {3,4,5}}; int alpha[4][3] = {0,1,2; 1,2,3; 2,3,4; 3,4,5}; int alpha[4][3] = {0,1,2: 1,2,3: 2,3,4: 3,4,5}; int alpha[4][3] = {{0,1,2}, {1,2,3}, {2,3,4}, {3,4,5}}; Question 5.5. (TCO 1) What is stored in alpha after the following code executes? int alpha[5] = {0}; int j; for (j = 0; j < 5; j++) { alpha[j] = j + 5; if ( j % 2 == 1) //see if j is an even number alpha[j - 1] = alpha[j] + 2; } (Points : 4) alpha = {5, 6, 7, 8, 9} alpha = {5, 6, 10, 8, 9} alpha = {8, 6, 7, 8, 9} alpha = {8, 6, 10, 8, 9} Question 6.6. (TCO 1) Which of the following statements declares alpha to be an array of 25 components of the type int? (Points : 4) int alpha[25]; int array alpha[25]; int alpha[2][5]; int array alpha[25][25]; Question 7.7. (TCO 2) A public member function of a class can access _____. (Points : 4)
  • 4. only other public members of the class. public and nonpublic members of a class only private members of a class neither public nor private class members Question 8.8. (TCO 2) If a member of a class is ____, you cannot access it outside the class. (Points : 4) public automatic private static Question 9.9. (TCO 2) Consider the following class definition. 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; };
  • 5. And consider this declaration. rectangleType bigRect; Which of the following statements is correct? (Points : 4) rectangleType.print(); rectangleType::print(); bigRect.print(); bigRect::print(); Question 10.10. (TCO 2) In C++, the ____ is an operator called the member access operator. (Points : 4) . , :: # Page 2 Multiple Choice Question 1.1. (TCO 2) Suppose you have the following UML class diagram of a class. Which of the following is an accessor? (Points : 4) incrementHours setTime getTime clockType Question 2.2. (TCO 2) Suppose you have the following UML class diagram of a class. According to the UML class diagram, which function is public
  • 6. and doesn't return anything? (Points : 4) incrementHours equalTime printTime setTime Question 3.3. (TCO 2) Consider the following declaration. class myClass { public: void print(); private: int x; }; myClass myObject; Which statement is legal? (Points : 4) myObject.print = 10; myClass.print = 10; myObject.print(); myClass.print(); Question 4.4. (TCO 3) Composition is a stronger form of _____. (Points : 4) inheritance aggregation instantiation encapsulation Question 5.5. (TCO 3) Composition and inheritance are two fundamental ways of relating _____. (Points : 4) classes
  • 7. objects class function members class data members Question 6.6. (TCO 3) Aggregation is also sometimes called _____. (Points : 4) inheritance instantiation composition encapsulation Question 7.7. (TCO 3) Which of the following statements is an accurate example of composition? (Points : 4) A car has an engine. A car is an automobile. A car is an object. A car has a class. Question 8.8. (TCO 4) If the derived class does not override a public member function of the base class, you may specify a call to that public member function that has parameters by _____. (Points : 4) using the name of the function and no parameter list using only the name of the function using the name of the function and the appropriate parameter list Public member functions cannot be accessed in a derived class. Question 9.9. (TCO 4) Which of the following is a valid definition of the derived class bClass? (Points : 4) class aClass: public bClass{ //...};
  • 8. class bClass: public aClass{ //...}; class aClass::bClass{ //...}; class bClass::aClass{ //...} Question 10.10. (TCO 4) Which of the following statements correctly describes an example of multiple inheritance? (Points : 4) Mother and Father to Children Animal to Reptile to Snake Parent to Child Animal to Mammal and Bird Page 3 Multiple Choice Question 1.1. (TCO 4) Which of the following relationships is not a correct example of inheritance? (Points : 4) Parent to Children Aunt to Uncle Grandparent to Grandchild Father and Mother to Children Question 2.2. (TCO 4) To overload a member function of the base class, _____. (Points : 4) the name of the function and the formal parameter list of the corresponding function in the derived class must be same the name of the function must be different, and the formal parameter list of the corresponding function in the derived class must be same the name of the function and the formal parameter list of the corresponding function in the derived class must be different the name of the function must be the same, and the formal
  • 9. parameter list of the corresponding function in the derived class must be different Question 3.3. (TCO 4) Which of the following is not true about public inheritance? (Points : 4) All the public member functions of the base class become the public member functions of the derived class. All the public member variables of the base class become the public member variables of the derived class. All the public members of the base class become the public members of the derived class. The the public member variables of the base class become the private member variables of the derived class. Question 4.4. (TCO 5) What is the data type of pDist? Distance * pDist; (Points : 4) Distance Const pointer to Distance Pointer to Distance Pointer to MAX Question 5.5. (TCO 5) Given the definition of a class called Employee and given an Employee pointer variable called myData, which is pointing to an array of 20 Employee objects, which of the following statements correctly accesses the getSalary method of the last employee that takes no parameters and returns a double value? (Points : 4) cout << *(myData + 20).getSalary( ); cout << myData[20].getSalary( ); cout << myData->getSalary[19]; cout << myData[19].getSalary( );
  • 10. Question 6.6. (TCO 5) What is wrong with the following C++ statements? int* iptr; double d = 123.321; iptr = & d; cout << *iptr; (Points : 4) The cout statement does not contain an endl. The space following the ampersand should not be there. The iptr variable cannot be given an address of a double. All of the above Question 7.7. (TCO 5) Assume that Distance is a class. Which is a valid statement to assign a new value to pDist? Distance * pDist; Distance d2(1, 2.3); (Points : 4) pDist = d2; pDist = *d2; pDist = &d2; pDist = #d2; Question 8.8. (TCO 6) Which of the following operators may not be overloaded? (Points : 4) = :: || && Question 9.9. (TCO 6) What is a friend function? (Points : 4) An overloaded operator A function in a derived class that overrides a base class
  • 11. function of the same name A nonmember function of a class that has access to all the members of the class A function called by member function of a class Question 10.10. (TCO 6) If a class uses dynamic memory allocation, which statement is true? (Points : 4) It must not use dynamic memory allocation in a copy constructor. All the allocated memory must be deallocated before the object goes out of scope and the destructor is called. It must not overload the assignment operator. It must include the dynamic allocation in all the constructors, and it must then deallocate all of the allocated memory in the destructor. Question 11.11. (TCO 6) Which of the following operators can be overloaded? (Points : 4) . .* :: ++ Question 12.12. (TCO 7) Overriding a base-class member function with a derived member function demonstrates the concept of _____. (Points : 4) overloading inheritance polymorphism abstraction Question 13.13. (TCO 7) If a function is declared virtual in a
  • 12. base class, then _____. (Points : 4) it must also be declared virtual in any derived classes it must not be overridden in any derived classes it remains virtual even if a derived class overrides it and does not declare it as virtual it must be overridden in all derived classes Question 14.14. (TCO 7) Consider the following class definitions. class Employee { }; class Boss : public Employee { }; class Worker : public Employee { }; If the function double CalculateEarnings(); is declared as virtual in the class Employee, which class then becomes abstract? (Points : 4) Boss Employee Worker Both Boss and Worker Question 15.15. (TCO 7) Which term is a correct definition of run-time binding? (Points : 4) Late binding Independent binding Dependent binding Static binding Question 16.16. (TCO 7) Polymorphism means _____. (Points : 4) having the ability to use the same expression to denote different operations
  • 13. having multiple objects of the same class that a derived class has more than one base class creating new objects and classes from existing objects and classes Question 17.17. (TCO 8) In a multifile, object-oriented, C++ project, which file contains the class implementation? (Points : 4) classname.hdr classname.h classname.def classname.cpp Question 18.18. (TCO 8) When creating a macro, which preprocessor directive is used? (Points : 4) ifndef define ifdef endif Question 19.19. (TCO 8) Class header files are usually designated by what indicators? (Points : 4) < > ( ) " " ' ' Question 20.20. (TCO 8) In a multifile, object-oriented, C++ project, which is the correct statement for the constructor implementation, given that the constructor is correctly defined in the class definition file? (Points : 4) Classname:Classname{ }
  • 14. Classname { } Classname::Classname { } Classname { } Essay Questions Question 1.1. (TCO 1) Given the following array declaration and program statement, describe--in detail--the condition and what potential problems could occur if a program containing both was compiled and executed. int array[5][4] = {0}; array[4][4] = 5; (Points : 10) Question 2.2. (TCO 2) Explain the basic C++ syntax for creating a class. Include an explanation of the private and public section of a class and the class members. Include a code segment to illustrate your answer. (Points : 10) Question 3.3. (TCO 3) Write and explain the definition of what composition is and how it is useful in writing an object-oriented program. Also, explain how it is different from inheritance and how both inheritance and composition are useful in developing object-oriented programs. (Points : 10) Question 4.4. (TCO 4) If a class is derived protected from a base class, explain how this affects the inheritance of all the public, protected, and private members of the base class by the derived class. (Points : 10) Question 5.5. (TCO 5) When dynamically allocating memory for
  • 15. a specific data type, explain why a pointer variable of the same data type must be used. Describe what happens if the memory allocation is successful and what happens if it is unsuccessful. (Points : 10) Question 6.6. (TCO 6) List and describe three restrictions regarding operator overloading. (Points : 10) Question 7.7. (TCO 7) Define what is meant by the term run- time binding, and list two other terms that are also used to describe it. (Points : 10) Question 8.8. (TCO 8) Describe and define what the preprocessor statement is, how it is used, what part of the development environment it interacts with, and provide a syntactically correct example that describes what it does. (Points : 10)