70-483 Exam - Programming in C#

certleader.com

Q1. - (Topic 1) 

You have the following code (line numbers are included for reference only): 

You need to identify the missing line of code at line 15. Which line of code should you identify? 

A. using (fooSqlConn.BeginTransaction()) 

B. while (fooSqlReader.Read()) 

C. while (fooSqlReader.NextResult()) 

D. while (fooSqlReader.GetBoolean(0)) 

Answer:

Q2. - (Topic 1) 

You use the Task.Run() method to launch a long-running data processing operation. The data processing operation often fails in times of heavy network congestion. 

If the data processing operation fails, a second operation must clean up any results of the first operation. 

You need to ensure that the second operation is invoked only if the data processing operation throws an unhandled exception. 

What should you do? 

A. Create a TaskCompletionSource<T> object and call the TrySetException() method of the object. 

B. Create a task by calling the Task.ContinueWith() method. 

C. Examine the Task.Status property immediately after the call to the Task.Run() method. 

D. Create a task inside the existing Task.Run() method by using the AttachedToParent option. 

Answer:

Q3. DRAG DROP - (Topic 1) 

You are developing a class named ExtensionMethods. 

You need to ensure that the ExtensionMethods class implements the IsEmail() method on string objects. 

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 2) 

You write the following method (line numbers are included for reference only): 

You need to ensure that the method extracts a list of URLs that match the following pattern: 

@http://(www\.)?([^\.]+)\.com; 

Which code should you insert at line 07? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Explanation: * MatchCollection Represents the set of successful matches found by iteratively applying a regular expression pattern to the input string. The collection is immutable (read-only) and has no public constructor. The Regex.Matches method returns a MatchCollection object. 

* List<T>.Add Method Adds an object to the end of the List<T>. Incorrect: Not D: ICollection.SyncRoot Property For collections whose underlying store is not publicly available, the expected implementation is to return the current instance. Note that the pointer to the current instance might not be sufficient for collections that wrap other collections; those should return the underlying collection's SyncRoot property. 

Q5. - (Topic 2) 

You are modifying an existing application. 

The application includes a Loan class and a Customer class. The following code segment defines the classes. 

You populate a collection named customer-Collection with Customer and Loan objects by using the following code segment: 

You create a largeCustomerLoans collection to store the Loan objects by using the following code segment: 

Collection<Loan> largeCustomerLoans = new Collection<Loan>(); 

All loans with an Amount value greater than or equal to 4000 must be tracked. 

You need to populate the largeCustomerLoans collection with Loan objects. 

Which code segment should you use? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Explanation: Must add to the largeCustomerLoans collection, not the customerLoanCollection. 

We iterate through each customer in customerCollection and check each loan belonging to this customer. 

Q6. - (Topic 1) 

You are developing an application by using C#. 

The application includes an object that performs a long running process. 

You need to ensure that the garbage collector does not release the object's resources until 

the process completes. 

Which garbage collector method should you use? 

A. RemoveMemoryPressure() 

B. ReRegisterForFinalize() 

C. WaitForFullGCComplete() 

D. KeepAlive() 

Answer:

Q7. - (Topic 1) 

You are modifying an application that processes leases. The following code defines the Lease class. (Line numbers are included for reference only.) 

Leases are restricted to a maximum term of 5 years. The application must send a notification message if a lease request exceeds 5 years. 

You need to implement the notification mechanism. 

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 

E. Option E 

F. Option F 

Answer: A,B 

Q8. DRAG DROP - (Topic 2) 

You are developing an application that will write data to a file. The application includes the following code segment. (Line numbers are included for reference only.) 

You need to ensure that the WriteData() method will write data to a file. 

Which four code segments should you insert in sequence at line 03? (To answer, move the appropriate code segments from the list of code segments to the answer area and arrange them in the correct order.) 

Answer:  

Q9. DRAG DROP - (Topic 1) 

You are developing an application that includes a class named Warehouse. The Warehouse class includes a static property named Inventory- The Warehouse class is defined by the following code segment. (Line numbers are included for reference only.) 

You have the following requirements: 

Initialize the _inventory field to an Inventory instance. 

Initialize the _inventory field only once. 

Ensure that the application code acquires a lock only when the _inventory object must be instantiated. 

You need to meet the requirements. 

Which three code segments should you insert in sequence at line 09? (To answer, move the appropriate code segments from the list of code segments to the answer area and arrange them in the correct order.) 

Answer:  

Q10. - (Topic 1) 

You are developing an application that uses the Microsoft ADO.NET Entity Framework to retrieve order information from a Microsoft SQL Server database. The application includes the following code. (Line numbers are included for reference only.) 

The application must meet the following requirements: 

. Return only orders that have an OrderDate value other than null. 

. Return only orders that were placed in the year specified in the year parameter. 

You need to ensure that the application meets the requirements. Which code segment should you insert at line 08? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer: