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
A number of technical mechanisms—digital watermarks and embedded code, copyright codes, and even the intentional placement of ba
melomori [17]

Answer:

The given statement is "True".

Explanation:

  • Software property ownership seems to be computer programs or law-protected software whether, under a licensing, company name, proprietary information, or software commercialization.
  • Collaborate, and operate for a deeper understanding or analysis of the important technological processes and trade-offs throughout collaborative consumption developing future as well as integrated frameworks.

7 0
3 years ago
H&amp;R Block's stated purpose is: to be the leading global consumer tax company bringing tax and related solutions to clients y
jok3333 [9.3K]

Answer:

The correct answer is D.

Explanation:

In the given example, the task that the artificial intelligence system has to fulfill is to take control of an irregular task that is performed by humans. This requires a solution that depends on neural networks which work by evaluating given data sets and makes sense of them through the provided algorithms. They eventually come to a conclusion recognizing the relationships between the data points so that the system can decide what action to take. This procedure can be implemented to take control of the tax solution task that is performed by accountants.

I hope this answer helps.

5 0
3 years ago
Using language c, find the nth Fibonacci, knowing that nth Fibonacci is calculated by the following formula: - If n = 1 Or n = 2
Nina [5.8K]

Answer:

#include <stdio.h>

int fib(int n) {

 if (n <= 0) {

   return 0;

 }

 if (n <= 2) {

   return 1;

 }

 return fib(n-1) + fib(n-2);

}

int main(void) {

 for(int nr=0; nr<=20; nr++)

   printf("Fibonacci %d is %d\n", nr, fib(nr) );

 return 0;

}

Explanation:

The code is a literal translation of the definition using a recursive function.

The recursive function is not per se a very efficient one.

4 0
3 years ago
These operating systems were referred to as command-based.
alexira [117]

Command-Line Interface (CLI)


3 0
3 years ago
What is the missing line of code?
Ray Of Light [21]

Answer:

phrase[2:5]

Explanation:

Given:

The above code segment

Required

Which instruction returns 'u a'

First, we need to get the index of u in the phrase:

u is at the third position but in programming, index starts at 0.

So, u is at index 2

Next, we need to get the index of a in the phrase:

a is at index 4

One of the ways to return a sub string from a string in python is string[start:stop+1]

Where:

start = 2 ----- index of u

stop = 4  ----- index of a

phrase ---- The string variable

So, the instruction that returns 'u a' is: phrase[2:5]

<em>Where 5 = 4 + 1</em>

5 0
3 years ago
Other questions:
  • Janet has to create a webpage for a software company that should be accessible from both desktop computers and mobile devices. W
    12·1 answer
  • Which of the following techniques has to do with how the people who make the commercial manipulate the way it looks?
    8·1 answer
  • What is the use of html in websites
    15·2 answers
  • An internal _____ refers to a specific representation of an internal model, using the database constructs supported by the chose
    8·1 answer
  • Software companies will often release a(n) ___ version to a limited audience that will test it on their systems. Programmers can
    11·1 answer
  • According to what theory did the universe expand explosively into existence 13.7 billion years ago?
    13·2 answers
  • Define<br>output<br>devices<br>.<br>Give<br>any<br>three<br>examples<br>.<br>3.​
    8·2 answers
  • PLEASE HELP ME FIX THIS CODE.
    10·1 answer
  • What sets Web pages apart from other documents is that they contain a special kind of text called ___, which is document text th
    14·1 answer
  • Which statement best describes how the programming layer of abstraction in
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!