COMP220 Week 8 – Study Material for Finals – 13 MCQs, 8 Essay Questions – Guaranteed 100% score

Quiz Price = \$20
Problem Statement

Final Exam
13 MCQs 8 Essay Types

Page 1

Multiple Choice

1. (TCO 1) Which of the following about C++ arrays is true?

(i) Array components must be of type double.
(ii) The array index must be of an integral type. (Points : 4)
Only (i)
Only (ii)
Both (i) and (ii)
None of these

2. (TCO 1) What is stored in alpha after the following code executes?

int alpha = {0};
int j;
for (j = 0; j < 5; j++)
{
alpha[j] = 2 * j;
if (j % 2 == 1) //see if j is an even number
alpha[j - 1] = alpha[j] + j;
}

(Points : 4)
alpha = {0, 2, 4, 6, 8}
alpha = {0, 2, 9, 6, 8}
alpha = {0, 3, 4, 7, 8}
alpha = {3, 2, 9, 6, 8}

3. (TCO 1) What is the value of alpha after the following code executes?
int alpha = {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

4. (TCO 1) Consider the following declaration:

int alpha;

Which of the following input statements correctly inputs values into all the array elements of alpha? (Points : 4)
cin >> alpha >> alpha >> alpha;
cin >> alpha >> alpha >> alpha;
cin >> alpha >> alpha >> alpha;
cin >> alpha

5. (TCO 1) Consider the statement:

int list;

Which statement about list is true? (Points : 4)
List has 10 rows and 8 columns.
List has 8 rows and 10 columns.
List has a total of 18 components.
List has a total of 108 components.

6. (TCO 1) After the following statements execute, what are the contents of matrix?

int matrix = {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

7. (TCO 1) Consider the following statement:

double alpha;

What is the last row and column element of the array? (Points : 4)
alpha
alpha
alpha
alpha

8. (TCO 2) A class is an example of a (Points : 4)
structured data type.
unstructured data type.
simple data type.
primitive data.

9. (TCO 2) In C++ terminology, (Points : 4)
a class object is the same as a class instance.
a class object is the same as a class member.
a class object is the same as a class access specifier.
a class object is the same as a non-member function.

10. (TCO 2) In C++, the mechanism that allows you to combine data and the operations on that data in a single unit is called a(n) ____. (Points : 4)
enumeration
class
member
struct

11. (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.

12. (TCO 4) Suppose that bClass is a class. Which of the following statements correctly derives the class dClass from bClass? (Points : 4)
class dClass:: public bClass{ //classMembersList};
class dClass: private bClass{ //classMembersList};
class dClass:: protected bClass{ //classMembersList};
class bClass: public dClass{ //classMembersList};

13. (TCO 5) Given a class called Employee and the following definitions and statements:

void myFunction( Employee * eptr );
Employee emp;

which of the following statements correctly calls the function passing in the address of the emp object?

(Points : 4)
myFunction(emp);
myFunction(&emp);
myFunction(*emp);
None of the above

(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)
(TCO 1) Describe the conceptual model of a two-dimensional array. Include in your explanation how a two-dimensional array might be used, why they are similar to tables, and how to declare and initialize a

(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.

(TCO 4) Explain what a base class access specifier is and how it affects inheritance. (Points : 10)

(TCO 5) Write the code that will declare an integer array of dimension 10 and then use pointer arithmetic to initialize all the elements of that array to zero. Comment on each line of code to describe what that line does. (Points : 10)

(TCO 6) List and describe three restrictions regarding operator overloading. (Points : 10)

(TCO 7) Discuss run-time binding and how it relates to virtual functions. (Points : 10)

(TCO 8) For a multifile project that contains just one class, list and describe each of the files that would be required to implement and test the functions of the class. (Points : 10)

Relevant Material
Instructions
* Please click on “Buy Now” button to complete the purchase.Please note that the payment is done through PayPal.
* If you have any issues with the payment method, please let us know at support@iqrajavaid.com and that can be discussed and considered.
* Your paypal has to be pre-loaded in order to complete the purchase or otherwise please discuss it with us at support@iqrajavaid.com.