English

Given: int ta[ ] = {11, 22, 33, 44, 55}; ar[3]+= ar[2]; System.out.print(“ ar[3]=" + ar[3]); The output will be ______.

Advertisements
Advertisements

Question

Given:

int ta[ ] = {11, 22, 33, 44, 55};
ar[3]+= ar[2];
System.out.print(“ ar[3]=" + ar[3]);

The output will be ______.

Options

  • ar[3]=44

  • ar[3]=33

  • ar[3]=55

  • ar[3]=77

MCQ
Fill in the Blanks
Advertisements

Solution

The output will be ar[3]=77.

Explanation:

  • Value Lookup: Based on zero-indexing, ar[2] equals 33 and ar[3] equals 44.
  • Addition Step: The expression ar[3] + = ar[2] performs 44 + 33, updating ar[3] to 77.
  • Final Print: The print statement displays the text directly with the newly updated value.
shaalaa.com
  Is there an error in this question or solution?
Chapter 7: Arrays - One Dimension - Exercises [Page 173]

APPEARS IN

Rupa Pandit Computer Applications [English] Class 10 ICSE
Chapter 7 Arrays - One Dimension
Exercises | Q 1. (vi) | Page 173
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×