70-483 Premium Bundle

70-483 Premium Bundle

Programming in C# Certification Exam

4.5 
(10365 ratings)
0 QuestionsPractice Tests
0 PDFPrint version
November 21, 2024Last update

Microsoft 70-483 Free Practice Questions

Q1. - (Topic 1) 

You are adding a public method named UpdateGrade to a public class named ReportCard. 

The code region that updates the grade field must meet the following requirements: . It must be accessed by only one thread at a time. . It must not be vulnerable to a deadlock situation. You need to implement the UpdateGrade() method. 

What should you do? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Q2. - (Topic 1) 

You are creating an application that manages information about zoo animals. The application includes a class named Animal and a method named Save. 

The Save() method must be strongly typed. It must allow only types inherited from the Animal class that uses a constructor that accepts no parameters. 

You need to implement the Save() method. Which code segment should you use? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Explanation: 

When you define a generic class, you can apply restrictions to the kinds of types that client code can use for type arguments when it instantiates your class. If client code tries to instantiate your class by using a type that is not allowed by a constraint, the result is a compile-time error. These restrictions are called constraints. Constraints are specified by using the where contextual keyword. http://msdn.microsoft.com/en-us/library/d5x73970.aspx 

Q3. - (Topic 1) 

You are implementing a method named FloorTemperature that performs conversions between value types and reference types. The following code segment implements the method. (Line numbers are included for reference only.) 

You need to ensure that the application does not throw exceptions on invalid conversions. Which code segment should you insert at line 04? 

A. int result = (int)degreesRef; 

B. int result = (int)(double)degreesRef; 

C. int result = degreesRef; 

D. int result = (int)(float)degreesRef; 

Answer:

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

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. 

Q5. DRAG DROP - (Topic 1) 

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

You have the following requirements: 

Initialize the _catalog field to a Catalog instance. 

Initialize the _catalog field only once. 

Ensure that the application code acquires a lock only when the _catalog 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:  

Q6. - (Topic 1) 

You are developing an application by using C#. 

You have the following requirements: 

Support 32-bit and 64-bit system configurations. 

Include pre-processor directives that are specific to the system configuration. 

Deploy an application version that includes both system configurations to testers. 

Ensure that stack traces include accurate line numbers. 

You need to configure the project to avoid changing individual configuration settings every time you deploy the application to testers. 

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

A. Update the platform target and conditional compilation symbols for each application configuration. 

B. Create two application configurations based on the default Release configuration. 

C. Optimize the application through address rebasing in the 64-bit configuration. 

D. Create two application configurations based on the default Debug configuration. 

Answer: B,D 

Q7. - (Topic 2) 

You are developing an application that retrieves patient data from a web service. The application stores the JSON messages returned from the web service in a string variable named PatientAsJson. The variable is encoded as UTF-8. The application includes a class named Patient that is defined by the following code: 

You need to populate the Patient class with the data returned from the web service. Which code segment should you use? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

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

Q9. - (Topic 2) 

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. Option A 

B. Option B 

C. Option C 

D. Option D 

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. 

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

Q11. HOTSPOT - (Topic 1) 

You are implementing a library method that accepts a character parameter and returns a string. 

If the lookup succeeds, the method must return the corresponding string value. If the lookup fails, the method must return the value "invalid choice." 

You need to implement the lookup algorithm. 

How should you complete the relevant code? (To answer, select the correct keyword in each drop-down list in the answer area.) 

Answer:  

Q12. - (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.ConvertToType<Name>(json); 

B. Return ser.DeserializeObject(json); 

C. Return ser.Deserialize<Name>(json); 

D. Return (Name)ser.Serialize(json); 

Answer:

Explanation: 

JavaScriptSerializer.Deserialize<T> - Converts the specified JSON string to an object of type T. http://msdn.microsoft.com/en-us/library/bb355316.aspx 

Q13. DRAG DROP - (Topic 2) 

You are developing a class named Temperature. 

You need to ensure that collections of Temperature objects are sortable. 

You have the following code: 

Which code segments should you include in Target 1, Target 2 and Target 3 to complete the code? (To answer, drag the appropriate code segments to the correct targets 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:  

Q14. - (Topic 2) 

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

You need to ensure that CreateObject compiles successfully. 

What should you do? 

A. Insert the following code at line 02: where T : new() 

B. Replace line 01 with the following code: public void CreateObject<T>() 

C. Replace line 01 with the following code: public Object CreateObject<T>() 

D. Insert the following code at line 02: where T : Object 

Answer:

Q15. - (Topic 2) 

You are implementing a new method named ProcessData. The ProcessData() method calls a third-party component that performs a long-running operation. 

The third-party component uses the IAsyncResult pattern to signal completion of the long-running operation. 

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

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

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

B. Create a TaskCompletionSource<T> object. 

C. Apply the async modifier to the method signature. 

D. Apply the following attribute to the method signature: [MethodImpl(MethodImplOptions.Synchronized)] 

Answer: A,B 

Explanation: A: 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. 

B: 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. 

Note: 

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

START 70-483 EXAM