70-483 Premium Bundle

70-483 Premium Bundle

Programming in C# Certification Exam

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

Microsoft 70-483 Free Practice Questions

Q1. - (Topic 1) 

You are creating an application that manages information about your company's products. The application includes a class named Product and a method named Save. 

The Save() method must be strongly typed. It must allow only types inherited from the Product class that use 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 

Q2. - (Topic 2) 

You plan to store passwords in a Windows Azure SQL Database database. 

You need to ensure that the passwords are stored in the database by using a hash algorithm, 

Which cryptographic algorithm should you use? 

A. ECDSA 

B. RSA-768 

C. AES-256 

D. SHA-256 

Answer:

Q3. DRAG DROP - (Topic 1) 

You are developing an application that implements a set of custom exception types. You declare the custom exception types by using the following code segments: 

The application includes a function named DoWork that throws .NET Framework exceptions and custom exceptions. 

The application contains only the following logging methods: 

The application must meet the following requirements: 

. When AdventureWorksValidationException exceptions are caught, log the information by using the static void Log (AdventureWorksValidationException ex) method. 

. When AdventureWorksDbException or other AdventureWorksException exceptions are caught, log the information by using the static void I oq( AdventureWorksException ex) method. 

You need to meet the requirements. 

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 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. ReRegisterForFinalize() 

B. SuppressFinalize() 

C. Collect() 

D. WaitForFullGCApproach() 

Answer:

Q5. HOTSPOT - (Topic 2) 

You define a class by using the following code: 

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

Answer:  

Q6. DRAG DROP - (Topic 1) 

You have the following class: 

You need to implement IEquatable. The Equals method must return true if both ID and Name are set to the identical values. Otherwise, the method must return false. Equals must not throw an exception. 

What should you do? (Develop the solution by selecting and ordering the required code snippets. You may not need all of the code snippets.) 

Answer:  

Q7. - (Topic 2) 

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

You need to ensure that if an exception occurs, the exception will be logged. Which code should you insert at line 28? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Explanation: * XmlWriterTraceListener 

Directs tracing or debugging output as XML-encoded data to a TextWriter or to a Stream, 

such as a FileStream. 

* TraceListener.TraceEvent Method (TraceEventCache, String, TraceEventType, Int32) Writes trace and event information to the listener specific output. 

Syntax: 

[ComVisibleAttribute(false)] 

public virtual void TraceEvent( 

TraceEventCache eventCache, 

string source, 

TraceEventType eventType, 

int id 

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

B. WaitForFullGCApproach() 

C. KeepAlive() 

D. WaitForPendingFinalizers() 

Answer:

Explanation: The GC.KeepAlive method references the specified object, which makes it ineligible for garbage collection from the start of the current routine to the point where this method is called. The purpose of the KeepAlive method is to ensure the existence of a reference to an object that is at risk of being prematurely reclaimed by the garbage collector. The KeepAlive method performs no operation and produces no side effects other than extending the lifetime of the object passed in as a parameter. 

Q9. - (Topic 2) 

You are developing an application that includes the following code segment: 

You need to implement both Start() methods in a derived class named UseStart that uses the Start() method of each interface. 

Which two code segments should you use? (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: B,E 

Explanation: B: 

* Implementing Multiple Interfaces 

A class can implement multiple interfaces using the following syntax: 

C# 

public class CDAndDVDComboPlayer : ICDPlayer, IDVDPlayer 

If a class implements more than one interface where there is ambiguity in the names of members, it is resolved using the full qualifier for the property or method name. In other words, the derived class can resolve the conflict by using the fully qualified name for the method to indicate to which interface it belongs 

* In C#, both inheritance and interface implementation are defined by the : operator, equivalent to extends and implements in Java. The base class should always be leftmost in the class declaration. 

Q10. - (Topic 1) 

An application includes a class named Person. The Person class includes a method named GetData. 

You need to ensure that the GetData() method can be used only by the Person class and not by any class derived from the Person class. 

Which access modifier should you use for the GetData() method? 

A. Public 

B. Protected internal 

C. Internal 

D. Private 

E. Protected 

Answer:

Explanation: 

The GetData() method should be private. It would then only be visible within the Person class. 

Q11. - (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: Enumerable.Where<TSource> Method (IEnumerable<TSource>, 

Func<TSource, Boolean>) 

Filters a sequence of values based on a predicate. 

Example: 

List<string> fruits = 

new List<string> { "apple", "passionfruit", "banana", "mango", 

"orange", "blueberry", "grape", "strawberry" }; 

IEnumerable<string> query = fruits.Where(fruit => fruit.Length < 6); 

foreach (string fruit in query) 

Console.WriteLine(fruit); 

/* 

This code produces the following output: 

apple 

mango 

grape */ 

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

Q13. - (Topic 1) 

You are debugging an application that calculates loan interest. The application includes the following code. (Line numbers are included for reference only.) 

You have the following requirements: 

. The debugger must break execution within the Calculatelnterest() method when the loanAmount variable is less than or equal to zero. . The release version of the code must not be impacted by any changes. 

You need to meet the requirements. 

What should you do? 

A. Insert the following code segment at tine 05: Debug.Write(loanAmount > 0); 

B. Insert the following code segment at line 05: Trace.Write(loanAmount > 0); 

C. Insert the following code segment at line 03: Debug.Assert(loanAmount > 0); 

D. Insert the following code segment at line 03: Trace.Assert(loanAmount > 0); 

Answer:

Explanation: 

By default, the Debug.Assert method works only in debug builds. Use the Trace.Assert method if you want to do assertions in release builds. For more information, see Assertions in Managed Code. http://msdn.microsoft.com/en-us/library/kssw4w7z.aspx 

Q14. HOTSPOT - (Topic 2) 

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

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

Answer:  

Q15. - (Topic 1) 

You are developing an application that includes a class named UserTracker. The application includes the following code segment. (Line numbers are included for reference only.) 

You need to add a user to the UserTracker instance. What should you do? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

START 70-483 EXAM