70-483 Premium Bundle

70-483 Premium Bundle

Programming in C# Certification Exam

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

Microsoft 70-483 Free Practice Questions

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

Q2. - (Topic 1) 

You are developing an application that includes a class named Order. The application will store a collection of Order objects. 

The collection must meet the following requirements: 

Use strongly typed members. 

Process Order objects in first-in-first-out order. 

Store values for each Order object. 

. Use zero-based indices. 

You need to use a collection type that meets the requirements. 

Which collection type should you use? 

A. Queue<T> 

B. SortedList 

C. LinkedList<T> 

D. HashTable 

E. Array<T> 

Answer:

Explanation: 

Queues are useful for storing messages in the order they were received for sequential processing. Objects stored in a Queue<T> are inserted at one end and removed from the other. http://msdn.microsoft.com/en-us/library/7977ey2c.aspx 

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. DES 

B. HMACSHA512 

C. RNGCryptoServiceProvider 

D. ECDsa 

Answer:

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

Q5. - (Topic 2) 

You need to write a method that retrieves data from a Microsoft Access 2013 database. 

The method must meet the following requirements: 

Be read-only. 

Be able to use the data before the entire data set is retrieved. 

Minimize the amount of system overhead and the amount of memory usage. 

Which type of object should you use in the method? 

A. SqlDataAdapter 

B. DataContext 

C. DbDataAdapter 

D. OleDbDataReader 

Answer:

Explanation: OleDbDataReader Class 

Provides a way of reading a forward-only stream of data rows from a data source. 

Example: 

OleDbConnection cn = new OleDbConnection(); 

OleDbCommand cmd = new OleDbCommand(); 

DataTable schemaTable; 

OleDbDataReader myReader; 

//Open a connection to the SQL Server Northwind database. 

cn.ConnectionString = "Provider=SQLOLEDB;Data Source=server;User ID=login; 

Password=password;Initial Catalog=Northwind"; 

Q6. - (Topic 1) 

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

You need to ensure that the application accepts only integer input and prompts the user each time non-integer input is entered. 

Which code segment should you add at line 19? 

A. If (!int.TryParse(sLine, out number)) 

B. If ((number = Int32.Parse(sLine)) == Single.NaN) 

C. If ((number = int.Parse(sLine)) > Int32.MaxValue) 

D. If (Int32.TryParse(sLine, out number)) 

Answer:

Explanation: 

B and C will throw exception when user enters non-integer value. D is exactly the opposite what we want to achieve. 

Int32.TryParse - Converts the string representation of a number to its 32-bit signed integer equivalent. A return value indicates whether the conversion succeeded. http://msdn.microsoft.com/en-us/library/f02979c7.aspx 

Q7. - (Topic 1) 

You are developing an application that accepts the input of dates from the user. 

Users enter the date in their local format. The date entered by the user is stored in a string variable named inputDate. The valid date value must be placed in a DateTime variable named validatedDate. 

You need to validate the entered date and convert it to Coordinated Universal Time (UTC). The code must not cause an exception to be thrown. 

Which code segment should you use? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Explanation: 

AdjustToUniversal parses s and, if necessary, converts it to UTC. Note: The DateTime.TryParse method converts the specified string representation of a date and time to its DateTime equivalent using the specified culture-specific format information and formatting style, and returns a value that indicates whether the conversion succeeded. 

Q8. DRAG DROP - (Topic 2) 

You are developing a C# console application that outputs information to the screen. The following code segments implement the two classes responsible for making calls to the Console object: 

When the application is run, the console output must be the following text: 

Log started Base: Log continuing Finished 

You need to ensure that the application outputs the correct text. 

Which four lines of code should you use in sequence? (To answer, move the appropriate classes from the list of classes to the answer area and arrange them in the correct order.) 

Answer:  

Q9. - (Topic 2) 

You are implementing a method named GetValidPhoneNumbers. The GetValidPhoneNumbers() method processes a list of string values that represent phone numbers. 

The GetValidPhoneNumbers() method must return only phone numbers that are in a valid format. 

You need to implement the GetValidPhoneNumbers() method. 

Which two code segments can you use to achieve this goal? (Each correct answer presents a complete solution. Choose two.) 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer: A,B 

Explanation: * Regex.Matches Searches an input string for all occurrences of a regular expression and returns all the matches. 

* 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>. 

Q10. - (Topic 2) 

You are developing an application by using C#. The application includes a method named SendMessage. The SendMessage() method requires a string input. 

You need to replace "Hello" with "Goodbye" in the parameter that is passed to the SendMessage() method. 

Which two code segments can you use to achieve this goal? (Each correct answer presents a complete solution. Choose two.) 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer: B,C 

Explanation: * The first parameter should be Hello. 

* String.Replace Method (String, String) 

Returns a new string in which all occurrences of a specified string in the current instance are replaced with another specified string. 

This method does not modify the value of the current instance. Instead, it returns a new string in which all occurrences of oldValue are replaced by newValue. 

Q11. - (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 throw an InvalidCastException exception if the obj object is not of type IDataContainer 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. var dataContainer = obj as IDataContainer; 

C. var dataContainer = obj is IDataContainer; 

D. dynamic dataContainer = obj; 

Answer:

Explanation: 

http://msdn.microsoft.com/en-us/library/ms173105.aspx 

Q12. - (Topic 1) 

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

You need to add a user to the BookTracker instance. What should you do? A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

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

Q14. - (Topic 2) 

You are developing an application that includes a class named Customer and a generic list of customers. The following code segment declares the list of customers: 

List<Customer> customersList = new List<Customer> () ; 

You populate the customersList object with several hundred Customer objects. 

The application must display the data for five Customer objects at a time. 

You need to create a method that will return the correct number of Customer objects. 

Which code segment should you use? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Q15. - (Topic 1) 

You are developing an assembly that will be used by multiple applications. 

You need to install the assembly in the Global Assembly Cache (GAC). 

Which two actions can you perform to achieve this goal? (Each correct answer presents a complete solution. Choose two.) 

A. Use the Assembly Registration tool (regasm.exe) to register the assembly and to copy the assembly to the GAC. 

B. Use the Strong Name tool (sn.exe) to copy the assembly into the GAC. 

C. Use Microsoft Register Server (regsvr32.exe) to add the assembly to the GAC. 

D. Use the Global Assembly Cache tool (gacutil.exe) to add the assembly to the GAC. 

E. Use Windows Installer 2.0 to add the assembly to the GAC. 

Answer: D,E 

Explanation: 

There are two ways to deploy an assembly into the global assembly cache: 

Use an installer designed to work with the global assembly cache. This is the preferred option for installing assemblies into the global assembly cache. 

Use a developer tool called the Global Assembly Cache tool (Gacutil.exe), provided by the 

Windows 

Software Development Kit (SDK). 

Note: 

In deployment scenarios, use Windows Installer 2.0 to install assemblies into the global assembly cache. Use the Global Assembly Cache tool only in development scenarios, because it does not provide assembly reference counting and other features provided when using the Windows Installer. 

http://msdn.microsoft.com/en-us/library/yf1d93sz%28v=vs.110%29.aspx 

START 70-483 EXAM