Posts Tagged ‘70-536’

C Sharp Test Question 8

Which is the correct declaration of nullable integer?

C Sharp Question 8

C Sharp Question 8

Explanation:

This is the proper way to declare and assign a nullable integer. In C#, you could also use the following .
int? i = null;

Objectives
Developing applications that use system types and collections

Manage data in a .NET Framework application by using .net Framework 2.0 system types.

Be the first to comment - What do you think?  Posted by admin - March 9, 2010 at 7:00 pm

Categories: Certification   Tags: ,

C Sharp Test Question 7

You are developing a text processing application by using the .NET Framework. You write the following code to iterate over a collection of strings and populate a ListBox control with the values it contains (line numbers are for reference only). The GetStrings function returns an array of strings.

01: StringCollection myStrCol = new StringCollection();
02: myStrCol.AddRange(GetStrings());
03: StringEnumerator myEnumerator = myStrCol.GetEnumerator();

You need to add code to populate the ListBox control.

What code should you add?

C Sharp Test Question 7

C Sharp Test Question 7

Question 7 Explanation:

You should add the following code after line 03 to populate the ListBox control:

while (myEnumerator.MoveNext())
lstStrings.Items.Add(myEnumerator.Current);

When you instantiate the enumerator, the Current property points to a location before the first element. You need to call MoveNext() to set the Current point to the first element.

Using the following code is incorrect because you attempt to use Current when it does not point to a valid location:

do
{
lstStrings.items.Add(myEnumerator.Current)
} while (myEnumerator.MoveNext())

Using the following code is incorrect because calling the Reset method brings the enumerator back to the position before the first element in the collection:

myEnumerator.Reset()
do
{
lstStrings.items.Add(myEnumerator.Current)
} while (myEnumerator.MoveNext())

Using the following code is incorrect because each time through the loop the enumerator is repositioned before the first element:

do
{
lstStrings.items.Add(myEnumerator.Current)
myEnumerator.Reset();
} while (myEnumerator.MoveNext())

Objective: 
Developing applications that use system types and collections

Sub-Objective:
1.4 Manage data in a .NET Framework application by using specialized collections (Refer System.Collections.Specialized namespace)

Be the first to comment - What do you think?  Posted by admin - at 5:29 pm

Categories: Certification   Tags: ,

C Sharp Test Question 6

You are developing a logging module for a large application by using the .NET Framework.

You need to append logging information to a file named application.log. This log file is opened when the application is started and is closed only when the application is closed. However, you append text several times to the file during a session.

You must minimize overhead to the logging process to ensure maximum performance.

Which code segment should you use to create the log file?

C Sharp Test Question 6

C Sharp Test Question 6

Question 6 Explanation:

If you are going to reuse an object several times, you should use the instance method of the FileInfo class instead of the corresponding static methods of the File class, because a security check will not always be necessary. This will minimize any overhead and improve the performance of the application.

You should use the following code to append data to the log file:

FileInfo fi = new FileInfo(@”c:\application.log”);
StreamWriter sw = fi.AppendText();

Using the following code is incorrect because you should use FileMode.Append only in conjunction with FileAccess.Write.

FileInfo fi = new FileInfo(@”c:\application.log”);
FileStream fs = fi.Open(FileMode.Append);

Objective: 
Implementing serialization and input/output functionality in a .NET Framework application

Sub-Objective:
4.4 Access files and folders by using the File System classes. (Refer System.IO namespace)

Be the first to comment - What do you think?  Posted by admin - at 5:24 pm

Categories: Certification   Tags: ,

C Sharp Question 5

You are developing a console application that uses .NET Framework text processing libraries. You write the following code to process text:

StringBuilder sb = new StringBuilder(5);
sb.Append(“01234567890123456789″);
sb.Length = 10;
sb.Append(“AB”);
Console.WriteLine(“Length = {0}”, sb.Length);
Console.WriteLine(“Capacity = {0}”, sb.Capacity);

You must determine the value of sb.Length and sb.Capacity printed by this code segment.

Which values should you select?

C Sharp Question 5

C Sharp Question 5

The correct answer is:

Length = 12
Capacity = 20

The StringBuilder object is first created with a capacity of 5. If needed, the Append method increases the length and capacity of the StringBuilder object. Therefore, the following statement increases the capacity and length of the StringBuilder object to 20:

sb.Append(“01234567890123456789″);

When the following statement is executed, the length of the StringBuilder object is truncated to 10 characters, but the capacity stays at 20:

sb.Length = 10;

Finally, the following statement increases length of the StringBuilder object by 2 characters to 12:

sb.Append(“AB”);

Capacity stays at 20 because there is still room to grow.

Objective:
 Implementing globalization, drawing, and text manipulation functionality in a .NET Framework application

Sub-Objective:
7.3 Enhance the text handling capabilities of a .NET Framework application (refer System.Text namespace), and search, modify, and control text within a .NET Framework application by using regular expressions. (Refer System.RegularExpressions namespace)

Be the first to comment - What do you think?  Posted by admin - at 5:20 pm

Categories: Certification   Tags: ,

C Sharp Question 4

You are developing a .NET Framework application. You write the following code in your application:

public interface IShape
{
double GetArea();
double GetPerimeter();
}

public class Shape : IShape
{
public Shape()
{

}

public double GetArea()
{
double area = 0;
// Additional code goes here
return area;
}

public double GetPerimeter()
{
double perimeter = 0;
// Additional code goes here
return perimeter;
}
}

You must make sure that Component Object Model (COM) clients interact with the members of the Shape class exclusively by using an interface reference. The COM clients must only be able to early-bind to the types in the .NET assembly.

You must also make sure that adding or rearranging members to the IShape interface does not cause existing COM clients to fail.

What should you do? (Each correct answer presents part of the solution. Choose two.)

C Sharp Question 4

C Sharp Question 4

 The ClassInterfaceType.None setting indicates that no class interface is automatically generated for the class. Any functionality of the class in this case must be exposed through the interface that is explicitly implemented by the class. Therefore, you should apply the following attribute to the Shape class:

[ClassInterface(ClassInterfaceType.None)]

The InterfaceType attribute indicates how an interface is exposed to COM. The ComInterfaceType.InterfaceIsIUnknown setting of the InterfaceType attribute only supports early-binding. Therefore, you should apply the following attribute to the IShape interface:

[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]

The default setting for the ClassInterface attribute is ClassInterfaceType.AutoDispatch, which indicates that an interface is automatically generated for the COM client on request at runtime. Therefore, you should not apply the following attribute to the Shape class:

[ClassInterface(ClassInterfaceType.AutoDispatch)]

The ClassInterfaceType.AutoDual setting binds to a specific interface layout. This may create problems when the order of members in an interface is changed in later versions. Because it can create versioning problems, the use of ClassInterfaceType.AutoDual setting is discouraged. Therefore, you should not apply the following attribute to the Shape class:

[ClassInterface(ClassInterfaceType.AutoDual)]

The default setting of the InterfaceType attribute is ComInterface.InterfaceIsDual, which means that the interface supports both early-binding and late-binding. The ComInterfaceType.InterfaceIsIDispatch setting of the InterfaceType attribute only supports late-binding. Therefore, you should not apply the following attribute to the IShape interface:

[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]

Objective:
 List all questions for this objective
 

Implementing interoperability, reflection, and mailing functionality in a .NET Framework application

Sub-Objective:
6.1 Expose COM components to the .NET Framework and .NET Framework components to COM. (Refer System.Runtime.InteropServices namespace)

Be the first to comment - What do you think?  Posted by admin - at 5:09 pm

Categories: Certification   Tags: ,

C Sharp Test Question 3

You use the .NET Framework to develop a client-server application. The server part of the application runs on a computer running Microsoft Windows Server 2003. All client computers run Microsoft Windows XP Professional.

You need to write code that performs authentication and establishes a secure connection between the server and the client. You must make sure that the Kerberos protocol is used for authentication.

You must also make sure that data is encrypted before it is transmitted over the network and decrypted when it reaches the destination.

Which code segment should you use?

C Sharp Test Question 3

C Sharp Test Question 3

This code segment (highlighted) uses the NegotiateStream class. The NegotiateStream class uses the Kerberos protocol for authentication if it is supported by both the client and the server. Windows Server 2003 and Windows XP both support the Kerberos protocol. When the value ProtectionLevel.EncryptAndSign is passed as a parameter to the AuthenticateAsServer method, it specifies that data must be encrypted and signed before it is transmitted over the network and decrypted and verified when it reaches the destination.

You should not use the following code segment because when the value ProtectionLevel.Sign is passed as a parameter to the AuthenticateAsServer method, it specifies that data should only be signed (rather than both encrypted and signed) before it is transmitted:

Wrong code

Wrong code

You should not use the 2nd set of  code segment because it uses X509 certificates for authentication rather than the Kerberos protocol:

You should not use the 3 rd set of code segment because it uses X509 certificates for authentication rather than the Kerberos protocol:

Be the first to comment - What do you think?  Posted by admin - at 5:06 pm

Categories: HTML   Tags: ,

C Sharp Test Question 2

You create a Windows service application that consists of two services. One service monitors a directory for new orders and the other service replicates a database table with the most up-to-date inventory information.

You need to develop a project installer class to install these services.

What should you do? (Each correct answer presents part of the solution. Choose two.)

C Sharp Question 2

C Sharp Question 2

The ServiceProcessInstaller class installs an executable containing services. The ServiceInstaller class installs a class that implements a service.

When creating a project installer class, you need to instantiate one ServiceProcessInstaller instance per service application, and one ServiceInstaller instance for each service in the application.

The ComponentInstaller class specifies an installer that copies properties from a component to use at install time. This class is an abstract class and cannot be instantiated.

Objective:
 
Implementing service processes, threading, and application domains in a .NET Framework application

Sub-Objective:
2.1 Implement, install, and control a service. (Refer System.ServiceProcess namespace)

Be the first to comment - What do you think?  Posted by admin - at 4:50 pm

Categories: Certification   Tags: ,