1. For each statement, circle the response that best completes it. For the first nine statements, consider this Java method and the array shown to its right. array public static int linkSun (inta, int startloc, int sunlimit) ( lat sun 0, 1 startloc; } while (1>0 sun sun a[i]; + 1 = a[i]; return sun; sun sunlinit) { (ii) The call linkSum (junk, a. 1 b. 4 c. 5 (i) The expression linkSun (junk, 3, 12) evaluates to a 13 b. 22 c. 10 d. 1 (iii) The call linkSum (junk, ArrayIndexOutOfBoundsException b. 2 a actual parameter c. local variable startLoc 012 Junk 10141711131-1101 211 d. 6 a. boolean expression c. assignment statement ,20) results in an infinite loop. e. none of above ,15) results in an being thrown. d. 6 a 1 c. 5 e. none of above (iv) In the method above (applied to any array), we can be sure that at the moment that the loop terminates. a a[1] < 0 c. 1 < 0 kk sum b. 1 > startLoc 11 sun > sunlimit d. 1 <0 11 sum >= sunlimit e. none of the above (v) In the method above, each of int and static is a(n) a reserved word b. variable c. expression (vi) In the method above, sun is a(n) a actual parameter c. local variable (vii) In the method above, startLoc is a(a) b. formal parameter e. none of above b. formal parameter d. instance variable 4567 d. instance variable (viii) In the method above, 1 a[1] is a(n) b. arithmetic expression d. method call d. parameter will be true

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter8: Arrays
Section: Chapter Questions
Problem 20RQ
icon
Related questions
Question
1. For each statement, circle the response that best completes it.
For the first nine statements, consider this Java method and the array shown to its right.
array
public static int linkSum(int'a, int startLoc, int sunlimit) (
startLoc;
int sun
0, 1
while (1>0 & sun sunlimit) {
aun- sum + a[i];
1 = a[i];
}
return dum;
(i) The expression linkSum (junk, 3, 12) evaluates to
a. 13
b. 22
c. 10
d. 1
(ii) The call linkSum (junk,
b. 4
a. 1
c. 5
(iii) The call linkSum (junk,
Array IndexOutOfBoundsException
a. 1
c. 5
0 1 2 3 4 5 6 7
Junk 1 0141711131-1101 211
startLoc
d. 6
,20) results in an infinite loop.
e. none of above
,15) results in an
being thrown.
d. 6
e. none of above
b. 2
(iv) In the method above (applied to any array), we can be sure that
at the moment that the loop terminates.
a. a[i] < 0
b. 1 > startLoc || sun >= sunlimit
d. 1 <0 11 sum >= sumlinit
c. 1 <0 & sum
e. none of the above
(v) In the method above, each of int and static is a(n)
a reserved word
b. variable
c. expression
(vi) In the method above, sum is a(n)
a actual parameter
c. local variable
e. none of above
b. formal parameter
d. instance variable
(vii) In the method above, startLoc is a(n)
a. actual parameter
b. formal parameter
c. local variable
d. instance variable
(viii) In the method above, i= a[i] is a(n)
a boolean expression
c. assignment statement
b. arithmetic expression
d. method call
d. parameter
will be true
Transcribed Image Text:1. For each statement, circle the response that best completes it. For the first nine statements, consider this Java method and the array shown to its right. array public static int linkSum(int'a, int startLoc, int sunlimit) ( startLoc; int sun 0, 1 while (1>0 & sun sunlimit) { aun- sum + a[i]; 1 = a[i]; } return dum; (i) The expression linkSum (junk, 3, 12) evaluates to a. 13 b. 22 c. 10 d. 1 (ii) The call linkSum (junk, b. 4 a. 1 c. 5 (iii) The call linkSum (junk, Array IndexOutOfBoundsException a. 1 c. 5 0 1 2 3 4 5 6 7 Junk 1 0141711131-1101 211 startLoc d. 6 ,20) results in an infinite loop. e. none of above ,15) results in an being thrown. d. 6 e. none of above b. 2 (iv) In the method above (applied to any array), we can be sure that at the moment that the loop terminates. a. a[i] < 0 b. 1 > startLoc || sun >= sunlimit d. 1 <0 11 sum >= sumlinit c. 1 <0 & sum e. none of the above (v) In the method above, each of int and static is a(n) a reserved word b. variable c. expression (vi) In the method above, sum is a(n) a actual parameter c. local variable e. none of above b. formal parameter d. instance variable (vii) In the method above, startLoc is a(n) a. actual parameter b. formal parameter c. local variable d. instance variable (viii) In the method above, i= a[i] is a(n) a boolean expression c. assignment statement b. arithmetic expression d. method call d. parameter will be true
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT