What should you conclude?

You create Web-based applications. You create a loan application form. The loan application form is used to calculate the monthly payment of loans. The monthly payment is based on the loan amount, rate, and number of months. The form contains four text boxes and a button. There are no other controls in the form. The application event handler has the following lines of code. (Line numbers are included for reference only.)

01 protected void GetPayment(object sender, EventArgs e) { 02 try {
03 decimal rate = decimal.Parse(txtRate.Text);
04 decimal loanAmount = decimal.Parse(txtLoan.Text);
05 int period = int.Parse(txtPeriod.Text);
06 decimal payment = CalcPayment(rate, loanAmount, period); 07 txtPayment.Text = payment.ToString(“C”);
08 }
09 catch (OverflowException ex) {
10 …
11 }
12 catch (InvalidCastException ex) {
13 …
14 }
15 catch (Exception ex) {
16 …
17 }
18 }

You must prevent exceptions whenever possible to meet the application requirements. You need to evaluate the current exception handling mechanism. What should you conclude?

You create Web-based applications. You create a loan application form. The loan application form is used to calculate the monthly payment of loans. The monthly payment is based on the loan amount, rate, and number of months. The form contains four text boxes and a button. There are no other controls in the form. The application event handler has the following lines of code. (Line numbers are included for reference only.)

01 protected void GetPayment(object sender, EventArgs e) { 02 try {
03 decimal rate = decimal.Parse(txtRate.Text);
04 decimal loanAmount = decimal.Parse(txtLoan.Text);
05 int period = int.Parse(txtPeriod.Text);
06 decimal payment = CalcPayment(rate, loanAmount, period); 07 txtPayment.Text = payment.ToString(“C”);
08 }
09 catch (OverflowException ex) {
10 …
11 }
12 catch (InvalidCastException ex) {
13 …
14 }
15 catch (Exception ex) {
16 …
17 }
18 }

You must prevent exceptions whenever possible to meet the application requirements. You need to evaluate the current exception handling mechanism. What should you conclude?

A.
The current exception handling mechanism meets the requirements. Nothing needs to be changed.

B.
The current exception handling mechanism does not meet the requirements. A required field validator and a range validator control must be added to validate each text box before the button is clicked.

C.
The current exception handling mechanism does not meet the requirements. A required field validator control must be added to validate each text box before the button is clicked.

D.
The current exception handling mechanism does not meet the requirements. A regular expression validator control must be added to validate each text box before the button is clicked.



Leave a Reply 0

Your email address will not be published. Required fields are marked *