I need an answer key for my practice questions

qoebja448
timer Asked: Feb 23rd, 2016

Question Description

9. Fill in the blanks below to enable us to pass a double array called dbx to a method

called heroWorship. Within the method, the array should be called vb.

boolean bbc = heroWorship( );

public boolean heroWorship( ) //signature of method

10. Assume the five values an integer array adc contains are: 34, 56, -102, 18, and 5.

What is the value of adc[1] ?

11. Using the adc array from #10 above, what would be the value of adc[3] + adc[4]?

12. Using the adc array from #10 above, what would be the value of adc[5] ?

13. Describe what the following code segment does:

for (int j = 0; j < b.length; j++)

b[j] = Math.abs( b[j] );

14. For the int array c = {1, 2, 3, 4}, what would be the output of the following code?

String ss = “>>>”;

int len = ss.length( );

for (int j = 0; j < len; j++)

ss+= c[j];

System.out.println(ss);

15. Write a loop that locates the first occurrence of a negative integer in an array, pg.

When the loop is finished, the variable indx should contain the index of the negative

number, or the length of the array if there were no negative numbers in the array.

16.  String wc = “Whooping crane”;

String sp[] = wc.split(“oo”);

for(int j = 0; j < sp.length; j++)

{

System.out.println(sp[j]);

}

17. List the elements of String [ ]sArray = “fee fi fo ”.split(“\\s+”);.

18. List the elements of String [ ]sp = “One two”.split(“Q”);.

19. Using the split method, write code that will count all of the occurrences of “th”

(without regard to upper or lower case) in “The best THERE is is Barth”.


User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

This question has not been answered.

Create a free account to get help with this and any other question!

Related Tags

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors