Free Cheat-test Samples and Demo Questions Download
Adobe exams Adobe
Apple exams Apple
Avaya exams Avaya
Check Point exams Check Point
Cisco exams Cisco
Citrix exams Citrix
CIW exams CIW
CompTIA exams CompTIA
CWNP exams CWNP
EC-Council exams EC-Council
EMC exams EMC
Exin exams Exin
Fortinet exams Fortinet
GIAC exams GIAC
Hitachi exams Hitachi
HP exams HP
IBM exams IBM
Isaca exams Isaca
ISC exams ISC
ISEB exams ISEB
Juniper exams Juniper
LPI exams LPI
McAfee exams McAfee
Microsoft exams Microsoft
Oracle exams Oracle
PMI exams PMI
Riverbed exams Riverbed
SNIA exams SAP
Sun exams SAS
Symantec exams Symantec
VMware exams VMware
All certification exams

Microsoft 70-552(CSharp) Exam - Cheat-Test.com

Free 70-552(CSharp) Sample Questions:

Q: 1 You are developing an auditing application to display the trusted ClickOnce applications that are installed on a computer. You need the auditing application to display the origin of each trusted application. Which code segment should you use?
A. ApplicationTrustCollection trusts;trusts = ApplicationSecurityManager.UserApplicationTrusts; foreach (ApplicationTrust trust in trusts) { Console.WriteLine(trust.ToString());}
B. ApplicationTrustCollection trusts;trusts = ApplicationSecurityManager.UserApplicationTrusts; foreach (ApplicationTrust trust in trusts) { Console.WriteLine(trust.ExtraInfo.ToString());}
C. ApplicationTrustCollection trusts;trusts = ApplicationSecurityManager.UserApplicationTrusts; foreach (ApplicationTrust trust in trusts) {
Console.WriteLine(trust.ApplicationIdentity.FullName);}
D. ApplicationTrustCollection trusts;trusts = ApplicationSecurityManager.UserApplicationTrusts; foreach (object trust in trusts) { Console.WriteLine(trust.ToString());}
Answer: C

Q: 2 You are developing an application that will use custom authentication and role-based security. You need to write a code segment to make the runtime assign an unauthenticated principal object to each running thread. Which code segment should you use?
A. AppDomain domain =
AppDomain.CurrentDomain;domain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
B. AppDomain domain = AppDomain.CurrentDomain;domain.SetThreadPrincipal(new
WindowsPrincipal(null));
C. AppDomain domain = AppDomain.CurrentDomain; domain.SetAppDomainPolicy(
PolicyLevel.CreateAppDomainLevel());
D. AppDomain domain = AppDomain.CurrentDomain;domain.SetPrincipalPolicy(
PrincipalPolicy.UnauthenticatedPrincipal);
Answer: D

Q: 3 You are developing a method to hash data for later verification by using the MD5 algorithm. The data is passed to your method as a byte array named message. You need to compute the hash of the incoming parameter by using MD5. You also need to place the result into a byte array. Which code segment should you use?
A. HashAlgorithm algo = HashAlgorithm.Create("MD5");byte[] hash = algo.ComputeHash(message);
B. HashAlgorithm algo = HashAlgorithm.Create("MD5");byte[] hash =
BitConverter.GetBytes(algo.GetHashCode());
C. HashAlgorithm algo;algo = HashAlgorithm.Create(message.ToString());byte[] hash = algo.Hash;
D. HashAlgorithm algo = HashAlgorithm.Create("MD5");byte[] hash = null;algo.TransformBlock(message, 0, message.Length, hash, 0);
Answer: A

Q: 4 You are developing a server application that will transmit sensitive information on a network. You create an X509Certificate object named certificate and a TcpClient object named client. You need to create an SslStream to communicate by using the Transport Layer Security 1.0 protocol. Which code segment should you use?
A. SslStream ssl = new SslStream(client.GetStream());ssl.AuthenticateAsServer( certificate, false,
SslProtocols.None, true);
B. SslStream ssl = new SslStream(client.GetStream());ssl.AuthenticateAsServer( certificate, false,
SslProtocols.Ssl3, true);
C. SslStream ssl = new SslStream(client.GetStream());ssl.AuthenticateAsServer( certificate, false,
SslProtocols.Ssl2, true);
D. SslStream ssl = new SslStream(client.GetStream()); ssl.AuthenticateAsServer( certificate, false,
SslProtocols.Tls, true);
Answer: D

Q: 5 You are writing a method to compress an array of bytes. The array is passed to the method in a parameter named document. You need to compress the incoming array of bytes and return the result as an array of bytes. Which code segment should you use?
A. MemoryStream strm = new MemoryStream(document);DeflateStream deflate = new DeflateStream(strm, CompressionMode.Compress); byte[] result = new
byte[document.Length];deflate.Write(result, 0, result.Length); return result;
B. MemoryStream strm = new MemoryStream(document);DeflateStream deflate = new DeflateStream(strm, CompressionMode.Compress);deflate.Write(document, 0, document.Length);deflate.Close();return strm.ToArray();
C. MemoryStream strm = new MemoryStream();DeflateStream deflate = new DeflateStream(strm,
CompressionMode.Compress);deflate.Write(document, 0, document.Length);deflate.Close();return strm.ToArray();
D. MemoryStream inStream = new MemoryStream(document);DeflateStream deflate = new
DeflateStream(inStream, CompressionMode.Compress); MemoryStream outStream = new
MemoryStream();int b;while ((b = deflate.ReadByte()) != -1) { outStream.WriteByte((byte)b);} return
outStream.ToArray();
Answer: C

Q: 6 You create a class library that contains the class hierarchy defined in the following code segment. (Line numbers are included for reference only.)
01 public class Group {
02 public Employee[] Employees;
03 }
04 public class Employee {
05 public string Name;
06 }
07 public class Manager : Employee {
08 public int Level;
09 }
You create an instance of the Group class. You populate the fields of the instance. When you attempt to serialize the instance by using the Serialize method of the XmlSerializer class, you receive InvalidOperationException. You also receive the following error message: "There was an error generating the XML document." You need to modify the code segment so that you can successfully serialize instances of the Group class by using the XmlSerializer class. You also need to ensure that the XML output contains an element for all public fields in the class hierarchy. What should you do?
A. Insert the following code between lines 1 and 2 of the code segment: [XmlArrayItem(Type =
typeof(Employee))] [XmlArrayItem(Type = typeof(Manager))]
B. Insert the following code between lines 1 and 2 of the code segment: [XmlElement(Type =
typeof(Employees))]
C. Insert the following code between lines 1 and 2 of the code segment:
[XmlArray(ElementName="Employees")]
D. Insert the following code between lines 3 and 4 of the code segment: [XmlElement(Type =
typeof(Employee))] andInsert the following code between lines 6 and 7 of the code
segment: [XmlElement(Type = typeof(Manager))]
Answer: A

Q: 7 You create an application for your business partners to submit purchase orders. The application deserializes XML documents sent by your partners into instances of an object named PurchaseOrder.
You need to modify the application so that it collects details if the deserialization process encounters any XML content that fails to map to public members of the PurchaseOrder object. What should you do?
A. Define and implement an event handler for the XmlSerializer.UnknownNode event.
B. Define a class that inherits from XmlSerializer and overrides the XmlSerialize.FromMappings method.
C. Apply an XmlInclude attribute to the PurchaseOrder class definition.
D. Apply an XmlIgnore attribute to the PurchaseOrder class definition.
Answer: A

Q: 8 You are creating an application that provides information about the local computer. The application contains a form that lists each logical drive along with the drive properties,such as type,volume label,and capacity.
You need to write a procedure that retrieves properties of each logical drive on the local computer.
What should you do?

To answer, move the three appropriate actions from the list of actions to the answer area and arrange them in the correct order.
Answer:

Q: 9 You are writing a method to compress an array of bytes. The bytes to be compressed are passed to the method in a parameter named document. You need to compress the contents of the incoming parameter. Which code segment should you use?
A. MemoryStream inStream = new MemoryStream(document);GZipStream zipStream = new
GZipStream(inStream, CompressionMode.Compress); byte[] result = new
byte[document.Length];zipStream.Write(result, 0, result.Length); return result;
B. MemoryStream stream = new MemoryStream(document);GZipStream zipStream = new
GZipStream(stream, CompressionMode.Compress);zipStream.Write(document, 0,
document.Length);zipStream.Close();return stream.ToArray();
C. MemoryStream outStream = new MemoryStream();GZipStream zipStream = new GZipStream(outStream,
CompressionMode.Compress);zipStream.Write(document, 0,
document.Length);zipStream.Close();return outStream.ToArray();
D. MemoryStream inStream = new MemoryStream(document);GZipStream zipStream = new
GZipStream(inStream, CompressionMode.Compress); MemoryStream outStream = new
MemoryStream();int b;while ((b = zipStream.ReadByte()) != -1) { outStream.WriteByte((byte)b);} return
outStream.ToArray();
Answer: C

Q: 10 You are creating a class that performs complex financial calculations. The class contains a method named GetCurrentRate that retrieves the current interest rate and a variable named currRate that stores the current interest rate. You write serialized representations of the class. You need to write a code segment that updates the currRate variable with the current interest rate when an instance of the class is deserialized. Which code segment should you use?
A. [OnSerializing]internal void UpdateValue (StreamingContext context) { currRate = GetCurrentRate();}
B. [OnSerializing]internal void UpdateValue(SerializationInfo info) { info.AddValue("currentRate",
GetCurrentRate());}
C. [OnDeserializing]internal void UpdateValue(SerializationInfo info) { info.AddValue("currentRate",
GetCurrentRate());}
D. [OnDeserialized]internal void UpdateValue(StreamingContext context) { currRate = GetCurrentRate();}
Answer: D

Q: 11 You are using the Microsoft Visual Studio 2005 IDE to examine the output of a method that returns a string. You assign the output of the method to a string variable named fName.
You need to write a code segment that prints the following on a single line
The message: "Test Failed: "
The value of fName if the value of fName does not equal "John"
You also need to ensure that the code segment simultaneously facilitates uninterrupted execution of the application. Which code segment should you use?
A. Debug.Assert(fName == "John", "Test Failed: ", fName);
B. Debug.WriteLineIf(fName != "John", fName, "Test Failed");
C. if (fName != "John") { Debug.Print("Test Failed: "); Debug.Print(fName); }
D. if (fName != "John") { Debug.WriteLine("Test Failed: "); Debug.WriteLine(fName); }
Answer: B

Q: 12 You are writing code for user authentication and authorization. The username, password, and roles are stored in your application data store. You need to establish a user security context that will be used for authorization checks such as IsInRole. You write the following code segment to authorize the user.
if (!TestPassword(userName, password))
throw new Exception("could not authenticate user");
String[] userRolesArray = LookupUserRoles(userName);
You need to complete this code so that it establishes the user security context. Which code segment should you use?
A. GenericIdentity ident = new GenericIdentity(userName);GenericPrincipal currentUser = new
GenericPrincipal(ident, userRolesArray);Thread.CurrentPrincipal = currentUser;
B. WindowsIdentity ident = new WindowsIdentity(userName);WindowsPrincipal currentUser = new
WindowsPrincipal(ident);Thread.CurrentPrincipal = currentUser;
C. NTAccount userNTName = new NTAccount(userName);GenericIdentity ident = new
GenericIdentity(userNTName.Value);GenericPrincipal currentUser= new GenericPrincipal(ident,
userRolesArray);Thread.CurrentPrincipal = currentUser;
D. IntPtr token = IntPtr.Zero;token = LogonUserUsingInterop(userName,
encryptedPassword);WindowsImpersonationContext ctx = WindowsIdentity.Impersonate(token);
Answer: A

Q: 13 You need to write a code segment that will add a string named strConn to the connection string section of the application configuration file. Which code segment should you use?
A. Configuration myConfig = ConfigurationManager.OpenExeConfiguration(
ConfigurationUserLevel.None);myConfig.ConnectionStrings.ConnectionStrings.Add( new
ConnectionStringSettings("ConnStr1", strConn));myConfig.Save();
B. Configuration myConfig = ConfigurationManager.OpenExeConfiguration(
ConfigurationUserLevel.None);myConfig.ConnectionStrings.ConnectionStrings.Add( new
ConnectionStringSettings("ConnStr1", strConn));ConfigurationManager.RefreshSection( "ConnectionStrings");
C. ConfigurationManager.ConnectionStrings.Add( new ConnectionStringSettings("ConnStr1",
strConn));ConfigurationManager.RefreshSection( "ConnectionStrings");
D. ConfigurationManager.ConnectionStrings.Add( new ConnectionStringSettings("ConnStr1",
strConn));Configuration myConfig = ConfigurationManager.OpenExeConfiguration(
ConfigurationUserLevel.None);myConfig.Save();
Answer: A

Q: 14 You are developing an application that stores data about your company's sales and technical support teams. You need to ensure that the name and contact information for each person is available as a single collection when a user queries details about a specific team. You also need to ensure that the data collection guarantees type safety. Which code segment should you use?
A. Hashtable team = new Hashtable();team.Add(1, "Hance");team.Add(2, "Jim");team.Add(3,
"Hanif");team.Add(4, "Kerim");team.Add(5, "Alex");team.Add(6, "Mark");team.Add(7,
"Roger");team.Add(8, "Tommy");
B. ArrayList team = new ArrayList(); team.Add("1, Hance");team.Add("2, Jim");team.Add("3,
Hanif");team.Add("4, Kerim");team.Add("5, Alex");team.Add("6, Mark");team.Add("7,
Roger");team.Add("8, Tommy");
C. Dictionary<int, string> team = new Dictionary<int, string>(); team.Add(1, "Hance");team.Add(2,"Jim");team.Add(3, "Hanif");team.Add(4, "Kerim");team.Add(5, "Alex");team.Add(6,"Mark");team.Add(7, "Roger");team.Add(8, "Tommy");
D. string[] team = new string[] {"1, Hance", "2, Jim", "3, Hanif", "4, Kerim", "5, Alex", "6, Mark", "7, Roger", "8, Tommy"};
Answer: C

Q: 15 You are creating a class that uses unmanaged resources. This class maintains references to managed resources on other objects. You need to ensure that users of this class can explicitly release resources when the class instance ceases to be needed. Which three actions should you perform? (Each correct answer presents part of the solution. Choose three.)
A. Define the class such that it inherits from the WeakReference class.
B. Define the class such that it implements the IDisposable interface.
C. Create a class destructor that calls methods on other objects to release the managed resources.
D. Create a class destructor that releases the unmanaged resources.
E. Create a Dispose method that calls System.GC.Collect to force garbage collection.
F. Create a Dispose method that releases unmanaged resources and calls methods on other objects to release the managed resources.
Answer: B, D, F


© 2014 Cheat-Test.com, All Rights Reserved