Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Analysis Using SQL And Excel

Authors: Gordon S Linoff

2nd Edition

111902143X, 9781119021438

More Books

Students also viewed these Databases questions