What will be the output of the below program? List what will be outputed to the screen and explain your answer. class Class_name main() // Declarations num index num SIZE = 10 num numbers[SIZE] = 0,0,0,0,0,0,0,0,0,0 index = 0 while index < SIZE numbers[index]= index * 10 index = index + 1 endwhile output “The Output is: ” while index > 0 index = index – 1 output numbers[index] endwhile return endClass What is the screen output of the following code segment? Explain the reasoning behind your answer. Test1 = 70 Test2 = 80 Test3 = 84 NumberOfTests = 3 Average = (Test1 + Test2 + Test3) / NumberOfTests IF Average >= 90 THEN Output “Great job” Output “Your average is: ”, Average ELSE IF Average >= 80 or Average <=89 THEN Output “Nice work” Output “Your average is: “, Average ELSE Output : “Your Average is:”, Average Output “, You will do better next time!” ENDIF Purchase the answer to view it Purchase the answer to view it Purchase the answer to view it

The first program provided is in a pseudocode format. To determine the output of the program, we need to analyze the code and understand the logic behind it.

In the given program, we have a class named “Class_name” and a main function. The main function starts with declaring variables “num index” and “num SIZE” with a value of 10. It also declares an array named “numbers” with a size of 10 and initializes all elements to 0.

The next line of code sets the “index” variable to 0. Then, we enter a while loop with the condition “index < SIZE". Inside the loop, we have the following lines of code: 1. numbers[index] = index * 10: This line assigns a value to the element at the current index position in the "numbers" array. The value is calculated by multiplying the index by 10. 2. index = index + 1: This line increments the index by 1. Once the while loop ends (when index becomes equal to 10), the program proceeds to the next line of code: 3. output "The Output is: ": This line outputs the text "The Output is: " to the screen. After that, we enter another while loop with the condition "index > 0″. Inside this loop, we have the following line of code:

4. output numbers[index]: This line outputs the value of the element at the current index position in the “numbers” array.

The last line of code in the program is “return”, which indicates the end of the main function.

Based on the logic of the program, the expected output will be:

The Output is:
90
80
70
60
50
40
30
20
10
0

This is because the while loop in line 3 assigns values to the elements of the “numbers” array in descending order (from 90 to 0), and the while loop in line 4 outputs those values in the reverse order (from 0 to 90).

In the second program provided, we have a code segment that calculates the average of three test scores (Test1, Test2, and Test3) and then provides an output based on the average. Let’s analyze the code and determine the output.

The code segment starts with declaring variables “Test1”, “Test2”, “Test3”, “NumberOfTests”, and “Average” and assigning them their respective values.

The next line of code calculates the average by summing the test scores and dividing the sum by the number of tests.

After that, we have an if-else statement. The condition “Average >= 90” is checked first. If it evaluates to true, the code inside the if block is executed, which includes the following lines:

1. Output “Great job”: This line outputs the text “Great job” to the screen.

2. Output “Your average is: “, Average: This line outputs the text “Your average is: ” followed by the value of the average variable to the screen.

If the condition in the if-else statement is false, the program moves to the next condition “Average >= 80 or Average <= 89" inside the else-if block. If it evaluates to true, the code inside the else-if block is executed, which includes the following lines: 1. Output "Nice work": This line outputs the text "Nice work" to the screen. 2. Output "Your average is: ", Average: This line outputs the text "Your average is: " followed by the value of the average variable to the screen. If both conditions in the if-else statement are false, the program executes the code in the else block, which includes the following lines: 1. Output "Your Average is:", Average: This line outputs the text "Your Average is: " followed by the value of the average variable to the screen. 2. Output ", You will do better next time!": This line outputs the text ", You will do better next time!" to the screen. Based on the provided values for Test1 (70), Test2 (80), and Test3 (84), the average will be (70 + 80 + 84) / 3 = 78. The condition "Average >= 80 or Average <= 89" evaluates to true, so the output will be: Nice work Your average is: 78 This is the screen output that will be displayed by the code segment.

Need your ASSIGNMENT done? Use our paper writing service to score better and meet your deadline.


Click Here to Make an Order Click Here to Hire a Writer