Question: Consider the following code segment, where num is a properly declared and initialized integer variable. The following code segment is intended to set foundRow and
Consider the following code segment, where num is a properly declared and initialized integer variable. The following code segment is intended to set foundRow and foundCol to the row and column indexes of an array element containing num. The code segment does not work as intended.
int arr
;
int foundRow ;
int foundCol ;
for int j ; j arr.length; j
for int k ; k arrlength; k
if arrjk num
foundRow j;
foundCol k;
Which of the following values for num can be used as a test case to show that the code segment does not work as intended?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
