70-483 Premium Bundle

70-483 Premium Bundle

Programming in C# Certification Exam

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

Microsoft 70-483 Free Practice Questions

Q1. - (Topic 2) 

You are developing an application that includes a method named SendMessage. 

You need to ensure that the SendMessage() method is called with the required parameters. 

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: C,D 

Explanation: D: ExpandoObject Represents an object whose members can be dynamically added and removed at run time. / The ExpandoObject class enables you to add and delete members of its instances at run time and also to set and get values of these members. This class supports dynamic binding, which enables you to use standard syntax like sampleObject.sampleMember instead of more complex syntax like sampleObject.GetAttribute("sampleMember"). / You can pass instances of the ExpandoObject class as parameters. Note that these instances are treated as dynamic objects in C# and late-bound objects in Visual Basic. This means that you do not have IntelliSense for object members and you do not receive compiler errors when you call non-existent members. If you call a member that does not exist, an exception occurs. 

Note: 

* Visual C# 2010 introduces a new type, dynamic. The type is a static type, but an object of type dynamic bypasses static type checking. In most cases, it functions like it has type object. At compile time, an element that is typed as dynamic is assumed to support any operation. Therefore, you do not have to be concerned about whether the object gets its value from a COM API, from a dynamic language such as IronPython, from the HTML Document Object Model (DOM), from reflection, or from somewhere else in the program. However, if the code is not valid, errors are caught at run time. 

Q2. - (Topic 2) 

You are developing an application in C#. 

The application uses exception handling on a method that is used to execute mathematical calculations by using integer numbers. 

You write the following catch blocks for the method (line numbers are included for reference only): 

You need to add the following code to the method: 

At which line should you insert the code? 

A. 01 

B. 03 

C. 05 

D. 07 

Answer:

Q3. HOTSPOT - (Topic 1) 

You are developing an application that includes a Windows Communication Foundation (WCF) service. The service includes a custom TraceSource object named ts and a method named DoWork. The application must meet the following requirements: 

. Collect trace information when the DoWork() method executes. . Group all traces for a single execution of the DoWork() method as an activity that can be viewed in the WCF Service Trace Viewer Tool. 

You need to ensure that the application meets the requirements. 

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

Answer:  

Q4. - (Topic 2) 

You are developing an application. 

The application contains the following code segment (line numbers are included for reference only): 

When you run the code, you receive the following error message: "Cannot implicitly convert type 'object'' to 'inf. An explicit conversion exists (are you missing a cast?)." 

You need to ensure that the code can be compiled. 

Which code should you use to replace line 05? 

A. var2 = ((List<int>) array1) [0]; 

B. var2 = array1[0].Equals(typeof(int)); 

C. var2 = Convert.ToInt32(array1[0]); 

D. var2 = ((int[])array1)[0]; 

Answer:

Explanation: Make a list of integers of the array with = ( (List<int>)arrayl) then select the first item in the list with [0]. 

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

Q6. - (Topic 2) 

You are developing a method named GetHash that will return a 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 fileBytes variable. Which code segment should you insert at line 05? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Q7. - (Topic 1) 

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

The GetCustomers() method must meet the following requirements: 

Connect to a Microsoft SQL Server database. 

Populate Customer objects with data from the database. 

Return an IEnumerable<Customer> collection that contains the populated 

Customer objects. 

You need to meet the requirements. 

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

A. Insert the following code segment at line 17: while (sqlDataReader.GetValues()) 

B. Insert the following code segment at line 14: sqlConnection.Open(); 

C. Insert the following code segment at line 14: sqlConnection.BeginTransaction(); 

D. Insert the following code segment at line 17: while (sqlDataReader.Read()) 

E. Insert the following code segment at line 17: while (sqlDataReader.NextResult()) 

Answer: B,D 

Explanation: 

SqlConnection.Open - Opens a database connection with the property settings specified by the ConnectionString. 

http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.open.aspx SqlDataReader.Read - Advances the SqlDataReader to the next record. http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldatareader.read.aspx 

Q8. - (Topic 2) 

You are developing a class named Scorecard. The following code implements the Scorecard class. (Line numbers are included for reference only.) 

You create the following unit test method to test the Scorecard class implementation: 

You need to ensure that the unit test will pass. What should you do? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Q9. - (Topic 2) 

You are developing a C# application. The application references and calls a RESTful web service named EmployeeService. The EmployeeService web service includes a method named GetEmployee, which accepts an employee ID as a parameter. The web service returns the following JSON data from the method. 

{"Id":1,"Name":"David Jones"> 

The following code segment invokes the service and stores the result: 

You need to convert the returned JSON data to an Employee object for use in the application. 

Which code segment should you use? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Q10. - (Topic 2) 

You are developing an application that will manage customer records. The application includes a method named FindCustomer. 

Users must be able to locate customer records by using the customer identifier or customer name. 

You need to implement the FindCustomer() method to meet the requirement. 

Which two sets of method signatures 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,D 

Q11. - (Topic 2) 

You are creating an application that reads from a database. 

You need to use different databases during the development phase and the testing phase by using conditional compilation techniques. 

What should you do? 

A. Configure the Define TRACE constant setting in Microsoft Visual Studio. 

B. Decorate the code by using the [DebuggerDisplay("Mydebug")] attribute. 

C. Configure the Define DEBUG constant setting in Microsoft Visual Studio. 

D. Disable the strong-name bypass feature of Microsoft .NET Framework in the registry. 

Answer:

Explanation: Use one debug version to connect to the development database, and a standard version to connect to the live database. 

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

B. ReRegisterForFinalize() 

C. WaitForFullGCComplete() 

D. KeepAlive() 

Answer:

Q13. HOTSPOT - (Topic 2) 

You have the following code: 

For each of the following statements, select Yes if the statement is true. Otherwise, select No. 

Answer:  

Q14. - (Topic 1) 

You are developing an application that uses structured exception handling. The application includes a class named Logger. The Logger class implements a method named Log by using the following code segment: 

public static void Log(Exception ex) { } 

You have the following requirements: 

. Log all exceptions by using the Log() method of the Logger class. 

. Rethrow the original exception, including the entire exception stack. 

You need to meet the requirements. Which code segment should you use? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

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

START 70-483 EXAM