70-483 Premium Bundle

70-483 Premium Bundle

Programming in C# Certification Exam

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

Microsoft 70-483 Free Practice Questions

Q1. DRAG DROP - (Topic 1) 

You are implementing a method that creates an instance of a class named User. The User class contains a public event named Renamed. The following code segment defines the Renamed event: 

Public event EventHandler<RenameEventArgs> Renamed; 

You need to create an event handler for the Renamed event by using a lambda expression. 

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:  

Q2. DRAG DROP - (Topic 1) 

You are developing a class named ExtensionMethods. 

You need to ensure that the ExtensionMethods class implements the IsEmail() extension 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:  

Q3. - (Topic 1) 

You are developing an application that will transmit large amounts of data between a client computer and a server. 

You need to ensure the validity of the data by using a cryptographic hashing algorithm. 

Which algorithm should you use? 

A. HMACSHA256 

B. RNGCryptoServiceProvider 

C. DES 

D. Aes 

Answer:

Explanation: 

The .NET Framework provides the following classes that implement hashing algorithms: 

HMACSHA1. 

MACTripleDES. 

MD5CryptoServiceProvider. 

RIPEMD160. 

SHA1Managed. 

SHA256Managed. 

SHA384Managed. 

SHA512Managed. 

HMAC variants of all of the Secure Hash Algorithm (SHA), Message Digest 5 (MD5), and 

RIPEMD-160 algorithms. 

CryptoServiceProvider implementations (managed code wrappers) of all the SHA 

algorithms. 

Cryptography Next Generation (CNG) implementations of all the MD5 and SHA algorithms. 

http://msdn.microsoft.com/en-us/library/92f9ye3s.aspx#hash_values 

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

Q5. - (Topic 2) 

You are troubleshooting an application that uses a class named FullName. The class is decorated with the DataContractAttribute attribute. The application includes the following code. (Line numbers are included for reference only.) 

You need to ensure that the entire FullName object is serialized to the memory stream object. 

Which code segment should you insert at line 09? 

A. binary.WriteEndDocument(); 

B. binary.WriteEndDocumentAsync(); 

C. binary.WriteEndElementAsync(); 

D. binary.Flush(); 

Answer:

Explanation: * DataContractSerializer.WriteEndObject Method (XmlDictionaryWriter) Writes the closing XML element using an XmlDictionaryWriter. 

* Note on line 07: DataContractSerializer.WriteObject Method Writes all the object data (starting XML element, content, and closing element) to an XML document or stream. 

XmlDictionaryWriter 

Q6. DRAG DROP - (Topic 2) 

You are adding a function to a membership tracking application- The function uses an integer named memberCode as an input parameter and returns the membership type as a string. 

The function must meet the following requirements: 

Return "Non-Member" if the memberCode is 0. 

Return "Member" if the memberCode is 1. 

Return "Invalid" if the memberCode is any value other than 0 or 1. 

You need to implement the function to meet the requirements. 

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

Q7. - (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: JavaScriptSerializer().Deserialize 

Converts the specified JSON string to an object of type T. 

Example: 

string json = File.ReadAllText(Environment.CurrentDirectory + @"\JSON.txt"); 

Company company = new 

System.Web.Script.Serialization.JavaScriptSerializer().Deserialize<Company>( 

Reference: C# - serialize object to JSON format using JavaScriptSerializer 

http://matijabozicevic.com/blog/csharp-net-development/csharp-serialize-object-to-json-format-using-javascriptserialization 

Q8. - (Topic 2) 

You need to write a console application that meets the following requirements: 

. If the application is compiled in Debug mode, the console output must display Entering debug mode. . If the application is compiled in Release mode, the console output must display Entering release mode. 

Which code should you use? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Explanation: #elif lets you create a compound conditional directive. The #elif expression will be evaluated if neither the preceding #if (C# Reference) nor any preceding, optional, #elif directive expressions evaluate to true. If a #elif expression evaluates to true, the compiler evaluates all the code between the #elif and the next conditional directive. For example: #define VC7 //... #if debug Console.Writeline("Debug build"); #elif VC7 Console.Writeline("Visual Studio 7"); #endif 

Incorrect: Not B: 

* System.Reflection.Assembly.GetExecutingAssembly Method Gets the assembly that contains the code that is currently executing.* Assembly.IsDefined Method Indicates whether or not a specified attribute has been applied to the assembly. 

* System.Dignostics.Debugger Class Enables communication with a debugger. 

Property: IsAttached 

Gets a value that indicates whether a debugger is attached to the process. 

Q9. - (Topic 2) 

You are testing an application. The application includes methods named CalculateInterest and LogLine. The CalculateInterest() method calculates loan interest. The LogLine() method sends diagnostic messages to a console window. 

The following code implements the methods. (Line numbers are included for reference only.) 

You have the following requirements: 

. The CalculateInterest() method must run for all build configurations. . The LogLine() method must run only for debug builds. 

You need to ensure that the methods run correctly. 

What are two possible ways to achieve this goal? (Each correct answer presents a complete solution. Choose two.) 

A. Insert the following code segment at line 01: 

#region DEBUG 

Insert the following code segment at line 10: 

#endregion 

B. Insert the following code segment at line 01: 

[Conditional("DEBUG")] 

C. Insert the following code segment at line 05: 

#region DEBUG 

Insert the following code segment at line 07: 

#endregion 

D. Insert the following code segment at line 10: 

[Conditional("DEBUG")] 

E. Insert the following code segment at line 01: 

#if DEBUG 

Insert the following code segment at line 10: 

#endif 

F. Insert the following code segment at line 10: 

[Conditional("RELEASE")] 

G. Insert the following code segment at line 05: 

#if DEBUG 

Insert the following code segment at line 07: 

#endif 

Answer: D,G 

Reference: http://stackoverflow.com/questions/2104099/c-sharp-if-then-directives-for-debug-vs-release 

Q10. - (Topic 2) 

You are developing an application that will be deployed to multiple computers. You set the assembly name. 

You need to create a unique identity for the application assembly. 

Which two assembly identity attributes should you include in the source code? (Each correct answer presents part of the solution. Choose two.) 

A. AssemblyDelaySignAttribute 

B. AssemblyCompanyAttribute 

C. AssemblyProductAttribute 

D. AssemblyCultureAttribute 

E. AssemblyVersionAttribute 

Answer: D,E 

Explanation: The AssemblyName object contains information about an assembly, which 

you can use to bind to that assembly. An assembly's identity consists of the following: 

Simple name. 

Version number. 

Cryptographic key pair. 

Supported culture. 

D: AssemblyCultureAttribute 

Specifies which culture the assembly supports. 

The attribute is used by compilers to distinguish between a main assembly and a satellite 

assembly. A main assembly contains code and the neutral culture's resources. A satellite 

assembly contains only resources for a particular culture, as in 

[assembly:AssemblyCultureAttribute("de")] 

E: AssemblyVersionAttribute 

Specifies the version of the assembly being attributed. 

The assembly version number is part of an assembly's identity and plays a key part in 

binding to the assembly and in version policy. 

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

Q12. - (Topic 2) 

You are developing a method named GenerateHash that will create the hash value for a file. The method includes the following code. (Line numbers are included for reference only.) 

You need to return the cryptographic hash of the bytes contained in the fileBuffer variable. Which code segment should you insert at line 05? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Q13. - (Topic 2) 

You are developing an application that uses a .config file. 

The relevant portion of the .config file is shown as follows: 

You need to ensure that diagnostic data for the application writes to the event log by using the configuration specified in the .config file. 

What should you include in the application code? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Explanation: Explanation 

http://msdn.microsoft.com/en-us/library/vstudio/system.diagnostics.eventlogtracelistener 

Public static void Main(string[] args) { 

Create a trace listener for the event log. 

EventLogTraceListener myTraceListener = new 

EventLogTraceListener("myEventLogSource"); 

Add the event log trace listener to the collection. 

Trace.Listeners.Add(myTraceListener); 

// Write output to the event log. 

Trace.WriteLine("Test output"); 

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

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

START 70-483 EXAM