Which two actions should you perform?

You are creating a class named Employee. The class exposes a string property named
EmployeeType. The following code segment defines the Employee class. (Line numbers are
included for reference only.)

The EmployeeType property value must meet the following requirements:
The value must be accessed only by code within the Employee class or within a class
derived from the Employee class.
The value must be modified only by code within the Employee class.
You need to ensure that the implementation of the EmployeeType property meets the
requirements.
Which two actions should you perform? (Each correct answer represents part of the
complete solution. Choose two.)

You are creating a class named Employee. The class exposes a string property named
EmployeeType. The following code segment defines the Employee class. (Line numbers are
included for reference only.)

The EmployeeType property value must meet the following requirements:
The value must be accessed only by code within the Employee class or within a class
derived from the Employee class.
The value must be modified only by code within the Employee class.
You need to ensure that the implementation of the EmployeeType property meets the
requirements.
Which two actions should you perform? (Each correct answer represents part of the
complete solution. Choose two.)

A.
Replace line 03 with the following code segment:
public string EmployeeType

B.
Replace line 06 with the following code segment:
protected set;

C.
Replace line 05 with the following code segment:
private get;

D.
Replace line 05 with the following code segment:
protected get;

E.
Replace line 03 with the following code segment:
protected string EmployeeType

F.
Replace line 06 with the following code segment:
private set;



Leave a Reply 9

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


sandip

sandip

Correct answer –
D, F
Protected Get
Private Set

Mario

Mario

you cant change both get and set accessor.
You can change the class accessor + chose get or set to change.
The answer is E and F

Kim Tae Hong

Kim Tae Hong

No, Correct answer is E,F
cause of internal keyword

j

j

Yes, E and F
protected string EmployeeType
{
get;
private set;
}

Kashish

Kashish

E & F are right. Please don’t post wrong answers.

Rao

Rao

E & F is correct TESTED

Alisher

Alisher

D,F

Alisher

Alisher

wrong,
E,F – right