Question

Sample Code I int j = 3; int k = j; if (k > 22) break 7 9 while (k 21); 10 System. out.print (k>; Referring to the sample code above, what is the value of variable k on line 10? 20 Question Choice 1 Choice 2 Choice 3 21 23 Choice 4 Choice 5

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer: Choice 4: 23

Explanation:

1 public class Tester5 i 2 public static void main( String args 3 int j = 3; int k = j; do += j; if (22) break; 7 10 while k<

Add a comment
Know the answer?
Add Answer to:
Sample Code I int j = 3; int k = j; if (k > 22) break...
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
  • 1 int i, j, k; 2 for (i = 1; i <= 4; i++) 3 {...

    1 int i, j, k; 2 for (i = 1; i <= 4; i++) 3 { 4 j = 1; 5 while (j < 4) 6 { 7 if (i % 2 == j % 2) 8 k = 100*i + 10*j; 9 else 10 k = 100*j + 10*i; 11 j++; 12 } 13 } What will be the value of the variable k at the end of the third, sixth, ninth, and twelfth iteration of the while loop

  • Translate the following code into MIPS code. Test (int i, int j)                         {        &nbsp

    Translate the following code into MIPS code. Test (int i, int j)                         {                         int k;                         k = Double(i+1) + Double (j-10)                         return k;                         } Sub (int m)                         {                         int g;                         g = m + m;                         return g;                         } Assume the compiler associates the variable k to the register $s0. Assume the compiler associates the variable g to the register $t0.

  • What is the value of k after the following code segment? int i,j,k = 0; for...

    What is the value of k after the following code segment? int i,j,k = 0; for (i=0; i < 5; i++)       for (j = i; j < 5; j++)              k++;             a-10             b-15             c-20             d-25

  • Need a FLOW Chart for that code. break; case 3: for (inti-14; 14 ) #include <iostream>...

    Need a FLOW Chart for that code. break; case 3: for (inti-14; 14 ) #include <iostream> #include stream> using namespace std: int cubes(int) int squares(int): int powerFivelint): int main() break; case 4: for (int i -10 ; i<=10: i++) { int choice, n=1; string line; char lastChac while (choice !-5) ( coutceChoose an option:in" coutss 1: Factorials [odd,and even in 14-1 and 1-14In" coutrs"2: Squares [14-14n" coutce"3: Cubes [-14-14Jn, coutsc 4: 5th power [-10-10n break case 5 cout<c"Goodbyeln" break default:...

  • 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;...

  • How many Iterations will this while loop perform? int ico), j(10); cout << "i = "...

    How many Iterations will this while loop perform? int ico), j(10); cout << "i = " << i << endl; cout << "j = " << j << endl; while (i > j) { cout << "j-" « j << endl; j += 2; cout << "i = " << i << endl; } cout << "i = << i << endl; cout << "j = " << j << endl; 5 6 C 8 10 Infinite times Does the...

  • Fill in the code Procedure BinaryPeak(a_1, a_2, ..., a_n: 1. t:= 1 2. j:= n 3....

    Fill in the code Procedure BinaryPeak(a_1, a_2, ..., a_n: 1. t:= 1 2. j:= n 3. while (t < j) 4. m [j/2] 5. if 6.:= m + 1 7. else 8. j:= m 9. return t

  • 1 #include<stdio.h> 53 int findMax (int, SA 5 int main() 6 { int n; int max;...

    1 #include<stdio.h> 53 int findMax (int, SA 5 int main() 6 { int n; int max; int maxLoc; co n = //ASSIGNMENT HERE 12 13 14 15 16 max = findMax (n, &maxLoc); n = n - max* (int) pow (10, maxLoc); //PRINT STATEMENT HERE 17 18 return(0); 19 ) 20 21 int findMax (int n, int *maxLoc) 22 { 23 int max = 0; int loc = 0; 24 25 26 while(n > 0) 27 28 if(n% 10 >...

  • 1)What is the output of the following code: int i = 10; do { cout <<...

    1)What is the output of the following code: int i = 10; do { cout << i; i++; } while (i < 5); cout << "-done"; 2)What is the output of the following code (note there are no endl's, all output is on single line)? for (int i = 1; i <= 3; i++) {    cout << '(';    for (int j = 0; j < (i*2); j++)        cout << 'x';    cout << ')'; }

  • Consider the following code segment. int[]arr={1, 2, 3, 4, 5, 6, 7, 8}; for(int k=3; k<arr.length-1;...

    Consider the following code segment. int[]arr={1, 2, 3, 4, 5, 6, 7, 8}; for(int k=3; k<arr.length-1; R++ arr[k]-arr[k+1]; What are the contents of arr as a result of executing the code segment? a. {1, 2, 3, 5, 6, 7, 8, 8) b. {2, 2, 4, 5, 6, 7, 8, 8} C. {2, 4, 6, 5, 6, 7, 8,8} d. {4, 2, 4, 4, 6, 7, 8, 8) e. {6, 6, 4, 5, 6, 7, 8, 8} int) arr={7, 2.5, 3.0,...

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