Advertisements
Advertisements
Question
Given:
int AM[]= {3, 6, 12, 24, 48 96};
for (int p= 3; p<6 ; p++)
System.out.print ("*" + AM[p]/2);
The output will be ______.
Options
* 6 * 12 * 24 * 48
* 12 * 24 * 48
12 * 24 * 48 *
* 24 * 48 * 96
MCQ
Fill in the Blanks
Advertisements
Solution
The output will be * 12 * 24 * 48.
Explanation:
The loop starts from index 3 and continues up to index 5. It accesses the elements 24, 48, and 96 of the array. Each element is divided by 2, resulting in 12, 24, and 48. These values are printed with an asterisk (*) before each value. Hence, the output is *12*24*48.
shaalaa.com
Is there an error in this question or solution?
Chapter 7: Arrays - One Dimension - Exercises [Page 173]
