1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ollegr [7]
3 years ago
5

Consider the following code segment, where num is a properly declared and initialized integer variable. The following code segme

nt 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 = {{10, 11, 12, 13},

{22, 24, 26, 28},

{15, 16, 17, 18},

{40, 41, 42, 43}};

int foundRow = -1;

int foundCol = -1;

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

{

for (int k = 1; k < arr[0].length; k++)

{

if (arr[j][k] == 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?
Computers and Technology
1 answer:
seropon [69]3 years ago
3 0

Answer:

10 or 22 or 15 or 40

Explanation:

In the second for loop[for (int k = 1; k < arr[0].length; k++)], k starts from 1 instead of zero. That means that it doesn't read the first value of every row when finding num.

So if num was any of the above values, the program wouldn't work. I had the same question, and the answer for mine was 15.

You might be interested in
Owners of individual domains get to decide what content is published on their websites. Why might this autonomy be important to
Alika [10]

Answer:

Explanation:

With an individual domain name we can upload all the content we want, in a free domain or share domain, upload content in some cases have a limit, for example the size of an image, in an individual domain we can add our brand, in a shared, we can add our brand side to company share those domains, we can have our own email address, practically we have a complete autonomy in our website.

4 0
3 years ago
How many lines are on a standard sheet of typing paper?
kotegsom [21]
60 lines on the paper
3 0
3 years ago
What section of the outline is represented by "A. Africa?"
nikklg [1K]
I think it’s number one...
7 0
3 years ago
Read 2 more answers
A storage location in the computer's memory that can hold a piece of data is called
TiliK225 [7]
This is a named storage location in the computer's memory<span>. Byte code .</span>
7 0
3 years ago
How is an image represented
Sonja [21]
With a sertain address.
4 0
3 years ago
Read 2 more answers
Other questions:
  • Cloud computing service providers manage different computing resources based on the services they offer. Which resources do IaaS
    11·1 answer
  • The next four octal numbers after 36 is:________.
    10·1 answer
  • Which is an internet service?<br><br> Antivirus<br> Chat<br> Firewall<br> Router
    8·2 answers
  • FS and GS are two___________________ in protected mode.
    14·1 answer
  • DES: Group of answer choices A) is a commonly used symmetric encryption B) algorithm that was developed in the mid-C) 1970s was
    6·1 answer
  • Moving laterally within a network once an initial exploit is used to gain persistent access for the purpose of establishing furt
    10·1 answer
  • Why was it important for the date format to be standardized by the
    7·1 answer
  • When you take action independent of direct instruction, you are showing _____.
    11·1 answer
  • How to code for a database?​
    6·1 answer
  • How do mutations affect natural selection? brain pop
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!