Q1. - (Topic 1)
You are developing an application that will transmit large amounts of data between a client computer and a server. You need to ensure the validity of the data by using a cryptographic hashing algorithm. Which algorithm should you use?
A. RSA
B. HMACSHA2S6
C. Aes
D. RNGCryptoServiceProvider
Answer: B
Q2. - (Topic 2)
You are creating a class library that will be used in a web application.
You need to ensure that the class library assembly is strongly named.
What should you do?
A. Use the csc.exe /target:Library option when building the application.
B. Use the AL.exe command-line tool.
C. Use the aspnet_regiis.exe command-line tool.
D. Use the EdmGen.exe command-line tool.
Answer: B
Explanation: The Windows Software Development Kit (SDK) provides several ways to sign an assembly with a strong name:
* Using the Assembly Linker (Al.exe) provided by the Windows SDK.
* Using assembly attributes to insert the strong name information in your code. You can use either the AssemblyKeyFileAttribute or the AssemblyKeyNameAttribute, depending on where the key file to be used is located.
* Using compiler options such /keyfile or /delaysign in C# and Visual Basic, or the
/KEYFILE or /DELAYSIGN linker option in C++. (For information on delay signing, see
Delay Signing an Assembly.)
Note:
* A strong name consists of the assembly's identity—it’s simple text name, version number, and culture information (if provided)—plus a public key and a digital signature. It is generated from an assembly file (the file that contains the assembly manifest, which in turn contains the names and hashes of all the files that make up the assembly), using the corresponding private key. Microsoft. Visual Studio. .NET and other development tools provided in the .NET Framework SDK can assign strong names to an assembly.
Assemblies with the same strong name are expected to be identical.
Q3. DRAG DROP - (Topic 1)
You are developing an application that includes a class named Customer.
The application will output the Customer class as a structured XML document by using the following code segment:
You need to ensure that the Customer class will serialize to XML.
How should you complete the relevant code? (To answer, drag the appropriate code segments to the correct locations in the answer area. Each code segment may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.)
Answer:
Q4. - (Topic 1)
An application receives JSON data in the following format:
The application includes the following code segment. (Line numbers are included for reference only.)
You need to ensure that the ConvertToName() method returns the JSON input string as a Name object.
Which code segment should you insert at line 10?
A. Return ser.Desenalize (json, typeof(Name));
B. Return ser.ConvertToType<Name>(json);
C. Return ser.Deserialize<Name>(json);
D. Return ser.ConvertToType (json, typeof (Name));
Answer: C
Q5. - (Topic 2)
You are developing an application that will use multiple asynchronous tasks to optimize performance.
You create three tasks by using the following code segment. (Line numbers are included for reference only.)
You need to ensure that the ProcessTasks() method waits until all three tasks complete before continuing.
Which code segment should you insert at line 09?
A. Task.WaitFor(3);
B. tasks.Yield();
C. tasks.WaitForCompletion();
D. Task.WaitAll(tasks);
Answer: D
Q6. - (Topic 1)
You are developing an application by using C#. The application includes the following code segment. (Line numbers are included for reference only.)
The DoWork() method must not throw any exceptions when converting the obj object to the IDataContainer interface or when accessing the Data property.
You need to meet the requirements. Which code segment should you insert at line 07?
A. var dataContainer = (IDataContainer)obj;
B. dynamic dataContainer = obj;
C. var dataContainer = obj is IDataContainer;
D. var dataContainer = obj as IDataContainer;
Answer: D
Explanation:
As - The as operator is like a cast operation. However, if the conversion isn't possible, as returns null instead of raising an exception. http://msdn.microsoft.com/en-us/library/cscsdfbt(v=vs.110).aspx
Q7. DRAG DROP - (Topic 2)
You have an application that accesses a Microsoft SQL Server database.
The database contains a stored procedure named Proc1. Proc1 accesses several rows of data across multiple tables.
You need to ensure that after Proc1 executes, the database is left in a consistent state. While Proc1 executes, no other operation can modify data already read or changed by Proc1. (Develop the solution by selecting and ordering the required code snippets.
You may not need all of the code snippets.)
Answer:
Q8. - (Topic 1)
You are creating a class named Employee. The class exposes a string property named EmployeeType. The following code segment defines the Employee class. (Line numbers are included for reference only.)
The EmployeeType property value must meet the following requirements:
. The value must be accessed only by code within the Employee class or within a class derived from the Employee class. . The value must be modified only by code within the Employee class.
You need to ensure that the implementation of the EmployeeType property meets the requirements.
Which two actions should you perform? (Each correct answer represents part of the complete solution. Choose two.)
A. Replace line 03 with the following code segment: public string EmployeeType
B. Replace line 06 with the following code segment: protected set;
C. Replace line 05 with the following code segment: private get;
D. Replace line 05 with the following code segment: protected get;
E. Replace line 03 with the following code segment: protected string EmployeeType
F. Replace line 06 with the following code segment: private set;
Answer: E,F
Q9. - (Topic 1)
You are developing an application that includes the following code segment. (Line numbers are included for reference only.)
The GetAnimals() method must meet the following requirements:
Connect to a Microsoft SQL Server database.
Create Animal objects and populate them with data from the database.
Return a sequence of populated Animal objects.
You need to meet the requirements.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
A. Insert the following code segment at line 16: while(sqlDataReader.NextResult())
B. Insert the following code segment at line 13: sqlConnection.Open();
C. Insert the following code segment at line 13: sqlConnection.BeginTransaction();
D. Insert the following code segment at line 16: while(sqlDataReader.Read())
E. Insert the following code segment at line 16: while(sqlDataReader.GetValues())
Answer: B,D
Explanation:
SqlConnection.Open - Opens a database connection with the property settings specified by the ConnectionString. http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.open.aspx SqlDataReader.Read - Advances the SqlDataReader to the next record. http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldatareader.read.aspx
Q10. - (Topic 1)
An application receives JSON data in the following format:
The application includes the following code segment. (Line numbers are included for reference only.)
You need to ensure that the ConvertToName() method returns the JSON input string as a Name object.
Which code segment should you insert at line 10?
A. Return ser.ConvertToType<Name>(json);
B. Return ser.DeserializeObject(json);
C. Return ser.Deserialize<Name>(json);
D. Return (Name)ser.Serialize(json);
Answer: C
Explanation:
JavaScriptSerializer.Deserialize<T> - Converts the specified JSON string to an object of type T. http://msdn.microsoft.com/en-us/library/bb355316.aspx