Question

What is the output of this code sequence? (Be exact in your answer with spacing) int...

  1. What is the output of this code sequence? (Be exact in your answer with spacing)

int [ ] a = {12,48,65};

for (int i=0; i <a.length;i++)

   System.out.println(“a[“ +i+”] = “+ a[i]);

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

Hey,

Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries

a[0] = 12
a[1] = 48
a[2] = 65

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
What is the output of this code sequence? (Be exact in your answer with spacing) int...
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
  • What is the output of the following code sequence? int i = 10; i--; System.out.println(i); --i;...

    What is the output of the following code sequence? int i = 10; i--; System.out.println(i); --i; System.out.println(i); System.out.println(++i); System.out.println(i++); System.out.println(i); System.out.println(--i); System.out.println(i--); System.out.println(i); if (i++ == 8) System.out.println("Eight"); if (++i == 9) System.out.println("Nine"); System.out.println("Final value " + i); 2. Show the change in the code above so that it also prints out Nine

  • What is the output of the following code? for(int i =0; i<3; i++) { int x...

    What is the output of the following code? for(int i =0; i<3; i++) { int x = 0; x = x+i; Sy System.out.println(x);

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

  • In JAVA Thank You What is the exact output produced by running the method test? /**...

    In JAVA Thank You What is the exact output produced by running the method test? /** * TestSwap.java * Demonstrates parameter passing involving arrays and integers, * scope of variables, flow of control, and overloaded methods. */ public class TestSwap { public void swap (int x, int y) { int temp; temp = x; x = y; y = temp; System.out.println("Inside swap version 1:"); System.out.println("x = " + x); System.out.println("y = " + y); } public void swap (int[] a,...

  • What is the output of this code segment? double [] a = {-1.2, 3.1, -4.7, 38.0,...

    What is the output of this code segment? double [] a = {-1.2, 3.1, -4.7, 38.0, 0.0}; double temp = a[0]; for (int i = 1; i < a.length; i++) { if (a[i] < temp) { temp = a[i]; } } System.out.println (temp); What does this method do? In one short English sentence describe the task accomplished by this method. public static int foo(int [] a) { int temp = 0; for (int i = 0; i < a.length; i++)...

  • Question 15 (1 point) What does this program print? Please make sure your spacing is exact....

    Question 15 (1 point) What does this program print? Please make sure your spacing is exact. public class Test { System.out.print("39 + 3"); System.out.println(39 + 3); } 1 A/ Question 5 (1 point) Consider a file called input.txt that has the following 4 lines: Trace the program when it is 89 lines 78.5 is average. Isn't it? What would be the value of count after the following code snippet executes? Scanner in = new Scanner (new File("input.txt")); int count 0;...

  • What is the output of the following code fragment? int i = 1; while( i <=...

    What is the output of the following code fragment? int i = 1; while( i <= 5 ) if(i == 2 || i == 4) System.out.println(i + ":" + " is an even index) System.out.println("i: " + i); i++;

  • Please explain how you get the output for each case. 3. What is the output of...

    Please explain how you get the output for each case. 3. What is the output of the following jave code fragments: a. intl A-(1,3,0,2,4) int temp = A[0]; for (int í=0; i< A.length-l; i++) A(幻-A(1+1); AI4]-temp; for (int i: A) System.out.print(ALi]" b. intll A-(3,0,2,4,1) int B new int [51: for(int i-o; ǐ< A.length; ǐ++) for (int i: B)System.out.print (B[i]"" C. int A A-new intl for (int i-0: i A.length-1; 1++) AI4] -temp; for (int i: A)System.out.print (A[ +"

  • What does the following code output? int[] array = { 1, 4, 3, 6, 8, 2,...

    What does the following code output? int[] array = { 1, 4, 3, 6, 8, 2, 5); int sum = array[0]; Il scan the array for (int i=0; i < array.length; i++) { if ( array[i] > sum) sum = array[i]; 3 System.out.println( sum );

  • What is the output produced by the following lines of code? int value1 = 4 ;...

    What is the output produced by the following lines of code? int value1 = 4 ; int value2 = 7 ; System.out.println("++value1 is: " + ++value1) ; System.out.println("value2-- is: " + value2--) ; System.out.println("++value1 * value2-- is " + (++value1 * value2--)) ;

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