Q1. - (Topic 2)
You are developing an application that includes a class named Customer and a generic list of customers. The following code segment declares the list of customers:
List<Customer> customersList = new List<Customer> () ;
You populate the customersList object with several hundred Customer objects.
The application must display the data for five Customer objects at a time.
You need to create a method that will return the correct number of Customer objects.
Which code segment should you use?
A. Option A
B. Option B
C. Option C
D. Option D
Answer: A
Q2. - (Topic 1)
You are developing an application that uses a .config file.
The relevant portion of the .config file is shown as follows:
You need to ensure that diagnostic data for the application writes to the event tog by using the configuration specified in the .config file.
What should you include in the application code?
A. Option A
B. Option B
C. Option C
D. Option D
Answer: D
Q3. - (Topic 2)
You need to write a method that retrieves data from a Microsoft Access 2013 database. The method must meet the following requirements:
Be read-only.
Be able to use the data before the entire data set is retrieved.
Minimize the amount of system overhead and the amount of memory usage.
Which type of object should you use in the method?
A. DbDataAdapter
B. unTyped DataSet
C. OleDbDataAdapter
D. DbDataReader
Answer: D
Explanation: The DbDataReader class reads a forward-only stream of rows from a data source.
Reference: DbDataReader Class
https://msdn.microsoft.com/en-us/library/system.data.common.dbdatareader(v=vs.110).aspx
Q4. - (Topic 1)
You have a List object that is generated by executing the following code:
You have a method that contains the following code (line numbers are included for reference only):
You need to alter the method to use a lambda statement. How should you rewrite lines 03 through 06 of the method?
A. Option A
B. Option B
C. Option C
D. Option D
Answer: C
Q5. - (Topic 2)
You are creating a console application named Appl.
App1 retrieves data from the Internet by using JavaScript Object Notation (JSON).
You are developing the following code segment (line numbers are included for reference only):
You need to ensure that the code validates the JSON string. Which code should you insert at line 03?
A. Option A
B. Option B
C. Option C
D. Option D
Answer: B
Explanation: JavaScriptSerializer().Deserialize
Converts the specified JSON string to an object of type T.
Example:
string json = File.ReadAllText(Environment.CurrentDirectory + @"\JSON.txt");
Company company = new
System.Web.Script.Serialization.JavaScriptSerializer().Deserialize<Company>(
Reference: C# - serialize object to JSON format using JavaScriptSerializer
http://matijabozicevic.com/blog/csharp-net-development/csharp-serialize-object-to-json-format-using-javascriptserialization
Q6. - (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
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 2)
You are developing an application that includes methods named ConvertAmount and TransferFunds.
You need to ensure that the precision and range of the value in the amount variable is not lost when the TransferFunds() method is called.
Which code segment should you use?
A. Option A
B. Option B
C. Option C
D. Option D
Answer: A
Explanation: The double keyword signifies a simple type that stores 64-bit floating-point values.
The float keyword signifies a simple type that stores 32-bit floating-point values.
Reference: double (C# Reference)
Q9. DRAG DROP - (Topic 1)
You have a method named GetCustomerIDs that returns a list of integers. Each entry in the list represents a customer ID that is retrieved from a list named Customers. The Customers list contains 1,000 rows.
Another developer creates a method named ValidateCustomer that accepts an integer parameter and returns a Boolean value. ValidateCustomer returns true if the integer provided references a valid customer. ValidateCustomer can take up to one second to run.
You need to create a method that returns a list of valid customer IDs. The code must execute in the shortest amount of time.
What should you do? (Develop the solution by selecting and ordering the required code snippets. You may not need all of the code snippets.)
Answer:
Q10. - (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.