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 Calculatelnterest() 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 10:
[Conditional(MDEBUG")]
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 01:
#if DE30G
Insert the following code segment at line 10: #endif
E. Insert the following code segment at line 01:
[Conditional(MDEBUG")]
F. Insert the following code segment at line 05:
#if DEBUG
Insert the following code segment at line 07:
#endif
G. Insert the following code segment at line 10:
[Conditional("RELEASE")]
Answer: B,F
Explanation:
#if DEBUG: The code in here won't even reach the IL on release.[Conditional("DEBUG")]: This code will reach the IL, however the calls to the method will not execute unless DEBUG is on.
http://stackoverflow.com/questions/3788605/if-debug-vs-conditionaldebug
Question No : 2
You are creating a console application by using C#.You need to access the assembly found in the file named car.dll. Which code segment should you use?
A. Assembly.Load();
B. Assembly.GetExecutingAssembly();
C. This.GetType();
D. Assembly.LoadFile("car.dll");
Answer: D
Explanation:
Assembly.LoadFile - Loads the contents of an assembly file on the specified path.
http://msdn.microsoft.com/en-us/library/b61s44e8.aspx
Question No : 3
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
Question No : 4
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: D
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
Latest
Microsoft 70-483 Study Material Offered By Dumps4download.us Free Demo
Question No : 5
You are implementing a method named ProcessReports that performs a long-running task.The ProcessReports() method has the following method signature: public void ProcessReports(List<decimal> values,CancellationTokenSource cts,CancellationToken ct) 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 ProcessReports() method performs the required actions.Which code segment should you use in the method body?
A. if (ct.IsCancellationRequested) return;
B. ct.ThrowIfCancellationRequested() ;
C. cts.Cancel();
D. throw new AggregateException();
Answer: B
Question No : 6
You have a class named Customer and a class named Order.The customer class has a property named Orders that contains a list of Order objects.The Order class has a property named OrderDate that contains the date of the Order.You need to create a LINQ query that returns all of the customers who had at least one order during the year 2005.You write the following code.
How should you complete the code? To answer, drag the appropriate code elements to the correct targets in the answer area. Each code element 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:
Explanation:
Target 1 : Where
Target 2 : Join
Target 3 : =>
Target 4 : ==
Question No : 7
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: A
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");
}
Question No : 8
You are developing an application that retrieves patient data from a web service. The application stores the JSON messages returned from the web service in a string variable named PatientAsJson. The variable is encoded as UTF-8. The application includes a class named Patient that is defined by the following code:
You need to populate the Patient class with the data returned from the web service. Which code segment should you use?
A. Option A
B. Option B
C. Option C
D. Option D
Answer: A
[Download
Microsoft 70-483] Exam Dumps and PDF by Dumps4download.us with Test Engine Help
Question No : 9
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:
Explanation:
Box 1:
Note:
* The abstract keyword enables you to create classes and class members that are incomplete and must be implemented in a derived class.
* An abstract class cannot be instantiated. The purpose of an abstract class is to provide a
common definition of a base class that multiple derived classes can share.
Question No : 10
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
Explanation: D: Also, it's worth pointing out that you can use [Conditional("DEBUG")]
attribute on methods that return void to have them only executed if a certain symbol is defined. The compiler would remove all calls to those methods if the symbol is not defined:
[Conditional("DEBUG")]
void PrintLog() {
Console.WriteLine("Debug info");
}
void Test() {
PrintLog();
}
G: When the C# compiler encounters an #if directive, followed eventually by an #endif directive, it will compile the code between the directives only if the specified symbol is defined. Unlike C and C++, you cannot assign a numeric value to a symbol; the
#if statement in C# is Boolean and only tests whether the symbol has been defined or not.
For example,
#define DEBUG
#if DEBUG
Console.WriteLine("Debug version");
#endif
Reference: http://stackoverflow.com/questions/2104099/c-sharp-if-then-directives-fordebug-vs-release





















No comments:
Post a Comment