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:

  1. 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++;

}

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

}

  1. 1 mark for each correct output:

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();

  1. crt= rem.toUpperCase();
  2. crt = made.toLowerCase();
  3. crt = rem.replace(o, A);
  4. System.out.println(made.length());
  5. rem.substring(4);
  6. rem.substring(7,12);
  7. made.indexOf(t);
  8. made.indexOf(i,6)
  9. made.charAt(5);
  10. rem+made

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!