googlebot
Buy Differin Gel Online
ADVERTISEMENT

Learn About Upgrade: MCAD Skills to MCTS Windows Applications

  By Certification Magazine —

1 | 2 | 3 |

Answer:
C

Tutorial:
You should use the following code to trace the user account and SID of the current user:

Dim curID As WindowsIdentity = WindowsIdentity.GetCurrent()
Dim account As New NTAccount(curID.Name)
Dim sid As SecurityIdentifier = _
   CType(account.Translate( _
  GetType(SecurityIdentifier)), SecurityIdentifier)
Trace.Write("User's SID is " & sid.Value, "User " & account.Value)

This code retrieves the current WindowsIdentity object associated with the user, instantiates an NTAccount object using the Name property, invokes the Translate method to retrieve the current SecurityIdentifier object and invokes the Write method on the Trace class to record the Value property of both the SecurityIdentifier and NTAccount objects. The GetCurrent method of the WindowsIdentity class returns a WindowsIdentity object representing the identity of the application user.

The NTAccount class represents a Windows user or group account in the local Security Accounts Manager (SAM) or in the Active Directory domain. The constructor of the NTAccount class accepts either a single string representing the account name or two strings, one representing the domain name and the other representing the account on that domain. To facilitate SID lookups, the Translate method takes a Type argument and returns an IdentityReference object.

You must convert or cast the IdentityReference object to a SecurityIdentifier object to retrieve the SID for the specified account. The Value property of the SecurityIdentifier and NTAccount class returns a SID and fully qualified user name string, respectively. The Write method of the Trace class outputs the specified message into the specified category. In this case, the output of the Trace will resemble the following:

User CompanyWGates:
     User's SID is S-1-5-30-4268806841-974645416-195214038-23611

You should not use the code that does not specify the NTAccount class because a SecurityIdentifier object cannot be instantiated using an account name as an argument, and it does not contain a Name property. You should use the Translate method of the NTAccount class to retrieve the SID associated with a user account.

You should not use the code that does not specify the NTAccount and SecurityIdentifier classes because there is no SID property in the WindowsIdentity class. You should use the NTAccount and SecurityIdentifier classes to retrieve the SID of the current user account.

You should not use the code that does not specify the SecurityIdentifier class because the NTAccount class does not have a SID property. You should invoke the Translate method of the NTAccount class to retrieve the SID of the current user account.

Reference:

MSDN2 Library > .NET Development > .NET Framework SDK > Class Library Reference > System.Security.Principal > NTAccount Class

Objective: Create a UI for a Windows Forms Application by using standard controls.
Sub-objective: Add and configure a Windows Forms control.

Single answer, multiple-choice

You have created a Windows application for your organization. The application minimizes to an icon in the system tray when you click the Minimize button of the Windows form. You want to create a pop-up menu to appear when the user right-clicks the icon in the notification area.

The Exit item on the pop-up menu is assigned to allow the user to close the program. Which property of the NotifyIcon component should you use to implement the required functionality in your application?

A.    ContextMenu.
B.    Tag.
C.    BalloonTipText.
D.    BalloonTipTitle.

Answer:
A

Tutorial:
You should use the ContextMenu property of the NotifyIcon component. This property is used to set the shortcut menu for the icon. When the user right-clicks the icon in the notification area of the taskbar, a shortcut menu — which is also known as the pop-up menu — appears.

You should not use the Tag property. The Tag property is used to set the data about the NotifyIcon component itself. For instance, you might have a TextBox where you want to revert to the original value if a user decides to cancel edits. You could store the original value in the Tag property and pull that out when needed if you're not using data binding. In this scenario, you have used a pop-up menu instead of a balloon tip associated with the icon in the notification area. Therefore, you should not use this property in this scenario.

You should not use the BalloonTipText property. This property is used to specify the text to be displayed on the balloon tip associated with the NotifyIcon control (e.g., on MouseHover). In this scenario, you have used a pop-up menu instead of a balloon tip associated with the icon in the notification area. Therefore, you should not use this property in this scenario.

You should not use the BalloonTipTitle property. This property specifies the title of the balloon tip associated with the NotifyIcon control. In this scenario, you are not dealing with a balloon tip in the current application. Therefore, this property will not be valid in this scenario.

Reference:

MSDN Library > Development Tools and Languages > Visual Studio > Windows-based Applications, Components, and Services > Creating Windows-based Applications > Windows Forms > Getting Started with Windows Forms > Windows Forms Controls > Controls to Use on Windows Forms > NotifyIcon Component Overview

Objective: Integrate data in a Windows Forms Application.
Sub-objective: Manage connections and transactions.

Single answer, multiple-choice

You are an application developer for your company. You are creating a Windows application that will be used by your employees to manage a SQL Server database Sales.

The Sales database is stored on a Microsoft SQL Server 2005 instance named SqlServer1. As per your database administrator's recommendation to manage SqlServer1 instance performance, the maximum number of connections to the SqlServer1 instance should be 100.

You decide to establish a connection with the Sales database and implement connection pooling. Which code should you use to establish the connection with the Sales database?

A.    Dim con As New System.Data.SqlClient.SqlConnection
con.ConnectionString = "Data Source=SqlServer1;" & _
     "Integrated Security=true;Initial Catalog=Sales;" & _
     "Pooling=true;Max Pool Size=100;Min Pool Size=1;"
con.Open()
B.    Dim con As New System.Data.SqlClient.SqlConnection
con.ConnectionString = "Data Source=SqlServer1;" & _
     "Integrated Security=true;Initial Catalog=Sales;" & _
     "Pooling=true;"
con.Open()
C.    Dim con As New System.Data.SqlClient.SqlConnection
con.ConnectionString = "Data Source=SqlServer1;" & _
     "Integrated Security=true;Initial Catalog=Sales;" & _
     "Pooling=true;Max Pool Size=100;Min Pool Size=0"
con.Open()
D.    Dim con As New System.Data.SqlClient.SqlConnection
con.ConnectionString = "Data Source=SqlServer1;" & _
     "Integrated Security=true;Initial Catalog=Sales;" & _
     "Pooling=true;Max Pool Size=1;Min Pool Size=100;"
con.Open()

1 | 2 | 3 |
Viewed 7792 times.
SPONSORED LINKS
gps systems used