Labels

Tuesday, September 7, 2010

#4 Practice Questions and Discussion for Exam 70-536

QUESTIONS Technology Focus: Implementing serialization and input/output functionality in a .NET Framework application
1. 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?

Option A:
C#
StreamWriter sw = File.CreateText(@"c:\application.log");
Visual Basic
Dim sw As StreamWriter = File.CreateText("c:\application.log")
Option B:
C#
FileInfo fi = new FileInfo(@"c:\application.log");
FileStream fs = fi.Open(FileMode.Append);
Visual Basic
Dim fi As FileInfo = New FileInfo("c:\application.log")
Dim fs As FileStream = fi.Open(FileMode.Append)
Option C:
C#
FileInfo fi = new FileInfo(@"c:\application.log");
StreamWriter sw = fi.AppendText();
Visual Basic
Dim fi As FileInfo = New FileInfo("c:\application.log")
Dim sw As StreamWriter = fi.AppendText()
Option D
C# 
EventLog.LogNameFromSourceName("MyApp", "Application");
Visual Basic
EventLog.LogNameFromSourceName("MyApp", "Application")

2. You are developing a class library by using the .NET Framework. You create the following classes:
C#
public class Book
{
    public string Name;
}
public class Encyclopedia : Book
{
    public int Volume;
}
Visual Basic
Public Class Book
    Public Name As String
End Class
Public Class Encyclopedia
    Inherits Book
    Public Volume As Integer
End Class
You must be able to serialize the objects of the Encyclopedia class to a disk file. What should you do?
Option A:

C#
Add the [Serializable] attribute to the Book class only.

Visual Basic
Add the <Serializable> attribute to the Book class only.
Option B:

C#
Add the [Serializable] attribute to the Encyclopedia class only.

Visual Basic
Add the <Serializable> attribute to the Encyclopedia class only.
Option C:

C#
Add the [Serializable] attribute to the Book class. 
Add the [Serializable] attribute to the Encyclopedia class.

Visual Basic
Add the <Serializable> attribute to the Book class. 
Add the <Serializable> attribute to the Encyclopedia class.
Option D:

C#
Add the [Serializable] attribute to the Encyclopedia class. 
Add the [NonSerialized] attribute to the Name field.

Visual Basic
Add the <Serializable> attribute to the Encyclopedia class. 
Add the <NonSerialized> attribute to the Name field.


3. You are developing a Windows application by using the .NET Framework. The application uses a shared assembly for personalizing the user interface of the application.The same assembly is used by several other applications on the user's machine. Any changes in the user preferences in one application must be carried over to other applications.
You need to access the user's preferences for displaying the user interface.What should you do?
A: Use the IsolatedStorageFile.GetMachineStoreForAssembly method
B: Use the IsolatedStorageFile.GetMachineStoreForDomain method.
C. Use the IsolatedStorageFile.GetUserStoreForDomain method.
D: Use the IsolatedStorageFile.GetUserStoreForAssembly method.

No comments:

Post a Comment