Sunday, August 23, 2009

70-536 MCTS .NET Sample Questions #23

Hey Now,

Please feel free to check out my MCTS 70-536 reference page on Chris It’s a page with a summary of all of my posts.
As I study for this test I thought this would be good to post on to learn the content & others would be able to view & comment on it.

This content below is from some practice questions from the internet. I’ve also added some of my notes to these so any line starting with K8 (my nickname, first syllable of Catt o ) are my comments.



Q#51 – Q#59


Question: 51

You need to create a dynamic assembly named MyAssembly. You also need to save the assembly to disk. Which code segment should you use?

A. AssemblyName myAssemblyName =

new AssemblyName();myAssemblyName.Name = “MyAssembly”;AssemblyBuilder

myAssemblyBuilder =




B. AssemblyName myAssemblyName =

new AssemblyName();myAssemblyName.Name = “MyAssembly”;AssemblyBuilder

myAssemblyBuilder =




C. AssemblyName myAssemblyName =

new AssemblyName();AssemblyBuilder myAssemblyBuilder =




D. AssemblyName myAssemblyName =

new AssemblyName(“MyAssembly”);AssemblyBuilder myAssemblyBuilder =



AssemblyBuilderAccess.Save);myAs semblyBuilder.Save(“c:\\MyAssembly.dll”);

Answer: B

K8 - myAssemblyBuilder.Save is needed

Question: 52

You need to call an unmanaged function from your managed code by using platform invoke services. What should you do?

A. Create a class to hold DLL functions and then create prototype methods by using managed code.

B. Register your assembly by using COM and then reference your managed code from COM.

C. Export a type library for your managed code.

D. Import a type library as an assembly and then create instances of COM object.

Answer: A

K8 – Create a class, in the question pinvoke is stated so DLL is in answer.

Question: 53

You are developing a class library that will open the network socket connections to computers on the network. You will deploy the class library to the Global Assembly Cache and grant it full trust. You write the following code to ensure usage of the socket connections.

SocketPermission^ permission =

gcnew SocketPermission(PermissionState::Unrestricted);permission->Assert(); Some of the

applications that use the class library might not have the necessary permissions to open the

network socket connections.

You need to cancel the assertion. Which code segment should you use?

A. CodeAccessPermission::RevertAssert();

B. CodeAccessPermission::RevertDeny();

C. permission->Deny();

D. permission->PermitOnly();

Answer: A

K8 - CodeAccessPermission & ReverAssert()

Question: 54

You need to identify a type that meets the following criteria:

Is always a number.

Is not greater than 65,535. Which type should you choose?

A. System.UInt16

B. int

C. System.String

D. System.IntPtr

Answer: A

K8 - UInt16 is the type that meets the required.

Question: 55

You are writing code for user authentication and authorization. The username, password, and roles are stored in your application data store. You need to establish a user security context that will be used for authorization checks such as IsInRole. You write the following code segment to authorize the user.

if (!TestPassword(userName, password))

throw new Exception(“could not authenticate user”);String[] userRolesArray =


You need to complete this code so that it establishes the user security context. Which code segment should you use?

A. GenericIdentity ident = new GenericIdentity(userName);

GenericPrincipal currentUser = new

GenericPrincipal(ident, userRolesArray);Thread.CurrentPrincipal = currentUser;

B. WindowsIdentity ident = new WindowsIdentity(userName);WindowsPrincipal currentUser =

new WindowsPrincipal(ident);Thread.CurrentPrincipal = currentUser;

C. NTAccount userNTName = new NTAccount(userName);GenericIdentity ident = new

GenericIdentity(userNTName.Value);GenericPrincipal currentUser= new

GenericPrincipal(ident, userRolesArray);Thread.CurrentPrincipal = currentUser;

D. IntPtr token = IntPtr.Zero;token = LogonUserUsingInterop(username,

encryptedPassword);WindowsImpersonationContext ctx =


Answer: A

K8 – GenericIdentity

Question: 56

You are developing an application for a client residing in Hong Kong. You need to display negative currency values by using a minus sign. Which code segment should you use?

A. NumberFormatInfo culture = new CultureInfo(“zh-HK”).NumberFormat;

culture.NumberNegativePattern = 1; return numberToPrint.ToString(“C”, culture);

B. NumberFormatInfo culture = new CultureInfo(“zh-HK”).NumberFormat;

culture.CurrencyNegativePattern = 1; return numberToPrint.ToString(“C”, culture);

C. CultureInfo culture = new CultureInfo(“zh-HK”);return numberToPrint.ToString(“-(0)”, culture);

D. CultureInfo culture = new CultureInfo(“zh-HK”); return numberToPrint.ToString(“()”, culture);

Answer: B

K8 – Cultureinfo & CurrencyNegativePattern

Question: 57

You are developing an application that will perform mathematical calculations. You need to ensure that the application is able to perform multiple calculations simultaneously.

What should you do?

A. Set the IdealProcessor property of the ProcessThread object.

B. Set the ProcessorAffinity property of the ProcessThread object.

C. For each calculation, call the QueueUserWorkItem method of the ThreadPool class.

D. Set the Process.GetCurrentProcess().BasePriority property to High.

Answer: C

K8 – QueueUserWorkItem of Thead pool for multiple simultaneous Calculations.

Question: 58

You develop a service application named PollingService that periodically calls long-running procedures. These procedures are called from the DoWork method. You use the following service application code.

ref class PollingService : public ServiceBase {

public :

static bool blnExit = false;

protected :

override void OnStart(String^ args) {

do {


} while (!blnExit);


override void OnStop() {

blnExit = true;


private :

void DoWork() {} };

When you attempt to start the service, you receive the following error message: Could not start the PollingService service on the local computer. Error 1053: The service did not respond to the start or control request in a timely fashion. You need to modify the service application code so that the service starts properly. What should you do?

A. Move the loop code into the constructor of the service class from the OnStart method.

B. Drag a timer component onto the design surface of the service. Move the calls to the long-running procedure from the OnStart method into the Tick event procedure of the timer, set the Enabled property of the timer to True, and call the Start method of the timer in the OnStart method.

C. Add a class-level System.Timers.Timer variable to the service class code. Move the call to the DoWork method into the Elapsed event procedure of the timer, set the Enabled property of the timer to True, and call the Start method of the timer in the OnStart method.

D. Move the loop code from the OnStart method into the DoWork method.

Answer: C

K8 – System.Timers.Timer var & set enabled property to true & call start method.

Question: 59

You are creating an assembly named Company1. Company1 contains a public method. The global cache contains a second assembly named Company2. You must ensure that the public method is only called from Company2. Which permission class should you use?

A. GacIdentityPermission

B. PublisherIdentityPermission

C. DataProtectionPermission

D. StrongNameIdentityPermission

Answer: D

K8 – Good Old StrongNameIdentityPermission class

No comments: