70-483 Exam - Programming in C#

certleader.com

Q1. - (Topic 1) 

You are developing an application by using C#. You provide a public key to the development team during development. 

You need to specify that the assembly is not fully signed when it is built. 

Which two assembly attributes should you include in the source code? (Each correct answer presents part of the solution. Choose two.) 

A. AssemblyKeyNameAttribute 

B. ObfuscateAssemblyAttribute 

C. AssemblyDelaySignAttribute 

D. AssemblyKeyFileAttribute 

Answer: C,D 

Explanation: 

http://msdn.microsoft.com/en-us/library/t07a3dye(v=vs.110).aspx 

Q2. - (Topic 2) 

An application is throwing unhandled NullReferenceException and FormatException errors. The stack trace shows that the exceptions occur in the GetWebResult() method. 

The application includes the following code to parse XML data retrieved from a web service. (Line numbers are included for reference only.) 

You need to handle the exceptions without interfering with the existing error-handling infrastructure. 

Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.) 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer: A,C 

Explanation: A: The TryParse method is like the Parse method, except the TryParse method does not throw an exception if the conversion fails. It eliminates the need to use exception handling to test for a FormatException in the event that s is invalid and cannot be successfully parsed. 

C: UnhandledException event handler If the UnhandledException event is handled in the default application domain, it is raised there for any unhandled exception in any thread, no matter what application domain the thread started in. If the thread started in an application domain that has an event handler for UnhandledException, the event is raised in that application domain. 

Q3. - (Topic 2) 

You are evaluating a method that calculates loan interest. The application includes the following code segment. (Line numbers are included for reference only.) 

When the loanTerm value is 5 and the loanAmount value is 4500, the loanRate must be set to 6.5 percent. 

You need to adjust the loanRate value to meet the requirements. 

What should you do? 

A. Replace line 15 with the following code segment: loanRate = 0.065m; 

B. Replace line 07 with the following code segment: loanRate = 0.065m; 

C. Replace line 17 with the following code segment: interestAmount = loanAmount * 0.065m * loanTerm; 

D. Replace line 04 with the following code segment: decimal loanRate = 0.065m; 

Answer:

Q4. - (Topic 2) 

You are developing an assembly. 

You plan to sign the assembly when the assembly is developed. 

You need to reserve space in the assembly for the signature. 

What should you do? 

A. Run the Assembly Linker tool from the Windows Software Development Kit (Windows SDK). 

B. Run the Strong Name tool from the Windows Software Development Kit (Windows SDK). 

C. Add the AssemblySignatureKeyAttribute attribute the assembly. 

D. Add the AssemblyDelaySignAttribute attribute to the assembly. 

Answer:

Q5. - (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 assembly attributes. 

B. Use the csc.exe /target:Library option when building the application. 

C. Use the xsd.exe command-line tool. 

D. Use the EdmGen.exe command-line tool. 

Answer:

Explanation: The Windows Software Development Kit (SDK) provides several ways to sign an assembly with a strong name: 

* (A) 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 the Assembly Linker (Al.exe) provided by the Windows SDK. 

* 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.) 

Q6. - (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:

Q7. - (Topic 2) 

You need to create a method that can be called by using a varying number of parameters. 

What should you use? 

A. derived classes 

B. interface 

C. enumeration 

D. method overloading 

Answer:

Explanation: Member overloading means creating two or more members on the same type that differ only in the number or type of parameters but have the same name. Overloading is one of the most important techniques for improving usability, productivity, and readability of reusable libraries. Overloading on the number of parameters makes it possible to provide simpler versions of constructors and methods. Overloading on the parameter type makes it possible to use the same member name for members performing identical operations on a selected set of different types. 

Q8. - (Topic 1) 

You are creating a console application named App1. 

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. DataContractSerializer serializer = new DataContractSerializer(); 

B. var serializer = new DataContractSerializer(); 

C. XmlSerlalizer serializer = new XmlSerlalizer(); 

D. var serializer = new JavaScriptSerializer(); 

Answer:

Explanation: The JavaScriptSerializer Class Provides serialization and deserialization functionality for AJAX-enabled applications. 

The JavaScriptSerializer class is used internally by the asynchronous communication layer to serialize and deserialize the data that is passed between the browser and the Web server. You cannot access that instance of the serializer. However, this class exposes a public API. Therefore, you can use the class when you want to work with JavaScript Object Notation (JSON) in managed code. 

Q9. - (Topic 2) 

You have the following code: 

You need to retrieve all of the numbers from the items variable that are greater than 80. Which code should you use? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Explanation: Example: All number larger than 15 from a list using the var query = from num in numbers... contstruct: 

var largeNumbersQuery = numbers2.Where(c => c > 15); 

Reference: How to: Write LINQ Queries in C# 

https://msdn.microsoft.com/en-us/library/bb397678.aspx 

Q10. HOTSPOT - (Topic 2) 

You have the following code: 

For each of the following statements, select Yes if the statement is true. Otherwise, select No. 

Answer: