Sunteți pe pagina 1din 55

98-372.Examcollection.Premium.Exam.

230q
Number: 98-372
Passing Score: 800
Time Limit: 120 min
File Version: 14.1

Exam Code: 98-372


Exam Name: Microsoft .NET Fundamentals
Version 14.1

Topic 1, C#
QUESTION 1
Which collection enforces type safety?
A.
B.
C.
D.

Queue
Hashtable
ArrayList
List<T>

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 2
You need to trace the execution of an application that contains C# code and Microsoft Visual Basic .NET code.
Which tool should you use?
A.
B.
C.
D.

Machine Debug Manager


Remote Debug Monitor
Microsoft Visual Studio
CLR Profiler

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 3
Which core technology allows interoperability between Microsoft Visual Basic .NET code and C# code?
A.
B.
C.
D.

Microsoft Visual Studio


Windows 7
Microsoft Intermediate Language (MSIL)
Windows Azure

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 4
What is an advantage of strongly typed code languages like .NET?
A.
B.
C.
D.

Use of efficient type casting.


Use of less memory.
Capturing of errors during compilation.
Improved readability.

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 5
Why do managed languages use references and not pointers?
A.
B.
C.
D.

Pointer notation requires more characters than reference notation.


Pointers are stored by using a fixed amount of memory.
Pointers are not type-safe.
Null pointers can lead to run-time errors.

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
Type-safe accesses only the memory locations it is authorized to access, and only in well- defined, allowable ways. Type-safe code cannot perform an operation on
an object that is invalid for that object.
QUESTION 6
What is the name of the environment that runs .NET managed code?
A.
B.
C.
D.

Common Language Runtime (CLR)


Component Object Model (COM)
Virtual Private Network (VPN)
Microsoft Intermediate Language (MSIL)

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 7
You need to suspend the current thread until all Finalize() methods have been processed.
Which garbage collection method should you use?
A.
B.
C.
D.

WaitforPendingFinalizers
SuppressFinalize
Collect
Dispose

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 8
Which feature is automatically handled in managed code but must be explicitly handled in unmanaged code?
A.
B.
C.
D.

Namespaces
Code signing
Memory disposal
Exception handling

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
Unmanaged code does not have a garbage collector and you will have to keep track of all your memory allocations to avoid memory leaks.
QUESTION 9
You want to access a native Win32 function from a .NET application.
You import the function.
Which two keywords should you use to define the function? (Each correct answer presents part of the solution. Choose two.)
A.
B.
C.
D.

Extern
Static
Private
Public

Correct Answer: AB
Section: (none)
Explanation
Explanation/Reference:
Example:
using System.Runtime.InteropServices;
using System.Windows.Interop;
using System.Diagnostics;
using System.Threading;
public partial class MainWindow : Window
{
[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
public MainWindow()
{
InitializeComponent();
}
private void btnHost_Click(object sender, RoutedEventArgs e) {
WindowInteropHelper wndHelp = new WindowInteropHelper(this); Process.Start("Notepad.exe");
// Sleep the thread in order to let the Notepad start completely Thread.Sleep(50);
SetParent(FindWindow("NotePad", "Untitled - Notepad"), wndHelp.Handle); }
}
QUESTION 10
A class named Student is contained inside a namespace named Contoso.Registration. Another class named Student is contained inside a namespace named
Contoso.Contacts.
You need to use both classes within the same code file. What are two possible ways to achieve this goal? (Each correct answer presents a complete solution.
Choose two.)
A. Add the following line of code on the top of the code file, Using Contoso;
Refer to the classes by using the Student class wrapped within the regions named Registration and Contacts.
B. Refer to the classes by using their fully qualified class names, Contoso.Registration.Student and Contoso.Contacts.Student.

C. Add the following lines of code on the top of the code file.
Using Contoso.Contacts;
Using Contoso.Registration;
Refer to the classes by using the Student class.
D. Add the following lines of code on the top of the code file.
Using RStudent = Contoso.Registration.Student;
Using CStudent = Contoso.Contacts.Student;
Refer to the classes as RStudent and CStudent.
Correct Answer: AC
Section: (none)
Explanation
Explanation/Reference:
QUESTION 11
Which describes the effect of applying the protected accessibility modifier to a method?
A.
B.
C.
D.

The method is available to all classes derived from the declaring class.
The method is available only to other methods in the same class.
The method cannot be overridden in child classes.
The method is available only to classes in the same assembly.

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 12
You want to create a class named ShoppingCart that has a type argument named TItem. The TItem type argument must be a value type.
Which code segment should you use to define the ShoppingCart class?

A.
B.
C.
D.

Option A
Option B
Option C
Option D

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 13
You create a class library named Contoso.Business. The library is used in a Windows application named Contoso.Ui.
In which file should you store application configuration settings during deployment?
A. Web.config

B. Machine.config
C. Contoso.Ui.config
D. Contoso.Business.config
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
The project system stores application settings in two XML files: an app.config file, which is created at design time when you create the first application setting; and a
user.config file, which is created at run time when the user who runs the application changes the value of any user setting.
QUESTION 14
Which is the base class of all classes in the .NET Framework?
A.
B.
C.
D.

System.Net
System.Drawing
System.Object
System

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 15
You want to raise a custom exception.
Which keyword should you use?
A.
B.
C.
D.

Finally
Catch
Try
Throw

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 16
What is the purpose of the app.config file?
A.
B.
C.
D.

To configure the version of .NET targeted by the application.


To load references to third-party libraries used by the application.
To find out the programming language of the application.
To configure the target operating system of the application.

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 17
What is the characteristic of a delegate?
A.
B.
C.
D.

A type-safe function pointer


An object that raises an event
A tightly coupled event
A property function that includes optional parameters

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
The .NET Framework defines a special type (Delegate) that provides the functionality of a function pointer.
A delegate is a class that can hold a reference to a method. Unlike other classes, a delegate class has a signature, and it can hold references only to methods that
match its signature. A delegate is thus equivalent to a type-safe function pointer or a callback.
QUESTION 18
You define a method according to the following code segment. (Line numbers are included for reference only.)

Where should you insert code that must be executed, regardless of whether or not an error is thrown?
A.
B.
C.
D.

Between lines 05 and 06


Between lines 08 and 09
Between lines 11 and 12
Between lines 12 and 13

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 19
You write code that reads a file from the disk.
Which exception will catch an error if the file is missing?
A.
B.
C.
D.

InvalidOperationException
FaultException
IOException
ApplicationException

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 20
Which file contains the required .NET settings for an ASP.NET web application?
A.
B.
C.
D.

Default.aspx
Web.config
Global.asax
Site.master

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 21
Which two actions should you perform to consume events defined in another class? (Each correct answer presents part of the solution. Choose two.)
A.
B.
C.
D.
E.

Define a method that raises the event.


Set the current class as a sealed class.
Place a reference to the consuming class in the class that raises the event.
Match the signature of the delegate declared for the event.
Define an event handler method

Correct Answer: DE
Section: (none)
Explanation
Explanation/Reference:
QUESTION 22
In which folder should you store the web.config file in a .NET web application?
A.
B.
C.
D.

App_Data
App_Code
Root
Bin

Correct Answer: C

Section: (none)
Explanation
Explanation/Reference:
QUESTION 23
Which .NET object combines the identity and role of a user?
A.
B.
C.
D.

FormsIdentity
WindowsPrincipal
WindowsIdentity
GenericIdentity

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
The WindowsPrincipal Class enables code to check the Windows group membership of a Windows user.
The WindowsPrincipal class is primarily used to check the role of a Windows user.
Incorrect:
Not GenericIdentity: Represents a generic user. An identity object represents the user on whose behalf the code is running.
QUESTION 24
Which three policy types are .NET security policy levels? (Choose three.)
A.
B.
C.
D.
E.

Data policy
Machine policy
Application domain policy
Enterprise policy
Network policy

Correct Answer: BCD


Section: (none)
Explanation
Explanation/Reference:
The following table describes the four security policy levels provided by .NET Framework security.
* Enterprise policy
All managed code in an enterprise setting where an enterprise configuration file is distributed.
* Machine policy
All managed code on the computer.
* User policy
Code in all the processes associated with the current operating system user when the common language runtime starts.
* Application domain policy
Managed code in the host's application domain
QUESTION 25
You need to find out whether an application has access to delete files from the C:\Logs directory.
Which code segment should you use?
A.
B.
C.
D.

var permission = new FileIOPermission(FileIOPermissionAccess.PathDiscovery, "C:\\Logs");


var permission = new FileIOPermission (FileIOPermissionAccess.Read, "C:\\Logs");
var permission = new FileIOPermission(FileIOPermissionAccess.Write, "C:\\Logs");
var permission = new FileIOPermission(FileIOPermissionAccess.Append, "C:\\Logs");

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 26
Which feature protects computers from running untrusted applications?
A.
B.
C.
D.

Code Access security


Role-based security
Evidence-based security
Cryptography

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
Role-Based Security
Business applications often provide access to data or resources based on credentials supplied by the user. Typically, such applications check the role of a user and
provide access to resources based on that role. The common language runtime provides support for role-based authorization based on a Windows account or a
custom identity.
QUESTION 27
The SecureString class:
A. Ensures that a password is strong enough.
B. Protects data from being revealed during garbage collection.
C. Ensures that memory will always be available for a string.

D. Remains in memory always.


Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 28
Which two methods can you use to load an assembly? (Each correct answer presents a complete solu- tion. Choose two.)
A.
B.
C.
D.

GetLoadedModules()
LoadModule(String, ByteQ)
LoadFrom(String)
Load(String)

Correct Answer: BD
Section: (none)
Explanation
Explanation/Reference:
B: LoadModule(String, Byte[])
Loads the module, internal to this assembly, with a common object file format (COFF)-based image containing an emitted module, or a resource file.
D: Assembly.Load Method (String)
Loads an assembly given the long form of its name.
QUESTION 29
What is the purpose of strong naming?
A.
B.
C.
D.

To assign a globally unique key to the assembly.


To ensure that only one version of an assembly is stored in a directory at any point in time.
To manage the references of the file list in an assembly's manifest.
To impose restrictions on how different data types are defined within an assembly.

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 30
Which standard allows data types to be interchanged among all Common Language Infrastructure (CLI) programming languages?
A.
B.
C.
D.

Common Intermediate Language System (CILS)


Virtual Execution System (VES)
Common Type System (CTS)
Microsoft Intermediate Language (MSIL)

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 31
You need to retrieve an assembly's Version property. Which class should you use?
A.
B.
C.
D.

AssemblyName
MemberInfo
Assembly
OperatingSystem

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 32
You have created a program that writes status updates into a file.
You want to modify the file.
You need to ensure that other users can view the file while it is being modified.
Which permission should you use to open the file?
A.
B.
C.
D.
E.

FileAccess.Write
FileShare.Inheritable
FileShare.Read
FileShare.None
FileAccess.Read

Correct Answer: C

Section: (none)
Explanation
Explanation/Reference:
QUESTION 33
Which two classes in the .NET Framework allow you to delete a file? (Each correct answer presents a complete solution. Choose two.)
A.
B.
C.
D.
E.

System.IO.FileInfo
System.IO.FileStream
System.IO.Stream
System.IO.Path
System.IO.File

Correct Answer: AE
Section: (none)
Explanation
Explanation/Reference:
A: System.IO.FileInfo provides properties and instance methods for the creation, copying, deletion, moving, and opening of files, and aids in the creation of
FileStream objects.
E: System.IO.File provides static methods for the creation, copying, deletion, moving, and opening of files, and aids in the creation of FileStream objects.
Incorrect:
Not B: System.IO.FileStream exposes a Stream around a file, supporting both synchronous and asynchronous read and write operations.
QUESTION 34
You want to substitute values in a string that is displayed on the console.
Which code fragment will display "Hello, World"?
A.
B.
C.
D.

Console.WriteLine("Hello, {0}", "World");


Console.WriteLine("Hello, (0)", "World");
Console.WriteLine("Hello, <0>", "World");
Console.WriteLine("Hello, [0]", "World");

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 35
Where are the command line arguments stored for a console application?
A.
B.
C.
D.

In a value-type parameter that is passed to the Main method.


In the Console.In property.
In a string array parameter that is passed to the Main method.
In the Console.Read() method.

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 36
You create a class that uses unmanaged resources.
You need to ensure that users of the class can explicitly release resources when the instance of the class is no longer required.
Which two actions should you perform? (Each correct answer presents part of the solution.
Choose two.)
A.
B.
C.
D.

Use a class destructor that is called from within the Dispose method.
Implement the IDisposable interface.
Inherit from the WeakReference class.
Use a class destructor that calls the Kill method.

Correct Answer: AB
Section: (none)
Explanation
Explanation/Reference:
To properly dispose of unmanaged resources, it is recommended that you implement a public Dispose or Close method that executes the necessary cleanup code
for the object. The IDisposable interface provides the Dispose method for resource classes that implement the interface. Because it is public, users of your
application can call the Dispose method directly to free memory used by unmanaged resources. When you properly implement a Dispose method, the Finalize
method becomes a safeguard to clean up resources in the event that the Dispose method is not called.
Reference: Cleaning Up Unmanaged Resources
QUESTION 37
Value type variables are stored in the:
A. Code segment
B. Heap
C. Stack

D. Text segment
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 38
Managed code manages:
A.
B.
C.
D.

Database connections.
Memory.
Processor optimization.
Source code

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
Managed code is a term coined by Microsoft to identify computer program source code that requires and will execute only under the management of a Common
Language Runtime virtual machine (resulting in bytecode).
QUESTION 39
What does the .NET Framework use to pass data between managed and unmanaged code?
A.
B.
C.
D.

Marshaling
Simple Object Access Protocol (SOAP)
Deserialization
File Transfer Protocol (FTP)

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 40
Which should you use to call a class written in C# from a program written in Microsoft Visual Basic .NET?
A.
B.
C.
D.

The Visual Basic .NET syntax


The Windows Communication Foundation (WCF) API
A Component Object Model (COM) interface
The C# syntax

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 41
Type-safe code accesses only the memory locations:
A.
B.
C.
D.

It is authorized to access.
Of objects on the heap.
Of objects that are static or shared.
Of objects on the stack.

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 42
A type-safe language prevents:
A.
B.
C.
D.

Access to arbitrary memory locations.


Memory leaks.
Null reference exceptions.
Division by zero exceptions.

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
Type-safe code accesses only the memory locations it is authorized to access.
QUESTION 43
How does managed .NET code use an unmanaged COM object?
A. The CLR creates a runtime callable wrapper (RCW) that acts as a proxy for the unmanaged object.

B. The CLR uses events to create asynchronous calls to unmanaged code.


C. The CLR runs managed code and unmanaged code in separate threads.
D. The CLR uses shared assemblies to communicate between managed code and unmanaged code.
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 44
Type-safe code prevents:
A.
B.
C.
D.

Unauthorized memory access.


Slow performance.
Namespace conflicts.
Format exceptions.

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
Type-safe code accesses only the memory locations it is authorized to access.
QUESTION 45
You need to encrypt data by using a public key and a private key.
Which .NET class should you use?
A.
B.
C.
D.

DESCryptoServiceProvider
RijndaelManaged
DSACryptoServiceProvider
TripleDESCryptoServiceProvider

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
You can use the DSACryptoServiceProvider class to create digital signatures and protect the integrity of your data.
To use a public-key system to digitally sign a message, the sender first applies a hash function to the mes- sage to create a message digest. The sender then
encrypts the message digest with the sender's private key to create the sender's personal signature.
QUESTION 46
You want to enable access to files and folders by using the .NET Framework.
Which security class should you use?
A.
B.
C.
D.

UPermission
FileIOPermission
PrincipaIPermission
SecurityPermission

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 47
Which security policy level applies to all managed code on the computer?
A.
B.
C.
D.

Machine
User
Enterprise
Application domain

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 48
You need to create an access rule that allows a user named UserA in MyDomain to read the contents of the Log.txt file.
Which code segment should you use?

A.
B.
C.
D.

Option A
Option B
Option C
Option D

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 49
Your application requests FileIOPermission to open a file.
The permission is denied. Which type of exception will be thrown?
A.
B.
C.
D.

IOException
SecurityException
ArgumentException
VerificationException

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
Example:
FileIOPermission f = new FileIOPermission(PermissionState.None); f.AllLocalFiles = FileIOPermissionAccess.Read;
try
{
f.Demand();
}
catch (SecurityException s)
{
Console.WriteLine(s.Message);
}
QUESTION 50
An event declaration is shown in the following code segment.
Public event NewProduccEventHandlerNewProduct;
What is NewProductEventHandler in the event declaration?
A.
B.
C.
D.

A built-in data type for handling events.


An enumeration that defines the type of the NewProduct variable.
The name of the delegate that will dispatch the event.
The name of the class method that will catch the event.

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 51
Which two types of actions can trigger an event? (Each correct answer presents a complete solution. Choose two.)
A.
B.
C.
D.

User intervention, such as a mouse click.


Some other program logic, such as a call to the program module.
Declaring the signature of the delegate.
Adding a delegate keyword.

Correct Answer: AC

Section: (none)
Explanation
Explanation/Reference:
* A delegate is a type that holds a reference to a method. A delegate is declared with a signature that shows the return type and parameters for the methods it
references, and can hold references only to methods that match its signature.
* Events in the .NET Framework are based on the delegate model. The delegate model follows the observer design pattern, which enables a subscriber to register
with, and receive notifications from, a provider. An event sender pushes a notification that an event has happened, and an event receiver receives that notification
and defines a response to it.
QUESTION 52
You need to handle only SqlException exceptions. You also need to ensure that any other exception flows back to the calling code.
Which code segment should you use?

A.
B.
C.
D.

Option A
Option B
Option C
Option D

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 53
You write a method named DoWork.
You need to log all exceptions that occur inside DoWork. You also need to ensure that all exceptions are raised to the calling code.
Which code segment should you use?

A.
B.
C.
D.

Option A
Option B
Option C
Option D

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 54
Connection strings in the web.config file are:
A.
B.
C.
D.

Automatically encrypted when the project is published.


Automatically encrypted by the web server.
Stored in binary format.
Stored in clear text unless they are encrypted.

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
When working with data source controls it is recommended that you centralize the location of your connection strings by storing them in the application's Web.config
file. This simplifies the management of connection strings by making them available to all of the ASP.NET pages in a Web application. In addition, you do not need
to modify numerous individual pages if your connection string information changes. Finally, you can improve the security of sensitive information stored in a
connection string, such as the database name, user name, password, and so on, by encrypting the connection string section of the Web.config file using protected
configuration.

QUESTION 55
In which file does a .NET Windows application store information that has been customized for a particular instance of the application?
A.
B.
C.
D.

App.config
User.config
Machine.config
Web.config

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 56
You need to force the position of the cursor on the screen at (15, 10).
Which code segment should you use?

A.
B.
C.
D.

Option A
Option B
Option C
Option D

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 57
You create a program that writes a status message to a file every 10 seconds.
You need to ensure that all data is written to the file before the file is closed.
When should you call the Flush() method?
A.
B.
C.
D.

Before writing the entry


When opening the file
Before opening the file
After writing the entry

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
The Stream.Flush method clears all buffers for this stream and causes any buffered data to be written to the underlying device.
QUESTION 58
You want to insert a new line on the console.
Which three code fragments will display "Hello" followed by a new line? (Each correct answer presents a complete solution. Choose three.)
A.
B.
C.
D.
E.

Console.Write("Hello\t") ;
Console.Write("Hello\n");
Console.Error.Write("Hello\t");
Console.Error.WriteLine ("Hello") ;
Console.WriteLine("Hello");

Correct Answer: BDE


Section: (none)

Explanation
Explanation/Reference:
B: \n adds a newline.
D: Console.Error.WriteLine writes a newline.
E: Console.WriteLine writes a newline.
Incorrect:
A, C: \t is just a space
QUESTION 59
Which method will be called when a FileStream is collected by the garbage collector?
A.
B.
C.
D.

Unlock
Flush
Finalize
EndWrite

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 60
You create a class that does not explicitly inherit from any base class.
Which is the implied base type of the class?
A.
B.
C.
D.

Type
Void
Object
TypedReference

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 61
You create an ArrayList object.
You need to ensure that only objects of the System.DateTime type can be added to the collection.
What should you do?
A.
B.
C.
D.

Use a Hashtable collection.


Use the ToString() method on objects that you add to the ArrayList.
Use a List<T> collection.
Restrict the ArrayList variable to a capacity of 16 items.

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 62
Which code segment prevents the class named Final from being inherited?

A.
B.
C.
D.

Option A
Option B
Option C
Option D

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 63
You use code from different companies.
You need to avoid naming conflicts within your code.
What should you do?
A.
B.
C.
D.

Use global variables to reference each of the classes.


Define each class as private.
Deploy the classes as two separate files.
Define the classes inside unique namespaces.

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
.NET development encourages unique namespaces.
QUESTION 64
You need to create a DLL that contains classes that can be reused in other projects.
Which type of Microsoft Visual Studio project should you use?
A.
B.
C.
D.

Class Library
Web Application
Console Application
Windows Service

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 65
You need to be able to install and uninstall an assembly from the Global Assembly Cache (GAC).
Which tool should you use?
A.
B.
C.
D.

Ngen.exe
Resgen.exe
GacUtil.exe
Sn.exe

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
Gacutil.exe (Global Assembly Cache Tool)
The Global Assembly Cache tool allows you to view and manipulate the contents of the global assembly cache and download cache.
Options include:
* /i assemblyPath
Installs an assembly into the global assembly cache.
* /u assemblyName
Uninstalls an assembly from the global assembly cache.
QUESTION 66
Common Intermediate Language (CIL) is converted into executable code by using:
A.
B.
C.
D.

Microsoft Visual Studio.


Interactive debugger.
Just-in-Time (JIT) compiler.
Intermediate Language Disassembler (ILDASM.exe).

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 67
When you delay sign a .NET assembly, the assembly will include:

A.
B.
C.
D.

Both public key and private key.


Only the public key.
Only the private key
Neither the public key nor the private key.

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 68
Which two actions are performed by the .NET Version class? (Choose two.)
A.
B.
C.
D.

Returns the version number of the web browser


Provides the base class for value types.
Returns the version number of an assembly.
Returns the version number of the Common Language Runtime.

Correct Answer: CD
Section: (none)
Explanation
Explanation/Reference:
The .NET Version class represents the version number of an assembly, operating system, or the common language runtime.
QUESTION 69
Which class should you use to perform a search of an XML document?
A.
B.
C.
D.

XmlElement
XPathDocument
XmlNode
XmlReader

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 70
You load an XML document named doc1 that has an attribute named EmployeeId.
Which code fragment will set the value of EmployeeId to A23?
A.
B.
C.
D.

Doc1.CreateAttribute("EmployeeId", "A23");
Doc1.DocumentElement.SetAttribute("Employeeld","A23");
Doc1.CreateNode("EmployeeId", "A23", "");
Doc1.CreateElement("Employeeld","A23");

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
The XmlElement.SetAttribute method sets the value of the specified attribute.
QUESTION 71
You create a custom exception class named MyCustomException that is derived from ApplicationException.
Which code segment should you use to raise MyCustomException?

A.
B.
C.
D.

Option A
Option B
Option C
Option D

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 72
Custom event delegates are used to:
A.
B.
C.
D.

Raise one or more custom events


Handle errors generated in a try block.
Route events to one or more event handlers.
Process mouse clicks or keyboard input.

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 73
An event is a/an:
A.
B.
C.
D.

Structure used to store output data.


Message sent by an object to signal the occurrence of an action.
Occurrence of a program at a specific time.
Object that responds to a message.

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 74
You want to encrypt the connection string stored in the web.config file.
Which tool should you use?
A.
B.
C.
D.

ASP.NET IIS Registration Tool (RegIIS.exe)


Intermediate Language Disassembler (ILDASM.exe)
Web Site Administration Tool
Dotfuscator Software Services

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
You can use the ASP.NET IIS Registration Tool (Aspnet_regiis.exe) to encrypt or decrypt sections of a Web configuration file.

Example:
The following command encrypts the connectionStrings element in the Web.config file for the application SampleApplication.
aspnet_regiis -pe "connectionStrings" -app "/SampleApplication" -prov "RsaProtectedConfigurationProvider"
QUESTION 75
Which namespace should you reference while using the StreamWriter class?
A.
B.
C.
D.

System.Text
System.Drawing
System.IO
System.Printing

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
The StreamWriter class belongs to the System.IO namespace.
QUESTION 76
You want to use a collection to store Order items. The collection must be thread-safe and must provide access to the items in a last-in-first-out sequence.
Which type of collection should you use?
A.
B.
C.
D.

LinkedList
ConcurrentQueue
ConcurrentStack
NameValueCollection

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 77
You want to create a method that can accept any data type as arguments.
Which feature of .NET languages allows you to create one method that will accept different data types on each call to the method?
A.
B.
C.
D.

Delegates
Named Parameters
Overriding
Generics

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 78
A base class named MasterData is defined according to the following code segment.

Which code segment should you use to define a method named LoadData that overrides the method in the MasterData class?

A.
B.
C.
D.

Option A
Option B
Option C
Option D

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 79
A .NET application requires:
A.
B.
C.
D.

Windows System Registry.


Common Language Runtime.
COM libraries.
Web services.

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 80
You create an unmanaged object and use the object. You no longer need the object.
What should you do?
A.
B.
C.
D.

Set the value of the variable to null.


Cache the variable's value in a static variable.
Dispose the object to release memory.
Cast the object to its base type.

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
The term "unmanaged resource" is usually used to describe something not directly under the control of the garbage collector. For example, if you open a connection
to a database server this will use resources on the server (for maintaining the connection) and possibly other non-.net resources on the client machine, if the
provider isn't written entirely in managed code.
This is why, for something like a database connection, it's recommended you write your code thusly:
using (var connection = new SqlConnection("connection_string_here")) {
// Code to use connection here
}

As this ensures that .Dispose() is called on the connection object, ensuring that any unmanaged resources are cleaned up.
QUESTION 81
You need to force an immediate garbage collection of all unused memory.
Which method should you use?
A.
B.
C.
D.

WaitForFullGCComplete
SuppressFinalize
CollectionCount
Collect

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 82
Where is dynamic memory allocated?
A.
B.
C.
D.

Text segment
Code segment
Stack
Heap

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 83
You need to configure security policy for the following policy levels:
Machine
User
Enterprise
Which .NET tool should you use?
A.
B.
C.
D.

Policy Migration
Code Access Security Policy
Microsoft Intermediate Language Assembler
Permissions View

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 84
In the Common Language Runtime (CLR), what information is used to make decisions on security policy?
A.
B.
C.
D.

Code group
Evidence
Cryptography
Permissions

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
The Evidence class defines the set of information that constitutes input to security policy decisions.
Note: Common forms of evidence include signatures and location of origin of code, but can potentially be anything. Objects of any type that are recognized by
security policy represent evidence.
QUESTION 85
Which named permission set allows common Language Runtime (CLR) to run code but disallows the use of protected resources from the computer?
A.
B.
C.
D.

FullTrust
Execution
Everything
Nothing

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 86
Which two goals can you achieve by using cryptography? (Choose two.)

A.
B.
C.
D.

Prevent data from being modified.


Find out which users can access data.
Ensure that data originates from a particular party.
Ensure that data arrives at its destination.

Correct Answer: AD
Section: (none)
Explanation
Explanation/Reference:
QUESTION 87
Which part of the .NET Framework verifies that code is type-safe?
A.
B.
C.
D.

Microsoft Intermediate Language (MSIL) compiler


Common Type System (CTS)
Just-in-Time (JIT) compiler
Base Class Library (BCL)

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 88
Which two tasks does the interoperability of the .NET language allow you to perform? (Choose two.)
A.
B.
C.
D.
E.

Use classes written in C# from Microsoft Visual Basic .NET code.


Write a method by using identical syntax of both C# and Microsoft Visual Basic .NET.
Create methods written in both C# and Microsoft Visual Basic .NET in the same class.
Use classes written in Microsoft Visual Basic .NET from C# code.
Convert C# code to Microsoft Visual Basic .NET or convert Visual Basic .NET code to C#.

Correct Answer: AD
Section: (none)
Explanation
Explanation/Reference:
QUESTION 89
Type-safe programming languages require that:
A.
B.
C.
D.

Data conversions that might be unsafe are done explicitly.


All data conversions are done implicitly.
Data conversions that might be unsafe are done implicitly.
All data conversions are done explicitly.

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
* A language is type-safe if the only operations that can be performed on data in the language are those sanctioned by the type of the data.
* Explicit conversions (casts): Explicit conversions require a cast operator. Casting is required when information might be lost in the conversion, or when the
conversion might not succeed for other reasons. Typical examples include numeric conversion to a type that has less precision or a smaller range, and conversion
of a base-class instance to a derived class.
Incorrect:
Not (All data conversions are done implicitly/explicitly):
In C#, you can perform the following kinds of conversions:
/ Implicit conversions: No special syntax is required because the conversion is type safe and no data will be lost. Examples include conversions from smaller to
larger integral types, and conversions from derived classes to base classes.
/ Explicit conversions (casts): Explicit conversions require a cast operator.
/ User-defined conversions.
/ Conversions with helper classes
QUESTION 90
Which feature is available in both Microsoft Visual Basic .NET and C#f?
A.
B.
C.
D.

Static classes
Use of code that is not case-sensitive
Use of code that is not type-safe
Named and optional arguments in methods

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 91
Which three characteristics define the identity of an assembly? (Each correct answer presents part of the solution. Choose three.)

A.
B.
C.
D.
E.

Simple text name


File size
File creation date
Culture information
Version number

Correct Answer: ADE


Section: (none)
Explanation
Explanation/Reference:
* The Assembly Class represents an assembly, which is a reusable, versionable (D), and self- describing building block of a common language runtime application.
* Assembly Properties include_
/ FullName (A)
Gets the display name of the assembly.
* (D) The AssemblyName.CultureInfo property gets or sets the culture supported by the assembly.
QUESTION 92
.NET managed code compiles into:
A.
B.
C.
D.

Assembly language.
Common Intermediate Language (CIL).
Extensible Application Markup Language (XAML).
Machine code.

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 93
Which format is the correct version for a .NET application?
A.
B.
C.
D.

minor.major.revision.build
build.revision.minor.major
major.minor.build.revision
revision.build.major.minor

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 94
Which two elements are included in a .NET assembly? (Choose two.)
A.
B.
C.
D.
E.

Microsoft Intermediate Language (MSIL) code


Extensible Markup Language (XML) code
Extensible Application Markup Language (XAML) code
Type metadata
Declared variable types

Correct Answer: AD
Section: (none)
Explanation
Explanation/Reference:
In general, a static assembly can consist of four elements:
/ The assembly manifest, which contains assembly metadata.
/ (D) Type metadata.
/ (A) Microsoft intermediate language (MSIL) code that implements the types.
/ A set of resources.
Single-file assembly

QUESTION 95
Which configuration file is automatically created by .NET when the file is needed by the application for the first time?
A.
B.
C.
D.

Web.config
App.config
Machine.config
User.config

Correct Answer: D
Section: (none)
Explanation

Explanation/Reference:
QUESTION 96
What data is stored on the heap?
A.
B.
C.
D.

Objects that contain non-value data types


Built-in, intrinsic value types
Values of parameters in methods
References to objects

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 97
In .NET, the automatic memory management system enables:
A.
B.
C.
D.

Garbage collection.
Synchronization.
Smart caching.
Managed code.

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 98
You need to ensure that your console application can process each key as it is pressed.
Which method should you use?
A.
B.
C.
D.

Console.OpenStandardlnput
Console.ReadKey
Console.Read
Console.ReadLine

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
The Console.ReadKey method obtains the next character or function key pressed by the user.
QUESTION 99
You want to write log files to a user's My Documents folder.
Which class should you use to locate the My Documents folder?
A.
B.
C.
D.

Directory
Path
Environment
File

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 100
You create an XML document that has an XmlNode named node1.
Which code fragment will read the XML contained in node1 and its subnodes?
A.
B.
C.
D.
E.

Node1.ToString ();
Node1.OuterXml;
Node1.InnerXml;
Node1.InnerXext;
Node1.Value;

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 101
You need to find out whether the active Windows user of an application is a member of the Administrators group.
Which permission class should you use?

A.
B.
C.
D.

SecurityPermission
PrincipalPermission
PublisherIdentityPermission
EnvironmentPermission

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 102
Which application domain host manages security for web applications?
A.
B.
C.
D.

Browser
Custom-designed
Server
Shell

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 103
Which tool should you use to view the minimal, optional, and refused permission sets requested by an assembly?
A.
B.
C.
D.

Assembly Registration
Permission Verify
Migration Policy
Permissions View

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 104
The Common Language Specification (CLS) standard:
A.
B.
C.
D.

Defines a common development environment for writing applications.


Allows code written for a desktop application to run as a web application.
Allows code written in different languages to interact.
Defines a common syntax for all programming languages.

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 105
Which three actions can you perform by using the Strong Name tool? (Choose three.)
A.
B.
C.
D.
E.

Create a key pair for an assembly.


Compile the assembly for the first time.
Encrypt an assembly.
Re-sign a previously signed assembly.
Extract the public key from an assembly.

Correct Answer: ADE


Section: (none)
Explanation
Explanation/Reference:
A: sn -a identityKeyPairFile signaturePublicKeyFile
Generates AssemblySignatureKeyAttribute data to migrate the identity key to the signature key from a file.
D: sn - R[a] assembly infile
Re-signs a previously signed or delay-signed assembly with the key pair in infile. If -Ra is used, hashes are recomputed for all files in the assembly.
E: Sn -e assembly outfile
Extracts the public key from assembly and stores it in outfile.
* The Strong Name tool (Sn.exe) helps sign assemblies with strong names. Sn.exe provides options for key management, signature generation, and signature
verification.
QUESTION 106
Which should you use to ensure that code can be used by several applications?
A. Private Assembly
B. Group Policy

C. Shared Assembly
D. Public Policy
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
An assembly which in the GAC and has a strong name is called shared assembly
Multiple applications can use the same shared assembly without having a own copy of that assembly.
QUESTION 107
Which is the build number of a Version object instantiated by using the following code fragment?
Version v = new Version (2, 4, 6, 8);
A.
B.
C.
D.

2
4
6
8

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 108
You want to debug a class library project that will be used by an application named MyApplication.exe.
MyApplication.exe is not part of your Microsoft Visual Studio project and is not running currently. You want MyApplication.exe to start automatically.
What should you do?
A.
B.
C.
D.

Set the project's Start Action setting to Start external program and select MyApplication.exe.
Set the command line arguments to debug:MyApplication.exe.
Set the command line arguments to start:MyApplication.exe.
Set the project's Start Action setting to Start project.

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
The StartAction property for a project indicates the item to start when the application is debugged: the project, a custom program, a URL, or nothing. When set to
Start external program, the property indicates that a specific program should be started when the application is debugged.
QUESTION 109
Which code segment is an example of implicit boxing?

A.
B.
C.
D.

Option A
Option B
Option C
Option D

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 110
Which describes an interface?
A. Allows managed code to access unmanaged code.

B. Contains code that implements properties, methods, and events.


C. A template that defines a set of properties, methods, and events.
D. Can be changed after it has been published.
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 111
Which type of casting enforces type safety?
A.
B.
C.
D.

Reinterpret
Implicit static
Explicit static
Explicit dynamic

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 112
A type-safe language prevents:
A.
B.
C.
D.

Memory leaks.
Access to arbitrary memory locations.
Division by zero exceptions.
Null reference exceptions.

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
Type-safe code accesses only the memory locations it is authorized to access.
QUESTION 113
Regarding C# code and Microsoft Visual Basic .NET code, language parity refers to the:
A.
B.
C.
D.

Parts of the language where the syntax is identical.


Functionality that is common in both languages even if the syntax is different.
Fact that both languages are compiled as Microsoft Intermediate Language (MSIL).
Ability of the two languages to interoperate.

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 114
Which describes the characteristic of the interoperability of the .NET Framework?
A.
B.
C.
D.

Allows consistent communication between a desktop application and a mobile application.


Allows consistent communication between a desktop application and a web application.
Handles exceptions consistently across languages.
Uses the same code syntax.

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 115
Which programming languages can be managed, unmanaged, or both? (To answer, drag the appropriate option or options to the correct location or locations in the
answer area. An option may be moved to more than one location, and some options may not be moved at all.)
Select and Place:

Correct Answer:

Section: (none)
Explanation
Explanation/Reference:
Explanation:
Note:
* Managed code is a term coined by Microsoft to identify computer program source code that requires and will only execute under the management of a Common
Language Runtime virtual machine (resulting in bytecode). This applies to both C# and VB .Net. Managed code needs a runtime (like the .NET CLT) to execute
* Microsoft's Visual C++ development environment can produce both managed code, running under the .NET CLR, or compiled binaries, running directly on the
Windows platform with the help of its C++ Runtime Library.

Topic 2, VB
QUESTION 1
You need to find out whether an application has access to delete files from the C:\Logs directory.
Which code segment should you use?
A. Dim permission As New FileIOPermission(FileIOPermissionAccess.Write, "C:\\Logs")
B. Dim permission A3 New FileIOPermission(FileIOPermissionAccess.PathDiscovery,
"C:\\Logs")
C. Dim permission As New FileIOPermission(FiieIOPermissionAccess.Read, "C:\\Logs")
D. Dim permission As New FileIOPermission(FileIOPermissionAccess.Append, "C:\\Logs")
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 2
Which three policy types are .NET security policy levels? (Choose three.)
A.
B.
C.
D.
E.

Enterprise policy
Data policy
Network policy
Machine policy
Application domain policy

Correct Answer: ADE


Section: (none)
Explanation
Explanation/Reference:
The following table describes the four security policy levels provided by .NET Framework security.
* Enterprise policy
All managed code in an enterprise setting where an enterprise configuration file is distributed.
* Machine policy
All managed code on the computer.
* User policy
Code in all the processes associated with the current operating system user when the common language runtime starts.
* Application domain policy
Managed code in the host's application domain
QUESTION 3
Which .NET object combines the identity and role of a user?
A.
B.
C.
D.

WindowsPrincipal
FormsIdentity
WindowsIdentity
GenericIdentity

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
The WindowsPrincipal Class enables code to check the Windows group membership of a Windows user.
The WindowsPrincipal class is primarily used to check the role of a Windows user.
Incorrect:
Not GenericIdentity: Represents a generic user. An identity object represents the user on whose behalf the code is running.
QUESTION 4
The SecureString class:
A.
B.
C.
D.

Ensures that a password is strong enough.


Remains in memory always.
Ensures that memory will always be available for a string.
Protects data from being revealed during garbage collection.

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 5
Which feature protects computers from running untrusted applications?
A.
B.
C.
D.

Evidence-based security
Role-based security
Cryptography
Code Access security

Correct Answer: B
Section: (none)
Explanation

Explanation/Reference:
Role-Based Security
Business applications often provide access to data or resources based on credentials supplied by the user. Typically, such applications check the role of a user and
provide access to resources based on that role. The common language runtime provides support for role-based authorization based on a Windows account or a
custom identity.
QUESTION 6
Which feature is automatically handled in managed code but must be explicitly handled in unmanaged code?
A.
B.
C.
D.

Memory disposal
Code signing
Namespaces
Exception handling

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
Unmanaged code does not have a garbage collector and you will have to keep track of all your memory allocations to avoid memory leaks.
QUESTION 7
You need to suspend the current thread until all Finalize() methods have been processed.
Which garbage collection method should you use?
A.
B.
C.
D.

Dispose
WaitforPendingFinalizers
SuppressFinalize
Collect

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 8
What is the name of the environment that runs .NET managed code?
A.
B.
C.
D.

Common Language Runtime (CLR)


Component Object Model (COM)
Virtual Private Network (VPN)
Microsoft Intermediate Language (MSIL)

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 9
You want to access a native Win32 function from a .NET application.
You import the function.
Which two keywords should you use to define the function? (Each correct answer presents part of the solution. Choose two.)
A.
B.
C.
D.

Declare
Private
Public
Lib

Correct Answer: CD
Section: (none)
Explanation
Explanation/Reference:
Example:
look at the ability to place a computer into hibernation through the Win32 API. The IsPwrHibernateAllowed function of Powrprof.dll returns a true (non-zero) value if
hibernation is permitted, false (zero) if not.
Public Declare Function IsPwrHibernateAllowed Lib "Powrprof.dll" _ Alias "IsPwrHibernateAllowed" () As Integer
Public Declare Function SetSuspendState Lib "Powrprof.dll" _ Alias "SetSuspendState" (ByVal Hibernate As Integer,
ByVal ForceCritical As Integer,
ByVal DisableWakeEvent As Integer) As Integer
If (Win32API.IsPwrHibernateAllowed() <> 0) Then
Win32API.SetSuspendState(1, 0, 0)
End If
QUESTION 10
What is the purpose of the app.config file?
A. To configure the version of .NET targeted by the application.
B. To load references to third-party libraries used by the application.
C. To configure the target operating system of the application.

D. To find out the programming language of the application.


Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 11
What is the characteristic of a delegate?
A.
B.
C.
D.

A tightly coupled event


An object that raises an event
A type-safe function pointer
A property function that includes optional parameters

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
The .NET Framework defines a special type (Delegate) that provides the functionality of a function pointer.
A delegate is a class that can hold a reference to a method. Unlike other classes, a delegate class has a signature, and it can hold references only to methods that
match its signature. A delegate is thus equivalent to a type-safe function pointer or a callback.
QUESTION 12
Which two actions should you perform to consume events defined in another class? (Each correct answer presents part of the solution. Choose two.)
A.
B.
C.
D.
E.

Define a method that raises the event.


Place a reference to the consuming class in the class that raises the event.
Define an event handler method
Match the signature of the delegate declared for the event.
Set the current class as a sealed class.

Correct Answer: CD
Section: (none)
Explanation
Explanation/Reference:
QUESTION 13
You write code that reads a file from the disk.
Which exception will catch an error if the file is missing?
A.
B.
C.
D.

IOException
FaultException
ApplicationException
InvalidOperationException

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 14
In which folder should you store the web.config file in a .NET web application?
A.
B.
C.
D.

App_Data
Bin
App_Code
Root

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 15
Which file contains the required .NET settings for an ASP.NET web application?
A.
B.
C.
D.

Global.asax
Default.aspx
Site.master
Web.config

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:

QUESTION 16
You want to raise a custom exception.
Which keyword should you use?
A.
B.
C.
D.

Throw
Catch
Finally
Try

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 17
You define a method according to the following code segment. (Line numbers are included for reference only.)

Where should you insert code that must be executed, regardless of whether or not an error is thrown?
A.
B.
C.
D.

Between lines 03 and 04


Between lines 04 and 05
Between lines 05 and 06
Between lines 06 and 07

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 18
You have created a program that writes status updates into a file.
You want to modify the file.
You need to ensure that other users can view the file while it is being modified.
Which permission should you use to open the file?
A.
B.
C.
D.
E.

FileShare.None
FileAccess.Read
FileAccess.Write
FileShare.Read
FileShare.Inheritable

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 19
Where are the command line arguments stored for a console application?
A.
B.
C.
D.

In a value-type parameter that is passed to the Main method.


In the Console.In property.
In a string array parameter that is passed to the Main method.
In the Console.Read() method.

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 20
Which two classes in the .NET Framework allow you to delete a file? (Each correct answer presents a complete solution. Choose two.)
A.
B.
C.
D.
E.

System.IO.FileStream
System.IO.File
System.IO.Stream
System.IO.FileInfo
System.IO.Path

Correct Answer: BD
Section: (none)
Explanation
Explanation/Reference:
D: System.IO.FileInfo provides properties and instance methods for the creation, copying, deletion, moving, and opening of files, and aids in the creation of
FileStream objects.
B: System.IO.File provides static methods for the creation, copying, deletion, moving, and opening of files, and aids in the creation of FileStream objects.
Incorrect:
Not A: System.IO.FileStream exposes a Stream around a file, supporting both synchronous and asynchronous read and write operations.
QUESTION 21
You want to substitute values in a string that is displayed on the console.
Which code fragment will display "Hello, World"?
A.
B.
C.
D.

Console.WriteLine("Hello, [0]", "World")


Console.WriteLir.e ("Hello, {0}", "World")
Console.WriteLine("Hello, (0)", "World")
Console.WriteLine("Hello, <0>", "World")

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 22
A class named Student is contained inside a namespace named Contoso.Registration. Another class named Student is contained inside a namespace named
Contoso.Contacts.
You need to use both classes within the same code file.
What are two possible ways to achieve this goal? (Each correct answer presents a complete solution. Choose two.)
A. Add the following lines of code on the top of the code file.
Imports RStudent = Contoso.Registration.Student
Imports CStudent = Contoso.Contacts.Student
Refer to the classes as RStudent and CStudent.
B. Refer to the classes by using their fully qualified class names, Contoso.Registration.Student and Contoso.Contacts.Student.
C. Add the following lines of code on the top of the code file.
Imports Contoso.Contacts Imports Contoso.Registration
Refer to the classes by using the Student class.
D. Add the following line of code on the top of the code file. Imports Contoso Refer to the classes by using the Student class wrapped within the regions named
Registration and Contacts.
Correct Answer: AC
Section: (none)
Explanation
Explanation/Reference:
QUESTION 23
You want to create a class named ShoppingCart that has a type argument named TItem. The TItem type argument must be a value type.
Which code segment should you use to define the ShoppingCart class?

A.
B.
C.
D.

Option A
Option B
Option C
Option D

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 24
Which is the base class of all classes in the .NET Framework?
A.
B.
C.
D.

System.Net
System.Drawing
System
System.Object

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 25
You create a class library named Contoso.Business. The library is used in a Windows application named Contoso.Ui.
In which file should you store application configuration settings during deployment?
A.
B.
C.
D.

Machine.config
Web.config
Contoso.Ui.config
Contoso.Business.config

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
The project system stores application settings in two XML files: an app.config file, which is created at design time when you create the first application setting; and a
user.config file, which is created at run time when the user who runs the application changes the value of any user setting.
QUESTION 26
Which describes the effect of applying the protected accessibility modifier to a method?
A.
B.
C.
D.

The method is available only to other methods in the same class.


The method is available only to classes in the same assembly.
The method cannot be overridden in child classes.
The method is available to all classes derived from the declaring class.

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 27
What is the purpose of strong naming?
A.
B.
C.
D.

To ensure that only one version of an assembly is stored in a directory at any point in time.
To manage the references of the file list in an assembly's manifest.
To assign a globally unique key to the assembly.
To impose restrictions on how different data types are defined within an assembly.

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 28
Which standard allows data types to be interchanged among all Common Language Infrastructure (CLI) programming languages?
A.
B.
C.
D.

Virtual Execution System (VES)


Common Type System (CTS)
Microsoft Intermediate Language (MSIL)
Common Intermediate Language System (CILS)

Correct Answer: B
Section: (none)
Explanation

Explanation/Reference:
QUESTION 29
Which two methods can you use to load an assembly? (Each correct answer presents a complete solution. Choose two.)
A.
B.
C.
D.

Load(String)
LoadModule(String, Byte())
GetLoadedModules()
LoadFrom(String)

Correct Answer: AB
Section: (none)
Explanation
Explanation/Reference:
A: Assembly.Load Method (String)
Loads an assembly given the long form of its name.
B: LoadModule(String, Byte[])
Loads the module, internal to this assembly, with a common object file format (COFF)-based image containing an emitted module, or a resource file.
QUESTION 30
You need to retrieve an assembly's Version property.
Which class should you use?
A.
B.
C.
D.

Assembly
AssemblyName
OperatingSystem
MemberInfo

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 31
Why do managed languages use references and not pointers?
A.
B.
C.
D.

Pointer notation requires more characters than reference notation.


Null pointers can lead to run-time errors.
Pointers are not type-safe.
Pointers are stored by using a fixed amount of memory.

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
Type-safe accesses only the memory locations it is authorized to access, and only in well- defined, allowable ways. Type-safe code cannot perform an operation on
an object that is invalid for that object.
QUESTION 32
You need to trace the execution of an application that contains C# code and Microsoft Visual Basic .NET code.
Which tool should you use?
A.
B.
C.
D.

CLR Profiler
Remote Debug Monitor
Machine Debug Manager
Microsoft Visual Studio

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 33
What is an advantage of strongly typed code languages like .NET?
A.
B.
C.
D.

Use of less memory.


Improved readability.
Use of efficient type casting.
Capturing of errors during compilation.

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 34
Which core technology allows interoperability between Microsoft Visual Basic .NET code and C# code?

A.
B.
C.
D.

Windows Azure
Microsoft Visual Studio
Windows 7
Microsoft Intermediate Language (MSIL)

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 35
Which collection enforces type safety?
A.
B.
C.
D.

List<T>
ArrayList
Queue
Hashtable

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 36
You create a class that uses unmanaged resources.
You need to ensure that users of the class can explicitly release resources when the instance of the class is no longer required.
Which two actions should you perform? (Each correct answer presents part of the solution.
Choose two.)
A.
B.
C.
D.

Implement the IDisposable interface.


Use a class destructor that is called from within the Dispose method.
Use a class destructor that calls the Kill method.
Inherit from the WeakReference class.

Correct Answer: AB
Section: (none)
Explanation
Explanation/Reference:
To properly dispose of unmanaged resources, it is recommended that you implement a public Dispose or Close method that executes the necessary cleanup code
for the object. The IDisposable interface provides the Dispose method for resource classes that implement the interface. Because it is public, users of your
application can call the Dispose method directly to free memory used by unmanaged resources. When you properly implement a Dispose method, the Finalize
method becomes a safeguard to clean up resources in the event that the Dispose method is not called.
Reference: Cleaning Up Unmanaged Resources
QUESTION 37
Value type variables are stored in the:
A.
B.
C.
D.

Heap
Text segment
Code segment
Stack

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 38
Managed code manages:
A.
B.
C.
D.

Processor optimization
Database connections
Source code
Memory

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
Managed code is a term coined by Microsoft to identify computer program source code that requires and will execute only under the management of a Common
Language Runtime virtual machine (resulting in bytecode).
QUESTION 39
What does the .NET Framework use to pass data between managed and unmanaged code?
A. Deserialization
B. Marshaling
C. Simple Object Access Protocol (SOAP)

D. File Transfer Protocol (FTP)


Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 40
Common Intermediate Language (CIL) is converted into executable code by using:
A.
B.
C.
D.

Intermediate Language Disassembler (ILDASM.exe).


Interactive debugger.
Microsoft Visual Studio.
Just-in-Time (JIT) compiler.

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 41
When you delay sign a .NET assembly, the assembly will include:
A.
B.
C.
D.

Both public key and private key.


Only the private key
Neither the public key nor the private key.
Only the public key.

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 42
You need to be able to install and uninstall an assembly from the Global Assembly Cache (GAC).
Which tool should you use?
A.
B.
C.
D.

Resgen.exe
Sn.exe
Ngen.exe
GacUtil.exe

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
Gacutil.exe (Global Assembly Cache Tool)
The Global Assembly Cache tool allows you to view and manipulate the contents of the global assembly cache and download cache.
Options include:
* /i assemblyPath
Installs an assembly into the global assembly cache.
* /u assemblyName
Uninstalls an assembly from the global assembly cache.
QUESTION 43
Which two types of actions can trigger an event? (Each correct answer presents a complete solution. Choose two.)
A.
B.
C.
D.

Declaring the signature of the delegate.


Some other program logic, such as a call to the program module,
Adding a delegate keyword.
User intervention, such as a mouse click,

Correct Answer: AD
Section: (none)
Explanation
Explanation/Reference:
* A delegate is a type that holds a reference to a method. A delegate is declared with a signature that shows the return type and parameters for the methods it
references, and can hold references only to methods that match its signature.
* Events in the .NET Framework are based on the delegate model. The delegate model follows the observer design pattern, which enables a subscriber to register
with, and receive notifications from, a provider. An event sender pushes a notification that an event has happened, and an event receiver receives that notification
and defines a response to it.
QUESTION 44
You need to handle only SqlException exceptions.
You also need to ensure that any other exception flows back to the calling code.
Which code segment should you use?

A.
B.
C.
D.

Option A
Option B
Option C
Option D

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 45
You write a method named DoWork.
You need to log all exceptions that occur inside DoWork. You also need to ensure that all exceptions are raised to the calling code.
Which code segment should you use?

A. Option A

B. Option B
C. Option C
D. Option D
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 46
An event declaration is shown in the following code segment.
Public Event NewProduct As NewProductEventHandler
What is NewProductEventHandler in the event declaration?
A.
B.
C.
D.

An enumeration that defines the type of the NewProduct variable.


A built-in data type for handling events.
The name of the delegate that will dispatch the event.
The name of the class method that will catch the event.

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 47
In which file does a .NET Windows application store information that has been customized for a particular instance of the application?
A.
B.
C.
D.

Web.config
User.config
Machine.config
App.config

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 48
Connection strings in the web.config file are:
A.
B.
C.
D.

Stored in binary format.


Automatically encrypted by the web server.
Stored in clear text unless they are encrypted.
Automatically encrypted when the project is published.

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
When working with data source controls it is recommended that you centralize the location of your connection strings by storing them in the application's Web.config
file. This simplifies the management of connection strings by making them available to all of the ASP.NET pages in a Web application. In addition, you do not need
to modify numerous individual pages if your connection string information changes. Finally, you can improve the security of sensitive information stored in a
connection string, such as the database name, user name, password, and so on, by encrypting the connection string section of the Web.config file using protected
configuration.
QUESTION 49
You need to encrypt data by using a public key and a private key.
Which .NET class should you use?
A.
B.
C.
D.

DSACryptoServiceProvider
RijndaelManaged
TripleDESCryptoServiceProvider
DESCryptoServiceProvider

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
You can use the DSACryptoServiceProvider class to create digital signatures and protect the integrity of your data.
To use a public-key system to digitally sign a message, the sender first applies a hash function to the mes- sage to create a message digest. The sender then
encrypts the message digest with the sender's private key to create the sender's personal signature.
QUESTION 50
You need to create an access rule that allows a user named UserA in MyDomain to read the contents of the Log.txt file.
Which code segment should you use?

A.
B.
C.
D.

Option A
Option B
Option C
Option D

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 51
Which security policy level applies to all managed code on the computer?
A.
B.
C.
D.

User
Application domain
Enterprise
Machine

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 52
You want to enable access to files and folders by using the .NET Framework.
Which security class should you use?
A.
B.
C.
D.

SecurityPermission
PrincipaIPermission
FileIOPermission
UIPermission

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 53
Your application requests FileIOPermission to open a file. The permission is denied.
Which type of exception will be thrown?
A.
B.
C.
D.

IOException
VerificationException
ArgumentException
SecurityException

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
Example:
FileIOPermission f = new FileIOPermission(PermissionState.None); f.AllLocalFiles = FileIOPermissionAccess.Read;
try
{
f.Demand();
}
catch (SecurityException s)
{

Console.WriteLine(s.Message);
}
QUESTION 54
You use code from different companies.
You need to avoid naming conflicts within your code.
What should you do?
A.
B.
C.
D.

Use global variables to reference each of the classes.


Define the classes inside unique namespaces.
Define each class as private.
Deploy the classes as two separate files.

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
.NET development encourages unique namespaces.
QUESTION 55
Which code segment prevents the class named Final from being inherited?

A.
B.
C.
D.

Option A
Option B
Option C
Option D

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 56
You create a class that does not explicitly inherit from any base class. Which is the implied base type of the class?
A.
B.
C.
D.

Void
Type
Object
TypedReference

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 57
You create an ArrayList object.
You need to ensure that only objects of the System.DateTime type can be added to the collection.
What should you do?
A.
B.
C.
D.

Restrict the ArrayList variable to a capacity of 16 items.


Use a Hashtable collection.
Use a List(Of T) collection.
Use the ToString() method on objects that you add to the ArrayList.

Correct Answer: C
Section: (none)
Explanation

Explanation/Reference:
QUESTION 58
You need to create a DLL that contains classes that can be reused in other projects.
Which type of Microsoft Visual Studio project should you use?
A.
B.
C.
D.

Class Library
Web Application
Console Application
Windows Service

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 59
Which method will be called when a FileStream is collected by the garbage collector?
A.
B.
C.
D.

EndWrite
Finalize
Unlock
Flush

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 60
You want to insert a new line on the console.
Which three code fragments will display "Hello" followed by a new line? (Each correct answer presents a complete solution. Choose three.)
A.
B.
C.
D.
E.

Console.Write("Hello\n")
Console.Error.Write("Hello\t")
Console.WriteLine("Hello")
Console.Write("Hello\t")
Console.Error.WriteLine("Hello")

Correct Answer: ACE


Section: (none)
Explanation
Explanation/Reference:
* \n adds a newline.
* Console.Error.WriteLine writes a newline.
* Console.WriteLine writes a newline.
Incorrect:
*: \t is just a space
QUESTION 61
You create a program that writes a status message to a file every 10 seconds.
You need to ensure that all data is written to the file before the file is closed.
When should you call the Flush() method?
A.
B.
C.
D.

Before opening the file


Before writing the entry
After writing the entry
When opening the file

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
The Stream.Flush method clears all buffers for this stream and causes any buffered data to be written to the underlying device.
QUESTION 62
You need to force the position of the cursor on the screen at (15, 10).
Which code segment should you use?

A.
B.
C.
D.

Option A
Option B
Option C
Option D

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 63
Which should you use to call a class written in C# from a program written in Microsoft Visual Basic .NET?
A.
B.
C.
D.

The Visual Basic .NET syntax


A Component Object Model (COM) interface
The Windows Communication Foundation (WCF) API
The C# syntax

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 64
Type-safe code prevents:
A.
B.
C.
D.

Slow performance.
Namespace conflicts.
Format exceptions.
Unauthorized memory access.

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
Type-safe code accesses only the memory locations it is authorized to access.
QUESTION 65
How does managed .NET code use an unmanaged COM object?
A.
B.
C.
D.

The CLR creates a runtime callable wrapper (RCW) that acts as a proxy for the unmanaged object.
The CLR uses shared assemblies to communicate between managed code and unmanaged code.
The CLR uses events to create asynchronous calls to unmanaged code.
The CLR runs managed code and unmanaged code in separate threads.

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 66
Type-safe code accesses only the memory locations:
A.
B.
C.
D.

Of objects on the stack.


Of objects that are static or shared.
Of objects on the heap.
It is authorized to access.

Correct Answer: D
Section: (none)
Explanation

Explanation/Reference:
QUESTION 67
In the Common Language Runtime (CLR), what information is used to make decisions on security policy?
A.
B.
C.
D.

Evidence
Cryptography
Code group
Permissions

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
The Evidence class defines the set of information that constitutes input to security policy decisions.
Note: Common forms of evidence include signatures and location of origin of code, but can potentially be anything. Objects of any type that are recognized by
security policy represent evidence.
QUESTION 68
Which named permission set allows Common Language Runtime (CLR) to run code but disallows the use of protected resources from the computer?
A.
B.
C.
D.

Execution
FullTrust
Everything
Nothing

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 69
You need to configure security policy for the following policy levels:
Machine
User
Enterprise
Which .NET tool should you use?
A.
B.
C.
D.

Microsoft Intermediate Language Assembler


Permissions View
Policy Migration
Code Access Security Policy

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 70
Which two goals can you achieve by using cryptography? (Choose two.)
A.
B.
C.
D.

Prevent data from being modified.


Ensure that data originates from a particular party.
Ensure that data arrives at its destination.
Find out which users can access data.

Correct Answer: AC
Section: (none)
Explanation
Explanation/Reference:
QUESTION 71
Which class should you use to perform a search of an XML document?
A.
B.
C.
D.

XmlNode
XPathDocument
XmlElement
XmlReader

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 72
You load an XML document named doc1 that has an attribute named EmployeeId.

Which code fragment will set the value of EmployeeId to A23?


A.
B.
C.
D.

Doc1.DocumentElement.SetAttribute("EmployeeId","A23")
Doc1.CreateElement ("EmployeeId", "A23")
Doc1.CreateNode("EmployeeId", "A23", "")
Doc1.CreateActribute("EmpIoyeeId", "A23")

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
The XmlElement.SetAttribute method sets the value of the specified attribute.
QUESTION 73
Which two elements are included in a .NET assembly? (Choose two.)
A.
B.
C.
D.
E.

Type metadata
Extensible Markup Language (XML) code
Declared variable types
Extensible Application Markup Language (XAML) code
Microsoft Intermediate Language (MSIL) code

Correct Answer: AE
Section: (none)
Explanation
Explanation/Reference:
In general, a static assembly can consist of four elements:
/ The assembly manifest, which contains assembly metadata.
/ (A) Type metadata.
/ (E) Microsoft intermediate language (MSIL) code that implements the types.
/ A set of resources.
Single-file assembly

QUESTION 74
Which format is the correct version for a .NET application?
A.
B.
C.
D.

minor.major.revision.build
major.minor.build.revision
revision.build.major.minor
build.revision.minor.major

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 75
.NET managed code compiles into:
A.
B.
C.
D.

Common Intermediate Language (CIL).


Assembly language.
Machine code.
Extensible Application Markup Language (XAML).

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 76
Which three characteristics define the identity of an assembly? (Each correct answer presents part of the solution. Choose three.)
A.
B.
C.
D.
E.

File size
Simple text name
Version number
File creation date
Culture information

Correct Answer: BCE


Section: (none)
Explanation

Explanation/Reference:
* The Assembly Class represents an assembly, which is a reusable, versionable (C), and self- describing building block of a common language runtime application.
* Assembly Properties include_
/ FullName (B)
Gets the display name of the assembly.
* (E) The AssemblyName.CultureInfo property gets or sets the culture supported by the assembly.
QUESTION 77
You want to encrypt the connection string stored in the web.config file.
Which tool should you use?
A.
B.
C.
D.

Dotfuscator Software Services


Web Site Administration Tool
ASP.NET IIS Registration Tool (RegIIS.exe)
Intermediate Language Disassembler (ILDASM.exe)

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
You can use the ASP.NET IIS Registration Tool (Aspnet_regiis.exe) to encrypt or decrypt sections of a Web configuration file.
Example:
The following command encrypts the connectionStrings element in the Web.config file for the application SampleApplication.
aspnet_regiis -pe "connectionStrings" -app "/SampleApplication" -prov "RsaProtectedConfigurationProvider"
QUESTION 78
An event is a/an:
A.
B.
C.
D.

Message sent by an object to signal the occurrence of an action.


Occurrence of a program at a specific time.
Structure used to store output data.
Object that responds to a message.

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 79
You create a custom exception class named MyCustomException that is derived from ApplicationException.
Which code segment should you use to raise MyCustomException?

A.
B.
C.
D.

Option A
Option B
Option C
Option D

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 80
Custom event delegates are used to:
A. Raise one or more custom events

B. Route events to one or more event handlers.


C. Process mouse clicks or keyboard input.
D. Handle errors generated in a try block.
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 81
Where is dynamic memory allocated?
A.
B.
C.
D.

Code segment
Stack
Heap
Text segment

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 82
A .NET application requires:
A.
B.
C.
D.

Windows System Registry.


Common Language Runtime.
COM libraries.
Web services.

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 83
You create an unmanaged object and use the object. You no longer need the object.
What should you do?
A.
B.
C.
D.

Set the value of the variable to null.


Cache the variable's value in a static variable.
Cast the object to its base type.
Dispose the object to release memory.

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
The term "unmanaged resource" is usually used to describe something not directly under the control of the garbage collector. For example, if you open a connection
to a database server this will use resources on the server (for maintaining the connection) and possibly other non-.net resources on the client machine, if the
provider isn't written entirely in managed code.
This is why, for something like a database connection, it's recommended you write your code thusly:
using (var connection = new SqlConnection("connection_string_here")) {
// Code to use connection here
}
As this ensures that .Dispose() is called on the connection object, ensuring that any unmanaged resources are cleaned up.
QUESTION 84
You need to force an immediate garbage collection of all unused memory.
Which method should you use?
A.
B.
C.
D.

WaitForFullGCComplete
Collect
SuppressFinalize
CollectionCount

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 85
Type-safe programming languages require that:
A. All data conversions are done implicitly.
B. All data conversions are done explicitly.

C. Data conversions that might be unsafe are done explicitly.


D. Data conversions that might be unsafe are done implicitly.
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
* A language is type-safe if the only operations that can be performed on data in the language are those sanctioned by the type of the data.
* Explicit conversions (casts): Explicit conversions require a cast operator. Casting is required when information might be lost in the conversion, or when the
conversion might not succeed for other reasons. Typical examples include numeric conversion to a type that has less precision or a smaller range, and conversion
of a base-class instance to a derived class.
Incorrect:
Not (All data conversions are done implicitly/explicitly):
In C#, you can perform the following kinds of conversions:
/ Implicit conversions: No special syntax is required because the conversion is type safe and no data will be lost. Examples include conversions from smaller to
larger integral types, and conversions from derived classes to base classes.
/ Explicit conversions (casts): Explicit conversions require a cast operator.
/ User-defined conversions.
/ Conversions with helper classes
QUESTION 86
Which collection enforces type safety?
A.
B.
C.
D.

List<T>
Hashtable
Queue
ArrayList

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 87
Which part of the .NET Framework verifies that code is type-safe?
A.
B.
C.
D.

Microsoft Intermediate Language (MSIL) compiler


Just-in-Time (JIT) compiler
Base Class Library (BCL)
Common Type System (CTS)

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 88
Which feature is available in both Microsoft Visual Basic .NET and C#?
A.
B.
C.
D.

Static classes
Named and optional arguments in methods
Use of code that is not case-sensitive
Use of code that is not type-safe

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 89
Which two tasks does the interoperability of the .NET language allow you to perform? (Choose two.)
A.
B.
C.
D.
E.

Convert C# code to Microsoft Visual Basic .NET or convert Visual Basic .NET code to C#.
Create methods written in both C# and Microsoft Visual Basic .NET in the same class.
Use classes written in Microsoft Visual Basic .NET from C# code.
Use classes written in C# from Microsoft Visual Basic .NET code.
Write a method by using identical syntax of both C# and Microsoft Visual Basic .NET.

Correct Answer: CD
Section: (none)
Explanation
Explanation/Reference:
QUESTION 90
You want to use a collection to store Order items. The collection must be thread-safe and must provide access to the items in a last-in-first-out sequence.
Which type of collection should you use?
A. ConcurrentStack

B. ConcurrentQueue
C. NameValueCollection
D. LinkedList
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 91
Which namespace should you reference while using the StreamWriter class?
A.
B.
C.
D.

System.IO
System.Drawing
System.Printing
System.Text

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
The StreamWriter class belongs to the System.IO namespace.
QUESTION 92
You want to create a method that can accept any data type as arguments.
Which feature of .NET languages allows you to create one method that will accept different data types on each call to the method?
A.
B.
C.
D.

Overriding
Delegates
Generics
Named Parameters

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 93
A base class named MasterData is defined according to the following code segment.

Which code segment should you use to define a method named LoadData that overrides the method in the MasterData class?

A. Option A

B. Option B
C. Option C
D. Option D
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 94
Which describes an interface?
A.
B.
C.
D.

Contains code that implements properties, methods, and events.


Allows managed code to access unmanaged code.
Can be changed after it has been published.
A template that defines a set of properties, methods, and events.

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 95
You want to debug a class library project that will be used by an application named MyApplication.exe.
MyApplication.exe is not part of your Microsoft Visual Studio project and is not running currently. You want MyApplication.exe to start automatically.
What should you do?
A.
B.
C.
D.

Set the project's Start Action setting to Start project.


Set the command line arguments to start:MyApplication.exe.
Set the project's Start Action setting to Start external program and select MyApplication.exe.
Set the command line arguments to debug:MyApplication.exe.

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
The StartAction property for a project indicates the item to start when the application is debugged: the project, a custom program, a URL, or nothing. When set to
Start external program, the property indicates that a specific program should be started when the application is debugged.
QUESTION 96
Which code segment is an example of implicit boxing?

A.
B.
C.
D.

Option A
Option B
Option C
Option D

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 97
Which configuration file is automatically created by .NET when the file is needed by the application for the first time?
A.
B.
C.
D.

App.config
User.config
Web.config
Machine.config

Correct Answer: B
Section: (none)

Explanation
Explanation/Reference:
QUESTION 98
Which two actions are performed by the .NET Version class? (Choose two.)
A.
B.
C.
D.

Returns the version number of the web browser


Provides the base class for value types.
Returns the version number of an assembly.
Returns the version number of the Common Language Runtime.

Correct Answer: CD
Section: (none)
Explanation
Explanation/Reference:
The .NET Version class represents the version number of an assembly, operating system, or the common language runtime.
QUESTION 99
What data is stored on the heap?
A.
B.
C.
D.

Built-in, intrinsic value types


References to objects
Values of parameters in methods
Objects that contain non-value data types

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 100
In .NET, the automatic memory management system enables:
A.
B.
C.
D.

Synchronization.
Managed code.
Smart caching.
Garbage collection.

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 101
You create an XML document that has an XmlNode named node1.
Which code fragment will read the XML contained in node1 and its subnodes?
A.
B.
C.
D.
E.

Node1.InnerText
Node1.CuterXml
Node1.Value
Node1.ToString ()
Node1.InnerXml

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 102
You need to ensure that your console application can process each key as it is pressed.
Which method should you use?
A.
B.
C.
D.

Console.OpenStandardlnput
Console.ReadLine
Console.Read
Console.ReadKey

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
The Console.ReadKey method obtains the next character or function key pressed by the user.
QUESTION 103
You want to write log files to a user's My Documents folder.
Which class should you use to locate the My Documents folder?

A.
B.
C.
D.

Path
File
Directory
Environment

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 104
Which two classes in the .NET Framework can you use to open a file? (Each correct answer presents a complete solution. Choose two.)
A.
B.
C.
D.

System.IO.FileInfo
System.IO.File
System.IO.Path
System.IO.Stream

Correct Answer: AB
Section: (none)
Explanation
Explanation/Reference:
A: System.IO.FileInfo provides properties and instance methods for the creation, copying, deletion, moving, and opening of files, and aids in the creation of
FileStream objects.
B: System.IO.File provides static methods for the creation, copying, deletion, moving, and opening of files, and aids in the creation of FileStream objects.
Incorrect:
Not D: System.IO.FileStream exposes a Stream around a file, supporting both synchronous and asynchronous read and write operations.
QUESTION 105
Which application domain host manages security for web applications?
A.
B.
C.
D.

Browser
Custom-designed
Server
Shell

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 106
Which tool should you use to view the minimal, optional, and refused permission sets requested by an assembly?
A.
B.
C.
D.

Permissions View
Migration Policy
Permission Verify
Assembly Registration

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 107
You need to find out whether the active Windows user of an application is a member of the Administrators group.
Which permission class should you use?
A.
B.
C.
D.

PublisherIdentityPermission
PrincipalPermission
SecurityPermission
EnvironmentPermission

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 108
Which is the build number of a Version object instantiated by using the following code fragment?
Dim v As New Version (2, 4, 6, 8)
A. 2
B. 4
C. 6

D. 8
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 109
Which should you use to ensure that code can be used by several applications?
A.
B.
C.
D.

Public Policy
Private Assembly
Shared Assembly
Group Policy

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
An assembly which in the GAC and has a strong name is called shared assembly
Multiple applications can use the same shared assembly without having a own copy of that assembly.
QUESTION 110
Which three actions can you perform by using the Strong Name tool? (Choose three.)
A.
B.
C.
D.
E.

Compile the assembly for the first time.


Extract the public key from an assembly.
Re-sign a previously signed assembly.
Create a key pair for an assembly.
Encrypt an assembly.

Correct Answer: BCD


Section: (none)
Explanation
Explanation/Reference:
D: sn -a identityKeyPairFile signaturePublicKeyFile
Generates AssemblySignatureKeyAttribute data to migrate the identity key to the signature key from a file.
C: sn - R[a] assembly infile
Re-signs a previously signed or delay-signed assembly with the key pair in infile. If -Ra is used, hashes are recomputed for all files in the assembly.
B: Sn -e assembly outfile
Extracts the public key from assembly and stores it in outfile.
* The Strong Name tool (Sn.exe) helps sign assemblies with strong names. Sn.exe provides options for key management, signature generation, and signature
verification.
QUESTION 111
The Common Language Specification (CLS) standard:
A.
B.
C.
D.

Defines a common development environment for writing applications.


Allows code written in different languages to interact.
Defines a common syntax for all programming languages.
Allows code written for a desktop application to run as a web application.

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 112
Regarding C# code and Microsoft Visual Basic .NET code, language parity refers to the:
A.
B.
C.
D.

Fact that both languages are compiled as Microsoft Intermediate Language (MSIL).
Parts of the language where the syntax is identical.
Functionality that is common in both languages even if the syntax is different.
Ability of the two languages to interoperate.

Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 113
Which type of casting enforces type safety?
A.
B.
C.
D.

Reinterpret
Explicit static
Implicit static
Explicit dynamic

Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 114
Which describes the characteristic of the interoperability of the .NET Framework?
A.
B.
C.
D.

Allows consistent communication between a desktop application and a web application.


Uses the same code syntax.
Allows consistent communication between a desktop application and a mobile application.
Handles exceptions consistently across languages.

Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 115
Which programming languages can be managed, unmanaged, or both? (To answer, drag the appropriate option or options to the correct location or locations in the
answer area. An option may be moved to more than one location, and some options may not be moved at all.)
Select and Place:

Correct Answer:

Section: (none)
Explanation
Explanation/Reference:
Explanation:
Note:
* Managed code is a term coined by Microsoft to identify computer program source code that requires and will only execute under the management of a Common
Language Runtime virtual machine (resulting in bytecode). This applies to both C# and VB .Net.
Managed code needs a runtime (like the .NET CLT) to execute
* Microsoft's Visual C++ development environment can produce both managed code, running under the .NET CLR, or compiled binaries, running directly on the
Windows platform with the help of its C++ Runtime Library.

S-ar putea să vă placă și