Question


CISC 1110 Examination #2 Name: 7. (10 pts) D raw a picture of array A, showing the values stored in it after execution of each code segment below. Use the following data: 01234567 89 int A[4][2]: int k, m; for (int i 0; i 3; i++) for (int j = 0; j <= i ; j++) A[i][j] = 0; for (int j = 1 ; j <= 10:j++) cin >>k switch (k) case 1 case 2: case 2: A(k)(2-k] = 10 * k; break; case 4: case 5: case 6: case 7: A[k2][1] = 5-k; break; case 3: A[k-1][k-3]-50; break; default: A[3][k/6] k; break
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Hi,

Please find below the answer-

Add a comment
Know the answer?
Add Answer to:
Draw a picture of array A, showing the values stored in it after execution of each...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Not sure if I did the mergesort execution correct as well as the merge execution. Can...

    Not sure if I did the mergesort execution correct as well as the merge execution. Can you try explaining it visually sort of like how I was approaching it visually. After that translate it to c++ code if possible. I saw another post that used int *L = new int[n1+1] in the merge function which is the same as int L[n1 +1]correct? Heres my driver function int main () € cout << "Enter length you'd like the array Leendl; int...

  • Only part 1, makinf the 2nd and 3rd picture of code do the same thing using...

    Only part 1, makinf the 2nd and 3rd picture of code do the same thing using array Purpose This homework is to learn the concept and usage of one-dimensional (ID) arrays. Part 1 (30 pts) Modify your HW6' (i.e., digit frequency histogram) in a new program (DigitFrequencyArray.java) to use a count array instead of 10 count variables. Your new program should be much shorter than your original code since there is no need for branching statements (if or switch). For...

  • A) Rewrite the following pseudocode segment in C++ using the loop structures (for and while). Assume...

    A) Rewrite the following pseudocode segment in C++ using the loop structures (for and while). Assume that all the variables are declared and initialized. k-G+ 13)/27 loop: if k> 10 then goto out k=k+1 i=3"k-1 goto loop I out: B) Rewrite the following code segment in C++ using the multiple-selection (switch and if-else) statements. Assume that all the variables are declared and initialized. if((k 1) || (k 2))j-2 k-1 if ((k 3) || ( ks))j - 3.k+1 if (k 4)j-4k-1...

  • 1. What is the output of the following code segment? int array[] = { 8, 6,...

    1. What is the output of the following code segment? int array[] = { 8, 6, 9, 7, 6, 4, 4, 5, 8, 10 }; System.out.println( "Index Value" ); for ( int i = 0; i < array.length; i++ ) System.out.printf( "%d %d\n", i, array[ i ] ); 2. What is the output of the following code segment? char sentence[] = {'H', 'o', 'w', ' ', 'a', 'r', 'e', ' ', 'y', 'o', 'u' }; String output = "The sentence...

  • Help! in Java, test values {0, 1, 3, 6, 10} I need this to print 107...

    Help! in Java, test values {0, 1, 3, 6, 10} I need this to print 107 but it keeps printing 75. What am I doing wrong???     public int switchCase( int []values) {        int sum = 0;        for(int i = 0;i<values.length;i++){            sum += values[i];               }                       int value = values.length;            switch (sum){               case 1:           ...

  • What are the values stored in the array a after the following code executes? int[] a...

    What are the values stored in the array a after the following code executes? int[] a = new int[10]; a[0] = 1; for (int i = 1; i < a.length; i++) a[i] = 2 * a[i - 1] - 1;

  • 1. (25 points) Assume each expression listed below represents the execution time of a program Express...

    1. (25 points) Assume each expression listed below represents the execution time of a program Express the order of magnitude for cach time using big O notation. a. T(n) = ns + 100n . log2 n + 5000 b. T(n) = 2" +n” + 7 d. T(n) 1+2+4+2 2 (75 points+5 extra credit) For cach of the code segments below, determine an equation for the worst-case computing time Tn) (expressed as a function of n, ie. 2n+4) and the order...

  • 20) What is the output of the following segment of C code: int avg(int n, int*...

    20) What is the output of the following segment of C code: int avg(int n, int* a); int main () {             int array[4]={1,0,6,9};             printf("%d", avg(4, array)+ 1);             system("pause");             return 0; } int avg(int n, int* a) { int i, sum=0; for (i=0;i<n;i++) { sum+=a[i]; } return sum/n; } a) 16 b) 5 c) 4 d) 8 21) What is the output of the following segment of C code: int x = 2; int y = 3;...

  • A method called linearSearch(), which takes as parameters an array of int followed by three values...

    A method called linearSearch(), which takes as parameters an array of int followed by three values of type int, and returns a value of type int. The first int parameter represents a key, the second int parameter represents a starting position, and the third int parameter represents an end position. If the key occurs in the array between the start position (inclusive) and the end position (exclusive), the method returns the position of the first occurrence of the key in...

  • 41. Executing the "continue" statement from within a loop     causes control to go     A....

    41. Executing the "continue" statement from within a loop     causes control to go     A. to the next line of code     B. out of the loop     C. to the beginning of the loop          D. to check the loop condition for repeating the loop     E. none of the above      42. The 'default' statement inside a 'switch()' is optional.          T__   F__             43. The following 'switch' implementation is legal:              int i = 2;        ...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT