Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. (TCO 1) What is the output of the following C++ code? int list[5] = {0, 5, 10, 15, 20}; int j; for (j =

1. (TCO 1) What is the output of the following C++ code? int list[5] = {0, 5, 10, 15, 20}; int j; for (j = 0; j < 5; j++) cout << list[j]; (Points : 4)

0 1 2 3 4 0 5 10 15 0 5 10 15 20 5 10 15 20

Question 2.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] = 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 3.3. (TCO 1) What is the output of the following C++ code? int alpha[5] = {2, 4, 6, 8, 10}; int j; for (j = 4; j >= 0; j--) cout << "alpha[" << j << "] = " << alpha[j] << endl; (Points : 4)

2 4 6 8 10 4 3 2 1 0 8 6 4 2 0 10 8 6 4 2

Question 4.4. (TCO 1) Which of the following about arrays as function parameters is true? (i) Arrays are passed by reference only. (ii) When we declare an array as a formal parameter we do not attach & after the data type of the array component. (Points : 4)

Only (i) Only (ii) Both (i) and (ii) None of these

Question 5.5. (TCO 1) Consider the following statement: double alpha[10][5]; The number of components of alpha is _____. (Points : 4)

15 50 100 150

Question 6.6. (TCO 1) Which of the following correctly declares and initializes alpha to be an array of four rows and three 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 7.7. (TCO 1) Given the following declaration: int j; int sum; double sale[10][7]; which of the following correctly finds the sum of the elements of the fifth row of sale? (Points : 4)

sum = 0; for(j = 0; j < 7; j++) sum = sum + sale[5][j]; sum = 0; for(j = 0; j < 7; j++) sum = sum + sale[4][j]; sum = 0; for(j = 0; j < 7; j++) sum = sum + sale[j][4]; sum = 0; for(j = 0; j < 7; j++) sum = sum + sale[j][5];

Question 8.8. (TCO 1) Given the following multidimensional array declaration, how many elements exist in the array? double neoMatrix[4][5][6]; (Points : 4)

456 60 15 120

Question 9.9. (TCO 2) In C++, class is a reserved word that defines (Points : 4)

a data type. an object type. a variable. an enumeration.

Question 10.10. (TCO 2) In a class, all function members (Points : 4)

must be public and all member variables must be private. must be public and all member variables must be public also. and member variables can be either public or private. must be private and all member variables must be public.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Azure SQL Database For Modern Developers Building Applications In The Microsoft Cloud

Authors: Davide Mauri, Silvano Coriani, Anna Hoffma, Sanjay Mishra, Jovan Popovic

1st Edition

1484263693, 978-1484263693

More Books

Students also viewed these Databases questions

Question

What is Change Control and how does it operate?

Answered: 1 week ago

Question

How do Data Requirements relate to Functional Requirements?

Answered: 1 week ago