70-483 Premium Bundle

70-483 Premium Bundle

Programming in C# Certification Exam

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

Microsoft 70-483 Free Practice Questions

Q1. - (Topic 2) 

You are implementing a method named ProcessData that performs a long-running task. The ProcessData() method has the following method signature: 

public void ProcessData(List<decimal> values, CancellationTokenSource source, CancellationToken token) 

If the calling code requests cancellation, the method must perform the following actions: 

. Cancel the long-running task. 

. Set the task status to TaskStatus.Canceled. You need to ensure that the ProcessData() method performs the required actions. 

Which code segment should you use in the method body? 

A. if (token.IsCancellationRequested) return; 

B. throw new AggregateException(); 

C. token.ThrowIfCancellationRequested(); 

D. source.Cancel(); 

Answer:

Q2. DRAG DROP - (Topic 2) 

You are creating a class named Data that includes a dictionary object named _data. 

You need to allow the garbage collection process to collect the references of the _data object. 

You have the following code: 

Which code segments should you include in Target 1 and Target 2 to complete the 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 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 

Q4. - (Topic 1) 

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 tog 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:

Q5. DRAG DROP - (Topic 1) 

You are developing an application by using C#. The application will process several objects per second. 

You need to create a performance counter to analyze the object processing. 

Which three actions should you perform in sequence? (To answer, move the appropriate actions from the list of actions to the answer area and arrange them in the correct order.) 

Answer:  

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

Q7. DRAG DROP - (Topic 2) 

You have an application that accesses a Microsoft SQL Server database. 

The database contains a stored procedure named Proc1. Proc1 accesses several rows of data across multiple tables. 

You need to ensure that after Proc1 executes, the database is left in a consistent state. While Proc1 executes, no other operation can modify data already read or changed by Proc1. (Develop the solution by selecting and ordering the required code snippets. 

You may not need all of the code snippets.) 

Answer:  

Q8. - (Topic 1) 

You are developing an application. The application calls a method that returns an array of integers named employeeIds. You define an integer variable named employeeIdToRemove and assign a value to it. You declare an array named filteredEmployeeIds. 

You have the following requirements: 

Remove duplicate integers from the employeeIds array. 

Sort the array in order from the highest value to the lowest value. 

Remove the integer value stored in the employeeIdToRemove variable from the 

employeeIds array. 

You need to create a LINQ query to meet the requirements. 

Which code segment should you use? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Q9. - (Topic 2) 

You are developing an application that includes methods named ConvertAmount and TransferFunds. 

You need to ensure that the precision and range of the value in the amount variable is not lost when the TransferFunds() method is called. 

Which code segment should you use? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Explanation: Simply use float for the TransferFunds parameter. 

Note: 

* The float keyword signifies a simple type that stores 32-bit floating-point values. 

* The double keyword signifies a simple type that stores 64-bit floating-point values 

Q10. - (Topic 2) 

You are creating a console application named App1. 

App1 will validate user input for order entries. 

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

You need to complete the code segment. 

The solution must ensure that prices are positive and have two decimal places. 

Which code should you insert at line 03? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Explanation: * Regex.IsMatch Method (String, String) 

Indicates whether the specified regular expression finds a match in the specified input string. 

Syntax: 

public static bool IsMatch( 

string input, 

string pattern 

Q11. - (Topic 2) 

You have the following code. (Line numbers are included for reference only.) 

When you execute the code, you get an exception. 

You need to ensure that B_Products contain all of the products that start with the letter “B”. What should you do? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Explanation: Simply select the product items. 

Q12. - (Topic 1) 

You are developing an application. The application includes a method named ReadFile that reads data from a file. The ReadFile() method must meet the following requirements: . It must not make changes to the data file. 

. It must allow other processes to access the data file. . It must not throw an exception if the application attempts to open a data file that does not exist. 

You need to implement the ReadFile() method. 

Which code segment should you use? 

A. var fs = File.Open(Filename, FileMode.OpenOrCreate, FileAccess.Read, FileShare.ReadWrite); 

B. var fs = File.Open(Filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); 

C. var fs = File.Open(Filename, FileMode.OpenOrCreate, FileAccess.Read, FileShare.Write); 

D. var fs = File.ReadAllLines(Filename); 

E. var fs = File.ReadAllBytes(Filename); 

Answer:

Explanation: 

FileMode.OpenOrCreate - Specifies that the operating system should open a file if it exists; otherwise, a new file should be created. If the file is opened with FileAccess.Read, FileIOPermissionAccess.Read permission is required. If the file access is FileAccess.Write, FileIOPermissionAccess.Write permission is required. If the file is opened with FileAccess.ReadWrite, both FileIOPermissionAccess.Read and FileIOPermissionAccess.Write permissions are required. 

http://msdn.microsoft.com/en-us/library/system.io.filemode.aspx 

FileShare.ReadWrite - Allows subsequent opening of the file for reading or writing.If this flag is not specified, any request to open the file for reading or writing (by this process or another process) will fail until the file is closed.However, even if this flag is specified, additional permissions might still be needed to access the file. http://msdn.microsoft.com/pl-pl/library/system.io.fileshare.aspx 

Q13. - (Topic 2) 

You are creating a class library that will be used in a web application. 

You need to ensure that the class library assembly is strongly named. 

What should you do? 

A. Use the gacutil.exe command-line tool. 

B. Use the xsd.exe command-line tool. 

C. Use the aspnet_regiis.exe command-line tool. 

D. Use assembly attributes. 

Answer:

Explanation: The Windows Software Development Kit (SDK) provides several ways to sign an assembly with a strong name: 

* Using the Assembly Linker (Al.exe) provided by the Windows SDK. 

* Using assembly attributes to insert the strong name information in your code. You can use either the AssemblyKeyFileAttribute or the AssemblyKeyNameAttribute, depending on where the key file to be used is located. 

* Using compiler options such /keyfile or /delaysign in C# and Visual Basic, or the 

/KEYFILE or /DELAYSIGN linker option in C++. (For information on delay signing, see 

Delay Signing an Assembly.) 

Note: 

* A strong name consists of the assembly's identity—its simple text name, version number, and culture information (if provided)—plus a public key and a digital signature. It is generated from an assembly file (the file that contains the assembly manifest, which in turn contains the names and hashes of all the files that make up the assembly), using the corresponding private key. Microsoft. Visual Studio. .NET and other development tools provided in the .NET Framework SDK can assign strong names to an assembly. 

Assemblies with the same strong name are expected to be identical. 

Q14. DRAG DROP - (Topic 2) 

You have the following class. (Line numbers are included for reference only.) 

You need to complete the doOperation method to meet the following requirements: 

. If AddNumb is passed as the operationName parameter, the AddNumb function is called. . If SubNumb is passed as the operationName parameter, the SubNumb function is called. 

Which code should you insert at line 16? Develop the solution by selecting and arranging the required code blocks in the correct order. You may not need all of the code blocks. 

Answer:  

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

START 70-483 EXAM