Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Write a c++ program that contains


-a function that that compare two singly Linked lists


-a function that swaps the values inside them


-a function that sorts the values inside them in ascending order


QUESTION 30

After the following statements execute, what are the contents of matrix? 

int matrix[3][2]; 

int j, 

for (j = 0; j < 3; j++) 

 for (k = 0; k < 2; k++) 

 matrix[j][k] = j + k; 

1. 0 0 

1 1 

2 2 

2. 0 1 

2 3 

4 5 

3. 0 1 

1 2 

2 3

4. 1 1 

2 2 

3 3


QUESTION 28

Consider the following statement: 

int alpha[25][10];. 

Which of the following statements about alpha is true? 

1. Rows of alpha are numbered 0...24 and columns are numbered 0...9.

2. Rows of alpha are numbered 0...24 and columns are numbered 1...10.

3. Rows of alpha are numbered 1...24 and columns are numbered 0...9.

4. Rows of alpha are numbered 1...25 and columns are numbered 1...10.

QUESTION 29

Which of the following correctly declares and initializes alpha to be an array of four rows and three columns with the 

element type int? 

1. int alpha[4][3] = {{0,1,2} {1,2,3} {2,3,4} {3,4,5}};

2. int alpha[4][3] = {0,1,2; 1,2,3; 2,3,4; 3,4,5};

3. int alpha[4][3] = {0,1,2:1,2,3:2,3,4:3,4,5};

4. int alpha[4][3] = {{0,1,2}, {1,2,3}, {2,3,4}, {3,4,5}};



QUESTION 24

Consider the following declaration 

int alpha[5] = {3, 5, 7, 9, 11}; 

Which of the following is equivalent to this statement? 

1. int alpha[] = {3, 5, 7, 9, 11};

2. int alpha[] = {3 5 7 9 11};

3. int alpha[5] = [3, 5, 7, 9, 11];

4. int alpha[] = (3, 5, 7, 9, 11);

QUESTION 25

Which of the following correctly declares name to be a character array and stores "William" in it? 

1. char name[6] = "William";

2. char name[7] = "William";

3. char name[8] = "William";

4. char name[8] = 'William';

QUESTION 26 

Consider the following statement: 

float alpha[10][5]; 

The number of elements of alpha is ____. 

1. 15 

2. 50 

3. 100 

4. 150

QUESTION 27

Consider the statement 

int list[10][8]; 

Which of the following about list is true? 

1. list has 10 rows and 8 columns. 

2. list has 8 rows and 10 columns. 

3. list has a total of 18 elements. 

4. list has a total of 108 elements.


QUESTION 20

What is the value of alpha[2] after the following code executes? 

int alpha[5]; 

int j; 

for (j = 0; j < 5; j++) 

 alpha[j] = 2 * j + 1; 

1. 1 

2. 4 

3. 5 

4. 6

QUESTION 23

Suppose that gamma is an array of 50 elements of type int and j is an int variable. Which of the following for loops 

sets the subscript of gamma out-of-range? 

1. for (j = 0; j <= 49; j++) 

cout << gamma[j] << " "; 

2. for (j = 1; j < 50; j++) 

cout << gamma[j] << " "; 

3. for (j = 0; j <= 50; j++) 

cout << gamma[j] << " "; 

4. for (j = 0; j <= 48; j++) 

cout << gamma[j] << " ";


QUESTION 17

Suppose that sales is an array of 50 elements of type float. Which of the following correctly initializes the array 

sales?

1. for (int 1 = 1; j <= 49; j++)

sales[j] = 0; 

2. for (int j = 1; j <= 50; j++)

sales[j] = 0; 

3. for (int j = 0; j <= 49; j++)

sales[j] = 0.0; 

4. for (int j = 0; j <= 50; j++)

sales[j] = 0.0;

QUESTION 18 

Suppose that list is an array of 10 elements of type int. Which of the following codes correctly outputs all the elements 

of list? 

1. for (int j = 1; j < 10; j++) 

cout << list[j] << " "; 

cout << endl; 

2. for (int j = 0; j <= 9; j++) 

 cout << list[j] << " "; 

cout << endl; 

3. for (int j = 1; j < 11; j++) 

 cout << list[j] << " "; 

cout << endl; 

4. for (int j = 1; j <= 10; j++) 

 cout << list[j] << " "; 

cout << endl;


QUESTION 15 

Assume you have the following declaration 

int beta[50]; 

Which of the following is a valid element of beta? 

1. beta['2'] 

2. beta["50 "] 

3. beta[0]

4. beta[50]

QUESTION 16 

Assume the following declarations 

const int NUMROWS = 3; 

const int NUMCOLS = 4; 

int val[NUMROWS][NUMCOLS]={8,16,9,52,3,15,27,6,14,25,2,10}; 

Which statement will change the value of the element with the value 27 to 55. 

1. val[0][1] = 55; 

2. val[1][2] = 55; 

3. val[1][1] = 55; 

4. val[2][1] = 55;


QUESTION 13 

Which of the following statements declares alpha to be an array of 25 elements of the type int? 

1. int alpha[25]; 

2. int array alpha[25]; 

3. int array alpha[25][25];

4. int alpha[2][5];


QUESTION 14 

Assume you have the following declaration 

char nameList[100]; 

Which of the following ranges is valid for the subscript of the array nameList? 

1. 0 through 99 

2. 0 through 100 

3. 1 through 100 

4. 1 through 101


QUESTION 9 

Which of the following function header correctly includes a two dimensional array as its parameter? 

1. void display(int [ROWS][]); 

2. void display(int [][]);

3. void display(int [ROWS][COLS]); 

4. void display(int [][COLS]);


QUESTION 8 

Assuming the following declarations: 

const int NUMROWS = 3; 

const int NUMCOLS = 4; 

int val[NUMROWS][NUMCOLS] = {8,16,9,52,3,15,27,6,14,25,2,10};

Which of the following loops correctly outputs each element of the array in row order? 

1. for (i = 0; i < NUMROWS; i++) 

 for (j = 0; j < NUMCOLS; j++) 

 cout << setw(4) << val[i][j]; 

 cout << endl; 

2. for (i = 0; i < NUMROWS; i++) 

 cout << setw(4) << val[i][j]; 

 cout << endl; 

3. for (i = 0; i < NUMCOLS; i++) 

 cout << setw(4) << val[i][j]; 

 cout << endl; 

4. for (i = 0; i < NUMROWS*NUMCOLS; i++) 

 cout << setw(4) << val[i][j]; 

 cout << endl; 

}


LATEST TUTORIALS
APPROVED BY CLIENTS