PrepAway - Latest Free Exam Questions & Answers

Which two actions should you perform?

You are modifying an application that processes leases. The following code defines the Lease class. (Line
numbers are included for reference only.)
01 public class Lease
02 {
03
04 private int _term;
05 private const int MaximumTerm = 5;
06 private const decimal Rate = 0.034m;
07 public int Term
08 {
09 get
10 {
11 return _term;
12 }
13 set
14 {
15 if (value <= MaximumTerm)
16 {
17 _term = value;
18 }
19 else
20 {
21
22 }
23 }
24 }
25 }
26 public delegate void MaximumTermReachedHandler(object source, EventArgs e);
Leases are restricted to a maximum term of 5 years. The application must send a notification message if a
lease request exceeds 5 years. You need to implement the notification mechanism. Which two actions should
you perform? (Each correct answer presents part of the solution. Choose two.)

PrepAway - Latest Free Exam Questions & Answers

A.
Insert the following code segment at line 03:
public event MaximumTermReachedHandler OnMaximumTermReached;

B.
Insert the following code segment at line 21:
if (OnMaximumTermReached != null)
{
OnMaximumTermReached(this, new EventArgs());
}

C.
Insert the following code segment at line 21:
value = MaximumTerm;

D.
Insert the following code segment at line 03:
public string maximumTermReachedEvent { get; set; }

E.
Insert the following code segment at line 03:
private string MaximumTermReachedEvent;

F.
Insert the following code segment at line 21:
value = 4;


Leave a Reply