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
Tju [1.3M]
4 years ago
7

A programmer wrote the program below. The program uses a list of numbers called numList. The program is intended to display the

sum of the numbers in the list. In order to test the program, the programmer initializes numList to [0, 1, 4, 5].
The program displays 10, and the programmer concludes that the program works as intended.

set! sum = numList [1]
FOR EACH value IN numList
set! sum = sum + value
DISPLAY sum

Which of the following is true?

A) The conclusion is correct; the program works as intended.
B) The conclusion is incorrect; the program does not display the correct value for the test case [0, 1, 4, 5].
C) The conclusion is incorrect; using the test case [0, 1, 4, 5] is not sufficient to conclude the program is correct.
D) The conclusion is incorrect; using the test case [0, 1, 4, 5] only confirms that the program works for lists in increasing order.
Computers and Technology
1 answer:
Nezavi [6.7K]4 years ago
8 0

Answer:

The conclusion is incorrect; using the test case [0, 1, 4, 5] is not sufficient to conclude the program is correct.

Explanation:

From the code snippet given, we cannot conclude that the test case is sufficient.

One of the reasons is because the test case contains only integer variables.

Tests need to be carried out for other large and floating points numerical data types such as decimal, double, float, etc. except that when it's known that the inputs will be of type integer only else, we can't rush into any conclusion about the code snippet

Another reason is that input are not gotten at runtime. Input gotten from runtime environment makes the program flexible enough.

Lastly, the array length of the array in the code segment is limited to 4. Flexible length needs to be tested before we can arrive at a reasonable conclusion.

You might be interested in
***PLEASE HELP*** (25 POINTS) Graded Assignment
Leona [35]
When does this have to be done?
8 0
4 years ago
​________ is the scientific​ collection, examination,​ authentication, preservation, and analysis of data held on or retrieved f
ikadub [295]

Answer:

Computer forensics

Explanation:

Computer forensics

8 0
3 years ago
How many times does the following loop execute?int upperCaseLetters = 0;String str = "abcdEfghI";boolean found = false;for (int
damaskus [11]

Answer:

Five times

Explanation:

Given the codes as follows:

  1.        int upperCaseLetters = 0;
  2.        String str = "abcdEfghI";
  3.        boolean found = false;
  4.        for (int i = 0; i < str.length() && !found; i++)
  5.        {
  6.            char ch = str.charAt(i);
  7.            if (Character.isUpperCase(ch))
  8.            {
  9.                found = true;
  10.            }
  11.        }

The for loop will stop when the first uppercase letter is found in the str. This condition is set in the for loop condition ( i < str.length() && !found)

Since the the first upper case letter is the fifth character in the given str, the for loop will run for five rounds. In the fifth round the condition in the if statement (Line 9) will be evaluated to true and then set the true value to found variable (Line 11). This will terminate the loop in the next iteration.

7 0
3 years ago
Write a statement that calls a function named IncreaseItemQty, passing the variable addStock. Assign mugInfo with the value retu
PolarNik [594]

Answer:

Explanation:

#include <stdio.h>

#include <string.h>

typedef struct ProductInfo_struct {

char itemName[30];

int itemQty;

} ProductInfo;

ProductInfo IncreaseItemQty (ProductInfo productToStock, int increaseValue) {

productToStock.itemQty = productToStock.itemQty + increaseValue;

return productToStock;

}

int main(void) {

ProductInfo mugInfo;

int addStock;

addStock = 10;

scanf("%s", mugInfo.itemName);

scanf("%d", &mugInfo.itemQty);

**** /* Your solution goes here */ ****

printf("Name: %s, stock: %d\n", mugInfo.itemName, mugInfo.itemQty);

return 0;

}

8 0
3 years ago
What form of contacts can be shared in Outlook 2016?
ArbitrLikvidat [17]

Answer:

shared contacts

Explanation:

5 0
3 years ago
Read 2 more answers
Other questions:
  • Which sentences in the passage show the preventive measures to avoid data breach?
    9·1 answer
  • If a small monster collector has 20 small monster containment devices; intends to use all of those devices; has access to non-un
    13·1 answer
  • You have successfully compiled the file Hi.java, how do you run the corresponding program from the command line?
    7·1 answer
  • A demarc is the point in a telephone network where the maintenance responsibility passes from a telephone company to the subscri
    10·1 answer
  • How do you suppose a request travels from one computer to another? How does the request know where to go?
    8·1 answer
  • Which of the following is true about media production? A. All media elements contain a certain type of editorial viewpoint. B. P
    10·1 answer
  • Which Python expression results in 49?<br><br> 7 * 2<br><br> 7^2<br><br> 7 // 2<br><br> 7 ** 2
    12·2 answers
  • What do we call a statement that displays the result of computations on the screen
    12·2 answers
  • Is anyone excited for the new matrix coming out ?
    11·2 answers
  • What is the minimum ethernet frame size that will not be discarded by the receiver as a runt frame?.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!