Question
Provide the output for the following code given: 6 marks-1 mark each for the correct output with working int a[ ]= {12,3,16,4,10,5}; System.out.println(First ); System.out.println
Provide the output for the following code given:
- 6 marks-1 mark each for the correct output with working
int a[ ]= {12,3,16,4,10,5};
System.out.println("First ");
System.out.println (hello (a));
System.out.println ("Second");
prog (a);
}
public static int hello (int x [ ])
{
int sum=0;
for (int i=0; i<6;i++)
{
sum = sum + x[i];
}
return sum;
}
public static void prog (int x [ ])
{
int sum= 0;
int i=0;
while (i<6)
{
sum= sum + x[i];
System.out.println (sum);
i++;
}
- 4 marks-1 mark each for the correct output with working
int [ ]marks = {40, 41, 42,38,25};
for( int i=0; i System.out.println( marks[i] ); convert( marks ); for( int i=0; i System.out.println( marks[i] ); } public static void convert( int[ ] arr ) { for( int i=0; i { arr[i] =arr[i] + 50; } String rem = new String (Mobile phone or any electronic gadget is not allowed during the exam); String made = new String (Conversation in any language is prohibited); String crt = new String();
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started