70-483 Exam - Programming in C#

certleader.com

Q1. HOTSPOT - (Topic 2) 

A developer designs an interface that contains the following code: 

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

Answer:  

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

Q3. - (Topic 2) 

You are developing an application for a bank. The application includes a method named ProcessLoan that processes loan applications. The ProcessLoan() method uses a method named CalculateInterest. The application includes the following code: 

You need to declare a delegate to support the ProcessLoan() method. Which code segment should you use? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

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

Q5. - (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 'int'. 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 = arrayl[0] is int; 

B. var2 = ((List<int>)arrayl) [0]; 

C. var2 = arrayl[0].Equals(typeof(int)); 

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

Answer:

Q6. - (Topic 1) 

You are developing an application that uses structured exception handling. The application includes a class named ExceptionLogger. 

The ExceptionLogger class implements a method named LogException by using the following code segment: 

public static void LogException(Exception ex) 

You have the following requirements: . Log all exceptions by using the LogException() method of the ExceptionLogger 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:

Explanation: 

Once an exception is thrown, part of the information it carries is the stack trace. The stack trace is a list of the method call hierarchy that starts with the method that throws the exception and ends with the method that catches the exception. If an exception is re-thrown by specifying the exception in the throw statement, the stack trace is restarted at the current method and the list of method calls between the original method that threw the exception and the current method is lost. To keep the original stack trace information with the exception, use the throw statement without specifying the exception. 

http://msdn.microsoft.com/en-us/library/ms182363(v=vs.110).aspx 

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 a method named CreateCounters that will create performance counters for an application. The method includes the following code. (Line numbers are included for reference only.) 

You need to ensure that Counter2 is available for use in Windows Performance Monitor (PerfMon). 

Which code segment should you insert at line 16? 

A. CounterType = PerformanceCounterType.RawBase 

B. CounterType = PerformanceCounterType.AverageBase 

C. CounterType = PerformanceCounterType.SampleBase 

D. CounterType = PerformanceCounterType.CounterMultiBase 

Answer:

Explanation: 

PerformanceCounterType.AverageTimer32 - An average counter that measures the time it takes, on average, to complete a process or operation. Counters of this type display a ratio of the total elapsed time of the sample interval to the number of processes or operations completed during that time. This counter type measures time in ticks of the system clock. Formula: ((N 1 -N 0)/F)/(B 1 -B 0), where N 1 and N 0 are performance counter readings, B 1 and B 0 are their corresponding AverageBase values, and F is the number of ticks per second. The value of F is factored into the equation so that the result can be displayed in seconds. 

Thus, the numerator represents the numbers of ticks counted during the last sample interval, F represents the frequency of the ticks, and the denominator represents the number of operations completed during the last sample interval. Counters of this type include PhysicalDisk\ Avg. Disk sec/Transfer. 

PerformanceCounterType.AverageBase - A base counter that is used in the calculation of time or count averages, such as AverageTimer32 and AverageCount64. Stores the denominator for calculating a counter to present "time per operation" or "count per operation".. http://msdn.microsoft.com/en-us/library/system.diagnostics.performancecountertype.aspx 

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

Q10. - (Topic 1) 

You are creating a class named Employee. The class exposes a string property named EmployeeType. The following code segment defines the Employee class. (Line numbers are included for reference only.) 

The EmployeeType property value must meet the following requirements: 

. The value must be accessed only by code within the Employee class or within a class derived from the Employee class. . The value must be modified only by code within the Employee class. 

You need to ensure that the implementation of the EmployeeType property meets the requirements. 

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

A. Replace line 03 with the following code segment: public string EmployeeType 

B. Replace line 06 with the following code segment: protected set; 

C. Replace line 05 with the following code segment: private get; 

D. Replace line 05 with the following code segment: protected get; 

E. Replace line 03 with the following code segment: protected string EmployeeType 

F. Replace line 06 with the following code segment: private set; 

Answer: E,F