Prior to the nested IF code which follows, there is code to calculate the variab
ID: 3811860 • Letter: P
Question
Prior to the nested IF code which follows, there is code to calculate the variables: average_of_student_grades, count_of_grades_for80_and_Above, number_of_students, and maximum_score. Their values are the ones shown in red in the chart below.
Once the nested IF immediately below is run, what value is OUTPUT?
IF average_of_student_grades > 80 AND count_of_grades_for80_and_Above > 12 THEN
OUTPUT “Hurray”
ELSE
IF number_of_students < 20 OR maximum_score > 99 THEN
OUTPUT “Fabulous”
ELSE
OUTPUT “We can do better”
END IF
END IF
Am I a Student Final Greater My Grade than 80 Grade student Again 78 0 1 78 Student A 56 1 56 Student B 1 1 Student C 100 100 85 1 1 85 Student D 1 1 82 Student E 82 Student F 91 1 1 911 Student G 951 1 1 95 Student H I 66 1 66 Student 89 1 1 Student J 89 75 0 1 75 Student K 1 70 Student L 70 83 1 1 83 Student M 78 0 1 78 Student N Student o 94 1 1 94 83 1 1 83 Student P 81 1 1 81 Student Q 1 76 Student R 76 89 1 1 89 Student S 90 1 90 Student T average of 81.9 100 count of gra 12 number 20 maximu student grad des for 80 an m Score d Above studentsExplanation / Answer
First, it check for average_of_student_grades > 80 AND count_of_grades_for80_and_Above > 12 condition. First condition of program.
But it will not satisfy as count_of_grades_for80_and_Above =12 and in if condition it check for greater than 12.
So, program execution goes to else condition.
In else condition, there is another if condition i.e. number_of_students < 20 OR maximum_score > 99.
As here number_of_students should less that 20, but according to table number_of_students = 20. So, it will not satisfy. But if, we notice on condition there is OR between two condition. So, it means either of two condition if one condition is correct then that condition execute successfully.
So second condition is maximum_score greater that 99. And According to table maximum_score equal to 100.
Condition is satisfy. so it will execute this condition and print Fabulous.
So, it will not execute else part.
Output:-
Fabulous
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.