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

Quiz Price = $20
Please feel free to send us your queries at: support@iqrajavaid.com
Problem Statement

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[5] = {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[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

4. (TCO 1) Consider the following declaration:

int alpha[3];

Which of the following input statements correctly inputs values into all the array elements of alpha? (Points : 4)
cin >> alpha >> alpha >> alpha;
cin >> alpha[0] >> alpha[1] >> alpha[2];
cin >> alpha[1] >> alpha[2] >> alpha[3];
cin >> alpha

5. (TCO 1) Consider the statement:

int list[10][8];

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[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

7. (TCO 1) Consider the following statement:

double alpha[10][5];

What is the last row and column element of the array? (Points : 4)
alpha[10][5]
alpha[9][4]
alpha[10][4]
alpha[9][5]

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 1) Describe an example of a two-dimensional character array that could be used to hold a set of text data that might be displayed on a hand-held information display device such as an MP3 player. Describe what each of the two-dimensional characters might represent and the data that would be held in the array. Also, provide an example array declaration. (Points : 10)

(TCO 2) Explain the difference between a parameterized constructor and a default constructor. Provide an example class that includes both types of constructors. (Points : 10)

3. (TCO 3) Assume that a definition of class Automobile has two composite objects called myEngine of class Engine and myTransmission of class Transmission. If an object of Automobile is instantiated and then goes out of scope, list the sequence in which all the constructors and destructors are called. Also, provide an explanation of how they are called in this sequence. (Points : 10)

4. (TCO 4) Without considering the access attributes, list and describe which base class members may not be inherited by a derived class, and provide a rationale for why. (Points : 10)

5. (TCO 5) Write all the code necessary to dynamically allocate an array of 10 double-precision, floating-point variables and then write the code that will deallocate the memory. Add comment fields to each line of code describing what it is and does. (Points : 10)

6. (TCO 6) Assume that three objects of the class Inductor have been instantiated: L1, L2, and L3. Write the overloaded operator prototypes that would be required to perform the following operation. You are only required to write the prototypes, not the implementation code.

L3 = L1 + L2; (Points : 10)

7. (TCO 7) Define what is meant by the term compile-time binding, and list two other terms that are also used to describe it. Explain why compile-time binding can present problems when implementing polymorphism in a program. (Points : 10)

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)

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.
* As soon as the payment is received through PayPal, download link of the solution will automatically be sent to the address used in Paypal.
* Please check your junk mails as the download link email might go there.
* All the contents are compressed in one zip folder.
* In case if you get stuck at any point during the payment process, please immediately contact us at support@iqrajavaid.com and we will fix it with you.
* We try our best to reach back to you on immediate basis. However, please expect a response within 8 hours from our side.
* Comments/Feedbacks are truely welcomed and there might be some incentives for you for the next lab/quiz/assignment.
* In case of any query, please donot hesitate to contact us at support@iqrajavaid.com.
******************************************** Good Luck ***************************************************
Payment Details
Quiz Price = $20
Please feel free to send us your queries at: support@iqrajavaid.com

Leave a Reply