Given the declaration                         char table[7][9];                             which of the following stores the character 'B' into the fifth row...

80.2K

Verified Solution

Question

Programming

  1. Given the declaration

           

           char table[7][9];

           

               which of the following stores the character 'B'into the fifth row and second column of the array?

           A) table[5] = 'B';

           B)   table[2][5] = 'B';

           C)   table[5][2] = 'B';

           D) table[1][4] = 'B';

           E)   table[4][1] = 'B';

  1. This program fragment is intended to zero out a two-dimensionalarray:

int arr[10][20];

           int i, j;

           

           for (i = 0; i < 10; i++)

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

                     // Statementis missing here

           

               What is the missing statement?

           A) arr[j+1][i+1] = 0;

           B)   arr[i-1][j-1] = 0;

           C)   arr[i+1][j+1] = 0;

           D) arr[i][j] = 0;

           E)   arr[j][i] = 0;

3. Given this nested For loops

  for (i = 0; i < M;i++)

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

                     cout<< arr[i][j];

           

               what is the appropriate declaration for arr?

           A) int arr[M+N];

           B)   int arr[M+1][N+1];

           C)   int arr[M][N];

           D) int arr[N][M];

           E)   int arr[N+1][M+1];

  1. Given the declarations

           

           float alpha[5][50];

           float sum = 0.0;

           

               which one computes the sum of the elements inrow 2 of alpha?

           A) for (i = 0; i < 50; i++)

                          sum = sum +alpha[2][i];

           B)   for (i = 0; i < 5; i++)

                          sum = sum +alpha[2][i];

           C)   for (i = 0; i < 50; i++)

                          sum = sum +alpha[i][2];

           D) for (i = 0; i < 5; i++)

                          sum = sum +alpha[i][2];

  1. Look at the following array definition.

int numberArray[9][11];

Write a statement that assigns 130 tothe first column of the second row of this array.

  1. Write a statement which will assign 18 to the last column ofthe last row of this array.

Values is a two-dimensional array offloats that include 10 rows and 20 columns. Write a

code that sums all the elements in the array and stores the sumin the variable named total.

Answer & Explanation Solved by verified expert
3.8 Ratings (545 Votes)
Ans 1 E table41 B The first half is used to get to the 5th row4th index and second part is used to get to the 2nd column1 st index Ans 2 D arrij 0 Since we the row    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students