70-483 Exam - Programming in C#

certleader.com

Q1. - (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 

Q2. DRAG DROP - (Topic 1) 

You are developing an application that will include a method named GetData. The GetData() method will retrieve several lines of data from a web service by using a System.IO.StreamReader object. 

You have the following requirements: 

. The GetData() method must return a string value that contains the entire response from the web service. . The application must remain responsive while the GetData() method runs. 

You need to implement the GetData() method. 

How should you complete the relevant code? (To answer, drag the appropriate objects to the correct locations in the answer area. Each object 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:  

Q3. DRAG DROP - (Topic 2) 

You are creating a method that saves information to a database. 

You have a static class named LogHelper. LogHelper has a method named Log to log the exception. 

You need to use the LogHelper Log method to log the exception raised by the database server. The solution must ensure that the exception can be caught by the calling method, while preserving the original stack trace. 

How should you write the catch block? (Develop the solution by selecting and ordering the required code snippets. You may not need all of the code snippets.) 

Answer:  

Q4. DRAG DROP - (Topic 2) 

You have the following code. 

You need to return all of the products and their associated categories. 

How should you complete the code? To answer, drag the appropriate code elements to the correct targets in the answer area. Each code element 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:  

Q5. - (Topic 2) 

You are developing an application that contains a class named TheaterCustomer and a method named ProcessTheaterCustomer. The ProcessTheaterCustomer() method accepts a TheaterCustomer object as the input parameter. 

You have the following requirements: 

. Store the TheaterCustomer objects in a collection. 

. Ensure that the ProcessTheaterCustomer() method processes the TheaterCustomer objects in the reverse order in which they are placed into the collection. 

You need to meet the requirements. 

What should you do? 

A. Create a System.Collections.Queue collection. Use the Enqueue() method to add TheaterCustomer objects to the collection. Use the Dequeue() method to pass the objects to the ProcessTheaterCustomer() method. 

B. Create a System.Collections.ArrayList collection. Use the Insert() method to add TheaterCustomer objects to the collection. Use the Remove() method to pass the objects to the ProcessTheaterCustomer() method. 

C. Create a System.Collections.Stack collection. Use the Push() method to add TheaterCustomer objects to the collection. Use the Pop() method to pass the objects to the ProcessTheaterCustomer() method. 

D. Create a System.Collections.Queue collection. Use the Enqueue() method to add TheaterCustomer objects to the collection. Use the Peek() method to pass the objects to the ProcessTheaterCustomer() method. 

Answer:

Explanation: A stack is the appropriate collection here. In computer science, a stack or LIFO (last in, first out) is an abstract data type that serves as a collection of elements, with two principal operations: push, which adds an element to the collection, and pop, which removes the last element that was added. 

Reference: https://en.wikipedia.org/wiki/Stack_(abstract_data_type) 

Q6. - (Topic 1) 

You are developing an application. The application includes classes named Employee and Person and an interface named IPerson. 

The Employee class must meet the following requirements: 

. It must either inherit from the Person class or implement the IPerson interface. . It must be inheritable by other classes in the application. 

You need to ensure that the Employee class meets the requirements. 

Which two code segments can you use to achieve this goal? (Each correct answer presents a complete solution. Choose two.) 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer: B,D 

Explanation: 

Sealed - When applied to a class, the sealed modifier prevents other classes from inheriting from it. http://msdn.microsoft.com/en-us/library/88c54tsw(v=vs.110).aspx 

Q7. - (Topic 2) 

You are developing an application by using C#. The application will write events to an event log. You plan to deploy the application to a server. 

You create an event source named MySource and a custom log named MyLog on the server. 

You need to write events to the custom log. Which code segment should you use? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Q8. HOTSPOT - (Topic 2) 

You have an existing order processing system that accepts .xml files, 

The following code shows an example of a properly formatted order in XML: 

You create the following class that will be serialized: 

For each of the following properties, select Yes if the property is serialized according to the defined schema. Otherwise, select No. 

Answer:  

Q9. HOTSPOT - (Topic 2) 

You define a class by using the following code: You write the following code for a method (line numbers are included for reference only): 

To answer, complete each statement according to the information presented in the code. 

Answer:  

Q10. - (Topic 1) 

An application will upload data by using HTML form-based encoding. The application uses a method named SendMessage. 

The SendMessage() method includes the following code. (Line numbers are included for reference only.) 

The receiving URL accepts parameters as form-encoded values. 

You need to send the values intA and intB as form-encoded values named a and b, 

respectively. 

Which code segment should you insert at line 04? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Explanation: 

WebClient.UploadValuesTaskAsync - Uploads the specified name/value collection to the resource identified by the specified URI as an asynchronous operation using a task object. These methods do not block the calling thread. http://msdn.microsoft.com/en-us/library/system.net.webclient.uploadvaluestaskasync.aspx