Q2: You create an application to send a message by e-mail. An SMTP
server is available on the local subnet. The SMTP server is named
smtp.Company.com. To test the application, you use a source address,
[email protected], and a target address, [email protected].
You need to transmit the e-mail message. Which code segment should you
use?
A. MailAddress addrFrom = new MailAddress(”[email protected]”, “Me”);
MailAddress addrTo = new MailAddress(”[email protected]”, “You”);
MailMessage message = new MailMessage(addrFrom, addrTo);
message.Subject = “Greetings!”;
message.Body = “Test”;
message.Dispose();
B. string strSmtpClient = “mstp.Company.com”;
string strFrom = “[email protected]”;
string strTo = “[email protected]”;
string strSubject = “Greetings!”;
string strBody = “Test”;
MailMessage msg = new MailMessage(strFrom, strTo, strSubject, strSmtpClient);
C. MailAddress addrFrom = new MailAddress(”[email protected]”);
MailAddress addrTo = new MailAddress(”[email protected]”);
MailMessage message = new MailMessage(addrFrom, addrTo);
message.Subject = “Greetings!”;
message.Body = “Test”;
SmtpClient client = new SmtpClient(”smtp.Company.com”);
client.Send(message);
D. MailAddress addrFrom = new MailAddress(”[email protected]”, “Me”);
MailAddress addrTo = new MailAddress(”[email protected]”, “You”);
MailMessage message = new MailMessage(addrFrom, addrTo);
message.Subject = “Greetings!”;
message.Body = “Test”;
SocketInformation info = new SocketInformation();
Socket client = new Socket(info);
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
byte[] msgBytes = enc.GetBytes(message.ToString());
client.Send(msgBytes);
Answer: C
Q3: You need to write a code segment that will create a common
language runtime (CLR) unit of isolation within an application. Which code
segment should you use?
A. AppDomainSetup mySetup = AppDomain.CurrentDomain.SetupInformation;
mySetup.ShadowCopyFiles = “true”;
B. System.Diagnostics.Process myProcess;
myProcess = new System.Diagnostics.Process();
C. AppDomain domain;
domain = AppDomain.CreateDomain(”CompanyDomain”):
D. System.ComponentModel.Component myComponent;
myComponent = new System.ComponentModel.Component();
Answer: C
Q4: You are developing an application that dynamically loads assemblies
from an application directory.
You need to write a code segment that loads an assembly named
Company1.dll into the current application domain. Which code segment
should you use?

Join the conversation! Your thoughts help the community grow.