Tuesday

70-536 Dumps 2013 MICROSOFT .NET FRAMEWORK - ADF


70-536: TS: MICROSOFT .NET FRAMEWORK - APPLICATION DEVELOPMENT FOUNDATION Latest Dumps 2013



                                         PART 1 OF 10 (With Explanation)


QUESTION 1

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.

Correct Answer: A

Explanation: It is good practice to wrap the messy P-Invoke code with a .net class. The main benefit is to keep the client code tidy as the messy and cryptic code will be hidden away. Also better for maintenance e.g dll name or version changes.
The question explicitly says the unmanaged code should be called with platform invoke services. Importing \exporting a type library is relevant for interoperation with COM.

QUESTION 2

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

Correct Answer: A

Explanation: System.UInt16 is the most efficient type for storing positive whole numbers up to 65,536.
· An int type could be used but it is a lot wider than necessary.
· System.String is intended for storing immutable strings.
· System.IntPtr is a pointer to a memory address and it's size is determined by the runtime platform. It is primarily used for interoperation.

QUESTION 3

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 = LookupUserRoles(userName);

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 = WindowsIdentity.Impersonate(token);

Correct Answer: A

Explanation: Because the application storing the credentials, the GenericIdentity & GenericPrincipal classes should be used instead of the WindowsIdentity\Pricipal classes.

QUESTION 4

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.

Correct Answer: C

Explanation: The ThreadPool class allows background tasks to run in parallel hence calculations can be queued to run as soon as a ThreadPool Worker thread becomes available. Because the ThreadPool can manage many worker threads, calculations will run in parallel.
· ProcessThread.IdealProcessor requests a preferred processor for the thread to run on, it will not however spawn a new thread which is what is required here to enable concurrency.
· ProcessorAffinity gets or sets the processors that this thread can be scheduled to run on.
· Process.BasePriority gets the base priority of the process.

QUESTION 5

You are creating a strong-named assembly named Company1 that will be used in multiple applications.
Company1 will be rebuilt frequently during the development cycle. You need to ensure that each time the assembly is rebuilt it works correctly with each application that uses it. You need to configure the computer on which you develop Company1 such that each application uses the latest build of Company1.
Which two actions should you perform? (Each correct answer presents part of the solution.Choose two.)

A. Create a DEVPATH environment variable that points to the build output directory for the strong named assembly.

B. Add the following XML element to the machine configuration file:
<dependentAssembly>
<assemblyIdentity name="Assembly1"
publicKeyToken="32ab4ba45e0a69a1"
language="en-US" version="*.*.*.*" />
<publisherPolicy apply="no" />
</dependentAssembly>

C. Add the following XML element to the configuration file of each application that uses the strong- named
assembly:
<supportedRuntime version="*.*.*.*" />

D. Add the following XML element to the machine configuration file:
<developmentMode developerInstallation="true"/>

E. Add the following XML element to the configuration file of each application that uses the strong- named
assembly:
<dependentAssembly>
<assemblyIdentity name="Assembly1"
publicKeyToken="32ab4ba45e0a69a1"
language="en-US" version="*.*.*.*" />
<bindingRedirect newVersion="*.*.*.*"/>
</dependentAssembly>

Correct Answer: AD

Explanation: The developmentmode element in the machine configuration file tells the .net runtime to locate the assembly by using the DevPath environment variable.
· The SupportedRuntime element specifies which .net runtime versions the assembly supports.
· The DependentAssembly element is used to encapsulate the binding policy and assembly location for each assembly.

QUESTION 6

You are defining a class named CompanyClass that contains several child objects. CompanyClass contains a method named ProcessChildren that performs actions on the child objects. CompanyClass objects will be serializable.
You need to ensure that the ProcessChildren method is executed after the CompanyClass object and all its child objects are reconstructed.
Which two actions should you perform? (Each correct answer presents part of the solution.Choose two.)

A. Apply the OnDeserializing attribute to the ProcessChildren method.
B. Specify that CompanyClass implements the IDeserializationCallback interface.

C. Specify that CompanyClass inherits from the ObjectManager class.
D. Apply the OnSerialized attribute to the ProcessChildren method.
E. Create a GetObjectData method that calls ProcessChildren.
F. Create an OnDeserialization method that calls ProcessChildren.

Correct Answer: BF

Explanation: The iDeserializationCallback interface allows some custom code to be called after the complete object graph has been deserialized via the onDeserialization method. In this case the ProcessChildren should be called in the onDeserialization method.
Applying OnDeserializingAttribute to the ProcessChildren method will not work because there is not guarantee that the complete object graph will have been deserialized.
If the MyClass class inherits from ObjectManager it will still have to implement iDeserializationCallback to perform actions after the complete object graph has been deserialized.
The OnSerialized attribute signifies that a method should be called immediately after serialization of the
object.

QUESTION 7

You develop a service application that needs to be deployed. Your network administrator creates a specific user account for your service application. You need to configure your service application to run in the context of this specific user account.
What should you do?

A. Prior to installation, set the StartType property of the ServiceInstaller class.
B. Prior to installation, set the Account, Username, and Password properties of the ServiceProcessInstaller class.
C. Use the CONFIG option of the net.exe command-line tool to install the service.
D. Use the installutil.exe command-line tool to install the service.

Correct Answer: B

Explanation: The ServiceProcessInstaller class is automatically called during installation. It is the ideal place to specify the default service settings such as account credentials.
ServiceInstaller.StartType controls how the service will start up e.g automatically or manually. It has nothing to do with a specific account.
Net.exe with the config option is used to configure the server or workstation services.
Installutil.exe can be used to install the service but it is not possible to specify or override service account
credentials. They have to be specified in the ServiceProcessInstaller class.

QUESTION 8

You are creating a class that performs complex financial calculations. The class contains a method named
GetCurrentRate that retrieves the current interest rate and a variable named currRate that stores the current
interest rate.
You write serialized representations of the class.
You need to write a code segment that updates the currRate variable with the current interest rate when an instance of the class is deserialized. Which code segment should you use?

A. [OnSerializing]internal void UpdateValue (StreamingContext context) {
currRate = GetCurrentRate();
}
B. [OnSerializing]internal void UpdateValue(SerializationInfo info) {
info.AddValue("currentRate", GetCurrentRate());
}
C. [OnDeserializing]internal void UpdateValue(SerializationInfo info) {
info.AddValue("currentRate", GetCurrentRate());
}
D. [OnDeserialized]internal void UpdateValue(StreamingContext context) {
currRate = GetCurrentRate();
}

Correct Answer: D

Explanation: A method with the OnDeserialized attribute will be called after Deserialization and any instance variables can be set.

QUESTION 9

You are writing an application that uses isolated storage to store user preferences. The application uses multiple assemblies. Multiple users will use this application on the same computer.
You need to create a directory named Preferences in the isolated storage area that is scoped to the current Microsoft Windows identity and assembly.
Which code segment should you use?

A. IsolatedStorageFile store;
store = IsolatedStorageFile.GetUserStoreForAssembly();
store.CreateDirectory("Preferences");
B. IsolatedStorageFile store;
store = IsolatedStorageFile.GetMachineStoreForAssembly();
store.CreateDirectory("Preferences");
C. IsolatedStorageFile store;
store = IsolatedStorageFile.GetUserStoreForDomain();
store.CreateDirectory("Preferences");
D. IsolatedStorageFile store;
store = IsolatedStorageFile.GetMachineStoreForApplication();
store.CreateDirectory("Preferences");

Correct Answer: A

Explanation: The user store for the assembly is the correct store that is required. It is returned by IsolatedStorageFile.GetUserStoreForAssembly().

QUESTION 10

Your company uses an application named Application1 that was compiled by using the .NET Framework version 1.0. The application currently runs on a shared computer on which the .NET Framework versions 1.0 and 1.1 are installed.
You need to move the application to a new computer on which the .NET Framework versions 1.1 and 2.0 are installed. The application is compatible with the .NET Framework 1.1, but it is incompatible with the .NET Framework 2.0. You need to ensure that the application will use the .NET Framework version 1.1 on the new
computer.

What should you do?

A. Add the following XML element to the machine configuration file.
<configuration>
<runtime>
<assemblyBinding
xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Application1"
publicKeyToken="32ab4ba45e0a69a1"
culture="neutral" />
<bindingRedirect oldVersion="1.0.3075.0"
newVersion="1.1.4322.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

B. Add the following XML element to the application configuration file.
<configuration>
<startup>
<supportedRuntime version="1.1.4322" />
<startup>
</configuration>

C. Add the following XML element to the application configuration file.
<configuration>
<runtime>
<assemblyBinding
xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Application1"
publicKeyToken="32ab4ba45e0a69a1"
culture="neutral" />
<bindingRedirect oldVersion="1.0.3075.0"
newVersion="1.1.4322.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

D. Add the following XML element to the machine configuration file.
<configuration>
<startup>
<requiredRuntime version="1.1.4322" />
<startup>
</configuration>

Correct Answer: B

QUESTION 11

You are loading a new assembly into an application.
You need to override the default evidence for the assembly.
You require the common language runtime (CLR) to grant the assembly a permission set, as if the assembly were loaded from the local intranet zone. You need to build the evidence collection.
Which code segment should you use?

A. Evidence evidence = new Evidence();
Assembly.GetExecutingAssembly().Evidence);
B. Evidence evidence = new Evidence();
evidence.AddAssembly(new Zone(SecurityZone.Intranet));
C. Evidence evidence = new Evidence();
evidence.AddHost(new Zone(SecurityZone.Intranet));
D. Evidence evidence = new Evidence(AppDomain.CurrentDomain.Evidence);

Correct Answer: C

Explanation: Use the evidence.AddHost method to add Zone evidence.









No comments:

Post a Comment