70-483 Premium Bundle

70-483 Premium Bundle

Programming in C# Certification Exam

4.5 
(1260 ratings)
0 QuestionsPractice Tests
0 PDFPrint version
November 23, 2024Last update

Microsoft 70-483 Free Practice Questions

Q1. - (Topic 1) 

You are developing an application that uses structured exception handling. The application includes a class named ExceptionLogger. 

The ExceptionLogger class implements a method named LogException by using the following code segment: 

public static void LogException(Exception ex) 

You have the following requirements: . Log all exceptions by using the LogException() method of the ExceptionLogger class. . Rethrow the original exception, including the entire exception stack. You need to meet the requirements. 

Which code segment should you use? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Explanation: 

Once an exception is thrown, part of the information it carries is the stack trace. The stack trace is a list of the method call hierarchy that starts with the method that throws the exception and ends with the method that catches the exception. If an exception is re-thrown by specifying the exception in the throw statement, the stack trace is restarted at the current method and the list of method calls between the original method that threw the exception and the current method is lost. To keep the original stack trace information with the exception, use the throw statement without specifying the exception. 

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

Q2. - (Topic 2) 

You are implementing a new method named ProcessData. The ProcessData() method calls a third-party component that performs a long-running operation to retrieve stock information from a web service. 

The third-party component uses the IAsyncResult pattern to signal completion of the long-running operation so that the UI can be updated with the new values. 

You need to ensure that the calling code handles the long-running operation as a System.Threading.Tasks.Task object to avoid blocking the UI thread. 

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

A. Create a TaskCompletionSource<T> object. 

B. Call the component by using the TaskFactory.FromAsync() method. 

C. Apply the following attribute to the ProcessData() method signature: [Methodlmpl(MethodlmplOptions.Synchronized)] 

D. Apply the async modifier to the ProcessData() method signature. 

Answer: A,B 

Explanation: A: In many scenarios, it is useful to enable a Task<TResult> to represent an external asynchronous operation. TaskCompletionSource<TResult> is provided for this purpose. It enables the creation of a task that can be handed out to consumers, and those consumers can use the members of the task as they would any other. However, unlike most tasks, the state of a task created by a TaskCompletionSource is controlled explicitly by the methods on TaskCompletionSource. This enables the completion of the external asynchronous operation to be propagated to the underlying Task. The separation also ensures that consumers are not able to transition the state without access to the corresponding TaskCompletionSource. 

B: TaskFactory.FromAsync Method 

Creates a Task that represents a pair of begin and end methods that conform to the 

Asynchronous Programming Model pattern. Overloaded. 

Example: 

TaskFactory.FromAsync Method (IAsyncResult, Action<IAsyncResult>) 

Creates a Task that executes an end method action when a specified IAsyncResult completes. 

Note: 

* System.Threading.Tasks.Task Represents an asynchronous operation. 

Q3. - (Topic 2) 

You are developing an application that includes methods named EvaluateLoan, ProcessLoan, and FundLoan. The application defines build configurations named TRIAL, BASIC, and ADVANCED. 

You have the following requirements: 

The TRIAL build configuration must run only the EvaluateLoan() method. 

The BASIC build configuration must run all three methods. 

The ADVANCED build configuration must run only the EvaluateLoan() and 

ProcessLoan() methods. 

You need to meet the requirements. 

Which code segment should you use? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Q4. DRAG DROP - (Topic 1) 

You are developing an application by using C#. The application includes an array of decimal values named loanAmounts. You are developing a LINQ query to return the values from the array. 

The query must return decimal values that are evenly divisible by two. The values must be sorted from the lowest value to the highest value. 

You need to ensure that the query correctly returns the decimal values. 

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:  

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

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 

Q6. - (Topic 2) 

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

What should you use? 

A. Method overloading 

B. Interface 

C. Named parameters 

D. Lambda expressions 

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. 

START 70-483 EXAM