Write an explanation for the correct answers SCENARIO: Lionel is a student at the School of Fine
Question:
Write an explanation for the correct answers
SCENARIO: Lionel is a student at the School of Fine Art. To help pay his tuition, he took a job in the school’s student records department. He developed a program that calculates each student’s grade point average (GPA). He thought it would be simple, because he knows that the formula is: total grade points divided by total credit hours attempted However, Lionel’s program crashes with new students who have not attempted any credit hours, instead of just giving them a GPA of 0.0. Here is his code in C# (line numbers added):
1: double GPA; 2: GPA = total GP / credit Hours Attempted; 3: Console. Write Line (GPA);
1. Given what we know about the problem, what is the most likely exception this code will throw?
a. Divide By Zero Exception
b. Null Reference Exception
c. Stack Overflow Exception
2. What structure should Lionel use to handle the exception?
a. do-catch b. catch-exception
c. try-catch
3. Which of the following should Lionel’s catch-block probably include?
a. credit Hours Attempted = 1.0; b. total GP = 4.0; c. GPA = 0.0;
Horngrens Accounting
ISBN: 978-0133855371
10th Canadian edition Volume 1
Authors: Tracie L. Miller-Nobles, Brenda L. Mattison, Ella Mae Matsumura, Carol A. Meissner, Jo-Ann L. Johnston, Peter R. Norwood