Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1.What is the output of this code segment? double [] a = {-1.2, 3.1, -4.7, 38.0, 0.0}; double temp = a[0]; for (int i =

1.What is the output of this code segment?

 double [] a = {-1.2, 3.1, -4.7, 38.0, 0.0}; double temp = a[0]; for (int i = 1; i < a.length; i++) { if (a[i] < temp) { temp = a[i]; } } System.out.println (temp); 

2.What does this method do? In one short English sentence describe the task accomplished by this method.

 public static int foo(int [] a) { int temp = 0; for (int i = 0; i < a.length; i++) { if (a[i] < 0) { temp++; } } return temp; } 

3.What does this method do? In one short English sentence describe the task accomplished by this method.

 public static char [] bar(String [] a) { char [] tmp = new char[a.length]; for (int i = 0; i < a.length; i++) { if (a[i].length() > 0) { tmp[i] = a[i].charAt(0); } else { tmp[i] = ' '; } } return tmp; } 

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_2

Step: 3

blur-text-image_3

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

More Books

Students also viewed these Databases questions

Question

What is the difference between a plan and a budget?

Answered: 1 week ago

Question

Explain budgetary Control

Answered: 1 week ago

Question

Solve the integral:

Answered: 1 week ago

Question

What is meant by Non-programmed decision?

Answered: 1 week ago

Question

What are the different techniques used in decision making?

Answered: 1 week ago

Question

Describe Table Structures in RDMSs.

Answered: 1 week ago