Powered By Blogger

19 may 2009

PRUEBATE PARA EL EXAMEN 70-536

PRUEBATE PARA EL EXAMEN 70-536



Questions Exam 70-536 MCTS

Previo a un examen de certificación se necesita poner a prueba los conocimientos sobre Framework .NET 2.0 que sirve parcialmente para el Framework 3.5, razón por la cual presento estas preguntas DE PREPARACION con sus respectivas claves.




1-
You develop a service application named FileService. You deploy the service applicationto multiple servers on your network. You implement the following code segment. (Linenumbers are included for reference only.)01 public :02 void StartService(String^ serverName){0304 ServiceController^ crtl = gcnew05 ServiceController("FileService");06 if (crtl->Status == ServiceControllerStatus::Stopped){}07 }You need to develop a routine that will start FileService if it stops. The routine must startFileService on the server identified by the serverName input parameter.Which two lines of code should you add to the code segment? (Each correct answerpresents part of the solution. Choose two.)


A-Insert the following line of code between lines 03 and 04:crtl.ServiceName =serverName;
B-Insert the following line of code between lines 03 and 04:crtl.MachineName =serverName;
C-Insert the following line of code between lines 03 and 04:crtl.Site.Name =serverName;
D-Insert the following line of code between line 04 and 05:crtl.continue();
E-Insert the following line of code between line 04 and 05:crtl.Start();F- Insert the following line of code between line 04 and 05:crtl.ExecuteCommand(0);


Answer: BE


2-
You need to write a code segment that transfers the first 80 bytes from a stream variablenamed stream1 into a new byte array named byteArray. You also need to ensure that thecode segment assigns the number of bytes that are transferred to an integer variablenamed bytesTransferred. Which code segment should you use?

A-bytesTransferred = stream1.Read(bytesArray,0, 80);
B-for (int i = 0;i <80;i++) {stream1.WriteByte(byteArray[i]);bytesTransferred = i;if (!stream1.CanWrite) {break;}}

C-while (bytesTransferred < 80) {stream1.Seek(1, SeekOrigin.Current);byteArray[bytesTransferred++] =Convert.ToByte(stream1.ReadByte());}

D-stream1.Write(byteArray, 0, 80);bytesTransferred = byteArray.Length;

Answer: A
3-
You use Reflection to obtain information about a method named MyMethod.You need to ascertain whether MyMethod is accessible to a derived class. What shouldyou do?

A-Call the IsAssembly property of the MethodInfo class.B-Call the IsVirtual property of the MethodInfo class.C-Call the IsStatic property of the MethodInfo class.D-Call the IsFamily property of the MethodInfo class.

Answer: D

4-
You need to identify a type that meets the following criteria: ?Is always a number.?Is not greater than 65,535. Which type should you choose?

A-System.UInt16
B-int
C-System.String
D-System.IntPtr

Answer: A

5-
You are developing an application to assist the user in conducting electronic surveys. Thesurvey consists of 25 true-or-false questions. You need to perform the following tasks:Initialize each answer to true.Minimize the amount of memory used by each survey.Which storage option should you choose?

A.BitVector32 answer = new BitVector32(1);B.BitVector32 answer = new BitVector32(-1);
C-BitArray answer = new BitArray (1);D-BitArray answer = new BitArray (-1);

Answer: B

6-
You need to write a code segment that will create a common language runtime (CLR)unit of isolation within an application. Which code segment should you use?

A.AppDomainSetup^ mySetup =AppDomain::CurrentDomain::SetupInformation;mySetup->ShadowCopyFiles = "true";
B.System::Diagnostics::Process^ myProcess;myProcess = gcnew System::Diagnostics::process();
C- C.AppDomain^ domain;domain = AppDomain::CreateDomain("CertKillerDomain")
D.System::ComponentModel::Component^ myComponent;myComponent = gcnew System::ComponentModel::Component();

Answer: C


7-
You are creating a class to compare a specially-formatted string. The default collationcomparisons do not apply. You need to implement the IComparable interface.Which code segment should you use?

A-public class Person : IComparable{public int CompareTo(string other){}}
B-public class Person : IComparable{public int CompareTo(object other){
}}
C-public class Person : IComparable{public bool CompareTo(string other){}}
D-public class Person : IComparable{public bool CompareTo(object other){}}

Answer: A

8-
You need to write a multicast delegate that accepts a DateTime argument and returns aBoolean value. Which code segment should you use?

A-public delegate int PowerDeviceOn(bool, DateTime);
B- public delegate bool PowerDeviceOn(Object, EventArgs);
C- public delegate void PowerDeviceOn(DateTime);
D- public delegate bool PowerDeviceOn(DateTime);

Answer: A


9-
You are developing a class library that will open the network socket connections tocomputers on the network. You will deploy the class library to the global assembly cacheand grant it full trust. You write the following code to ensure usage of the socketconnections.SocketPermission permission =new SocketPermission(PermissionState.Unrestricted);permission.Assert();Some of the applications that use the class library might not have the necessarypermissions to open the network socket connections.You need to cancel the assertion.Which code segment should you use?

A- CodeAccessPermission.RevertAssert();
B- CodeAccessPermission.RevertDeny();
C-Permission.Deny();
D-Permission.PermitDeny();

Answer: A







10-
You are writing a method that returns an ArrayList named al. You need to ensure thatchanges to the ArrayList are performed in a thread-safe manner. Which code segmentshould you use?

A-ArrayList al = new ArrayList();lock (al.SyncRoot){return al;}
B- ArrayList al = new ArrayList();lock (al.SyncRoot.GetType()){return al;}
C- ArrayList al = new ArrayList();Monitor.Enter(al);Monitor.Exit(al);return al;
D- ArrayList al = new ArrayList();ArrayList sync_al = ArrayList.Synchronized(al);return sync_al;

Answer: D

11-
You are working on a debug build of an application.You need to find the line of code that caused an exception to be thrown. Which propertyof the Exception class should you use to achieve this goal?

A- Data
B- Message
C- StackTrace
D- Source

Answer: C

12-
You need to generate a report that lists language codes and region codes.Which code segment should you use?

A- for each (CultureInfo^ culture inCultureInfo::GetCultures(CultureTypes::SpecificCultures)) {// Output the culture information...}
B- CultureInfo^ culture = gcnew CultureInfo("");CultureType^ type = culture->CultureTypes;
// Output the culture information...}
C- for each (CultureInfo^ culture inCultureInfo::GetCultures(CultureTypes::NeutralCultures)) {// Output the culture information...}
D- for each (CultureInfo^ culture inCultureInfo::GetCultures(CultureTypes::ReplacementCultures)) {// Output the culture information...}

Answer: A







13-
You need to serialize an object of type List in a binary format. The object is nameddata.Which code segment should you use?

A- BinaryFormatter^ formatter = gcnew BinaryFormatter();MemoryStream^ stream = gcnew MemoryStream();formatter->Serialize(stream, data);
B- BinaryFormatter^ formatter = gcnew BinaryFormatter();MemoryStream^ stream = gcnew MemoryStream();for (int i = 0;i Count;i++) {formatter->Serialize(stream, data);}
C- BinaryFormatter^ formatter = gcnew BinaryFormatter();byte^ buffer = gcnew array(data->Count);MemoryStream^ stream = gcnew MemoryStream(buffer, true);formatter->Serialize(stream, data);
D- BinaryFormatter^ formatter = gcnew BinaryFormatter();MemoryStream^ stream = gcnew MemoryStream();Capture c(formatter,stream);data->ForEach(gcnew Action(%c,&Capture::Action));

Answer: A

14-

You need to create a method to clear a Queue named q. Which code segment should youuse?

A- for each (Object^ e in q) {q.Dequeue();}
B- for each (Object^ e in q) {q.Enqueue();}
C-q.Clear();

D-q. Dequeue();

Answer: C

15-
You create an application that stores information about your customers who reside invarious regions. You are developing internal utilities for this application.You need to gather regional information about your customers in Canada.Which code segment should you use?

A- For Each objCulture As CultureInfo In_CultureInfo.GetCultures(CultureTypes.SpecificCultures)...Next
B- Dim objCulture As New CultureInfo("CA")
C- Dim objRegion As New RegionInfo("CA")
D- Dim objRegion As New RegionInfo("")If objRegion.Name = "CA" Then...End If



16-

You are creating an undo buffer that stores data modifications. You need to ensure thatthe undo functionality undoes the most recent data modifications first. You also need toensure that the undo buffer permits the storage of strings only. Which code segmentshould you use?

A.Dim undoBuffer As New Stack(Of String)B.Dim undoBuffer As New Stack()C.Dim undoBuffer As New Queue(Of String)D.Dim undoBuffer As New Queue()

Answer: A

17-
You work as the application developer at Certkiller .com. Certkiller .com uses Visual Studio.NET 2005 as its application development platform. You use a Windwos XP Professional clientcomputer named Certkiller -WS536 as your development computer. You are developing a .NET Framework 2.0 Windows application on Certkiller -WS536 which is used as collateral.
You write the following code in the application:Dim testplain As Byte() The byte array testplain contains the data that needs to be protected and the length of the data stored in the byte array is always a multiple of 16. You want only thethreads running under the current user context to be able to unprotect the data whilst the protected data will be stored in a different byte array. The original contents from the testplain byte array must remain unmodified. You are required to select which code segment to use if the application will be executed on computers running Windows XP Professional.What should you do?

A.Use ProtectedMemory.Protect(testplain, MemoryProtectionScope.SameLogon)B.Use ProtectedMemory.Protect(testplain, Nothing, DataProtectionScope.LocalMachine)C.Use ProtectedMemory.Protect(testplain, MemoryProtectionScope.SameProcess)D.Use ProtectedData.Protect(testplain, Nothing, DataProtectionScope.CurrentUser)

Answer: D

Explanation:The ProtectedData.Protect method is used to return a protected copy of the data in the testplain byte array whilst the content of the byte array remains unaffected making this the correct option to use in the scenario.

18-
You work as the application developer at Certkiller .com. You are developing a .NET Framework 2.0 Windows Service application named TestScannerSync that will be used to constantlymonitor for a scanner to be connected to the computer. The TestScannerSync class inherits its functionality from the ServiceBase class. When you connect a scanner the servicesynchronizes its data with the data in a SQL Server database.You decide to override the OnStop method in the TestScannerSync class and write code to close database connections. are required to identify a place in the code where you can openthe connection to the database.What should you do?


A.The database connection is opened in the constructor of TestScannerSync class
B.The database connection is opened in the OnContinue method of TestScannerSync classC.The database connection is opened in the OnStart method of the TestScannerSync classD.The database connection is opened in the OnPowerEvent method of the TestScannerSync class

Answer: C
Explanation:The constructor for a service class derived from ServcieBase is called the first time you call Start on the service, the OnStart command-handling method is called immediately after theconstructor executes.


19-
You work as the application developer at Certkiller .com. Certkiller .com uses Visual Studio.NET 2005 as its application development platform. You use a Windwos XP Professional clientcomputer named Certkiller -WS554 as your development computer.You are developing a .NET Framework 2.0 application.
The application will be used globally and must be able to represent characters in the following languages:English, Chinese Traditional, Hebrew and Tamil. Your application is required to provide error detection for invalid sequences of characters whilst your application must also optimize storage.What should you do?

A.Encode the characters in your application using the UTF8Encoding classB.Encode the characters in your application using the UTF7Encoding classC.Encode the characters in your application using the UTF32Encoding classD.Encode the characters in your application using the UTF16Encoding class

Answer: A

Explanation:To successfully enable error detection and make the class instance more secure you should make use of the UTF8Encoding class in the scenario.Incorrect Answers:B: The Encoding class used in this option UTF7Encoding does not provide any error detection and should not be used in the scenario.
C, D: The Encoding classes in these options should not be used in the scenario because the UTF16Encoding class represents each character as a sequence of one to two 16-bit integers and the UTF32Encoding represents each code point as a 32-bit integer.

20-

You work as an application developer at Certkiller .com. A fellow developer named Amy Walsh recently created an assembly that implements a custom permission set. Certkiller .comhas asked you to test this assembly. You start by copying the assembly to a test server named Certkiller -SR15 that has the Microsoft .NET 2.0 Framework installed. You thenlog on to the Certkiller -SR15 as a member of the local Administrators Windows group.
You run the assembly, and receive a security exception. You perform a brief analysis of the security issues involved, and find that the assembly has not been assigned the appropriatepermissions to run.
You need to ensure that this assembly runs.What should you do?

A-Use the permview.exe tool to modify the assembly's granted permissions.B-Use the sn.exe tool to modify the assembly's granted permissions.C-Use the caspol.exe tool to modify the assembly's granted permissions.D-Use the gacutil.exe tool to modify the assembly's granted permissions.

Answer: C
Explanation:The caspol.exe command-line tool allows users to modify security permissions, permission sets, and code groups for an assembly at the machine, user, and enterprise policy levels.Incorrect Answers:A: The permview.exe tool only allows users to view declarative security of an assembly.
B: The sn.exe tool allows developers to create a strong-named asymmetric key pair for strong-named assemblies.D: The gacutil.exe tool allows users to manage the contents of the global assembly and download cache.

21-

You work as the application developer at Certkiller .com. Certkiller .com uses Visual Studio.NET 2005 as its application development platform. You are developing a .NET Framework 2.0 Web application and are busy creating a Configuration object in your application that inherits settings from the applications' web.config file and machine.config file. You modify several of the Configuration objects settings and want to save the Configuration object to a file named testconf.config. You require only the values that differ fromthe inherited values to be written to the configuration file.What should you do? (Choose two)


A.The Save method on the Configuration object should be called
B.The ConfigurationSaveMode.Full value must be passed as a parameterC.The ConfigurationSaveMode.Modified value must be passed as a parameter
D.The SaveAs method on the Configuration object should be calledE.The ConfigurationSaveMode.Minimal value should be passed as a parameter

Answer: CD

Explanation:When you are required to write configuration settings to a different file the SaveAs method should be called. If you wish to write only values which differ from inherited values theConfigurationSaveMode.Minimal value should be passed as a parameter.

22-

You work as the application developer at Certkiller .com. Certkiller .com uses Visual Studio.NET 2005 as its application development platform. You are developing a .NET Framework 2.0 application and write the following code in your Bill program:
Dim logFile As Stream = File.Create("C:\BillLogFile.txt") Dim txtl As TextWriterTraceListner = New TextWriterTraceListner(logFile) Trace.Listners.Add(txtl) Trace.WriteLine("Bill Message 1")Debug.WriteLine("Bill Message 2") Trace.Flush() You need to know what output will be generated in the C:\BillLogFIle.txt file when you run the Bill program in debug mode.What should you do?

A.Bill Message 1B.Bill Message 2
C.The C:\BillLogFile.txt file is emptyD.Bill Message 1 Bill Message 2

Answer: D

23-
You work as an application developer at Certkiller .com. You are currently creating an application that requires role-based security. You are planning to utilize a database to store the user accounts and group membership data.You need to ensure that users are able to log on and off. You also need to ensure that the application you have created tracks the user accounts of these users, and restrict or allow access to code based on their group membership. You need to achieve this objective with as little developer effort as possible.
What should you do to implement role-based security?

A.Inherit from the GenericIdentity and GenericPrincipal classes.B.Make use of GenericIdentity and GenericPrincipal objects.C.Implement the IIdentity and IPrincipal interfaces.D.Make use of WindowsIdentity and WindowsPrincipal objects

Answer: B

24-

You work as the application developer at Certkiller .com. Certkiller .com uses Visual Studio.NET 2005 as its application development platform. You are developing a Windows Service application that consists of two Services. The first service monitors a directory for new orders while the other service replicates a database table with up-to-date information. You are required to develop a project installer class to install these services.
What should you do? (Choose two)

A- One ServiceProcessInstaller instance must be Instantiate and add it to the project installer class
B- Two ServiceInstaller instances must be Instantiate and add them to the project installer class
C- Two ServiceProcessInstaller instances must be Instantiate and add them to the project installer class
D- One ComponentInstaller instance must be Instantiate and add them to the project installer classE-Two ComponentInstaller instances must be Instantiate and add them to the project installer classF-One ServiceInstaller instance must be Instantiate and add them to the project installer class

Answer: AB


25-

You work as the application developer at Certkiller .com. Certkiller .com uses Visual Studio.NET 2005 as its application development platform.You are developing a .NET Framework 2.0 Windows application that provides a user interface similar to Microsoft Excel and allows users to manage their expenses.
You recently wrote a wrapper around the expense management application which performs security checks. If the users have the sufficient rights the wrapper application launches the expense management application, if no sufficient rights the application should be forced to close. You must decide which method of the Process class to use.What should you do?

A.Use the Kill method.B.Use the Close method.C.Use the Dispose method.D.Use the CloseMainWindows method.

Answer: A

26-

You work as the application developer at Certkiller .com. Certkiller .com uses Visual Studio.NET 2005 as its application development platform.You are developing a .NET Framework 2.0 application that will be used for publishing its own custom performance counter. You additionally require the value of a performance counter toincrease by 5 and must minimize the amount of code needed to write.What should you do?

A.Use the NextValue method.B.Use the Decrement method.C.Use the Increment method.D.Use the IncrementBy method.

Answer: D

27-

You work as an application developer at Certkiller .com. You are developing a .NET Framework 2.0 application used to store a type-safe list of names and e-mail addresses. The list will bepopulated all at ones from the sorted data which means you well not always need to perform insertion or deletion operations on the data.You are required to choose a data structure that optimizes memory use and has good performance.What should you do?

A.The System.Collections.Generic.SortedList class should be usedB.The System.Collections.HashTable class should be usedC.The System.Collections.Generic.SortedDictionary class should be usedD.The System.Collections.SortedList class should be used

Answer: A


28-

You work as the application developer at Certkiller .com. Certkiller .com uses Visual Studio.NET 2005 as its application development platform.You are developing a .NET Framework 2.0 geographical information system for the company and create a class named Certkiller Code. You are required to serialize all public and non-publicdata of the Certkiller Code class whilst you ensure that you produce the smallest byte stream so that the smallest load is placed upon network resources.What should you do?

A.The XmlSerializationWriter class should be usedB.The XmlSerializer class should be usedC.The BinaryFormatter class should be usedD.The SoapFormatter class should be used

Answer: C

29-

You work as an application developer at Certkiller .com. Certkiller .com has been contracted to develop an application for the local bank.
You have been given the responsibility of creating this application and need to store each transaction record, which is identified using a complex transaction identifier, in memory. The bank informs you that the total amount of transaction records could reach 200 per day.
To achieve this, you decide to utilize one of the existing collection classes in the .NET 2.0 class library. You need to ensure that you the collection class you select is the most efficient one for storing transaction records.

What should you do?


A-Select the ListDictionary collection class.B-Select the HashTable collection class.C-Select the Queue collection class.D-Select the StringCollection collection class

Answer: B




30-

You work as the application developer at Certkiller .com. Certkiller .com uses Visual Studio.NET 2005 as its application development platform.You are developing a .NET Framework 2.0 time management application that requires opening a file namedBillTimeManagement.als programmatically.
All the client computers are equippedwith Microsoft Office and file associations have not been modified after installation of the software. You are required to create a ProcessStatInfo object to provide file details to open the file.What should you do?


A.Dim psi As ProcessStartInfo = New ProcessStartInfo("BillTimeManagement.xls", "Excel")
B.Dim psi As ProcessStartInfo = New ProcessStartInfo("Excel BillTimeManagement.xls")C.Dim psi As ProcessStartInfo = New ProcessStartInfo("Excel", "BillTimeManagement.xls")D.Dim psi As ProcessStartInfo = New ProcessStartInfo("BillTimeManagement.xls")

Answer: D



31. Why should boxing be avoided? (Choose one.)

A. It adds overhead.
B. Users must have administrative privileges to run the application.
C. It makes code less readable.

32 Structures inherit ToString from System.Object. Why would someone override that method within a structure? (Choose as many correct answer as apply.)

A. To avoid boxing.
B. To return something other than the type name.
C. The compiler requires structures to override the ToString method
D. To avoid run-time errors caused by invalid string conversions.

33. If there is no valid conversion between two types, what should you do when
implementing the IConvertible interface?

A. Delete the ToType member that performs the conversion
B. Throw an InvalidCastException.
C. Throw a new custom exception reporting the error.
D. Leave the member body empty.

34. With strict conversions enabled, which of the following would allow an implicit
conversion? (Choose all that apply.)

A. Int16 to Int32
B. Int32 to Int16
C. Int16 to Double
D. Double to Int16


Respuestas

31. Correct Answer: A

A. Correct: The primary reason to avoid boxing is because it adds overhead.
B. Incorrect: Boxing requires no special privileges.
C. Incorrect: Boxing does not make code less readable.

32. Correct Answers: A and B

A. Correct: Value types are boxed when an abstract method inherited from
System.Object is called. Overriding the method avoids boxing.
B. Correct: By default, the ToString method simply returns the type name,
which is typically not useful for a consuming application.
C. Incorrect: The compiler does not require structures to override the
ToString method.
D. Incorrect: ToString never causes a run-time error; it simply returns the type
name unless overridden.

33. Correct Answer: B

A. Incorrect: You can’t omit a member of an interface and still conform to that
interface.
B. Correct: InvalidCastException is the recommended exception to throw.
C. Incorrect: While you could throw a custom exception, using standard
exception types makes it easier for developers writing code to consume
your type to catch specific exceptions.
D. Incorrect: You must return a value for each conversion member.


34. Correct Answers: A and C

A. Correct: You can convert from Int16 to Int32 because that is considered a
widening conversion. Because Int32 can store any value of Int16, implicit
conversion is allowed.
B. Incorrect: You cannot convert from Int32 to Int16 because that is consid-
ered a narrowing conversion. Because Int16 cannot store any value of Int32,
implicit conversion is not allowed.
C. Correct: You can convert from Int16 to Double because that is considered a
widening conversion. Because Double can store any value of Int16, implicit
conversion is allowed.
D. Incorrect: You cannot convert from Double to Int16 because that is consid-
ered a narrowing conversion. Because Int16 cannot store any value of Dou-
ble, implicit conversion is not allowed.