70 483

Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

ITCertMaster

Safe, simple and fast. 100% Pass guarantee!

http://www.itcertmaster.com
IT Certification Guaranteed, The Easy Way!

IT Certification Guaranteed, The Easy Way!

Exam

70-483

Title

Programming in C#

Vendor

Microsoft

Version

DEMO

IT Certification Guaranteed, The Easy Way!

NO.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: A
Explanation:
http://msdn.microsoft.com/en-us/library/ms173105.aspx
NO.2 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. WaitForFullGCComplete()
B. SuppressFinalize()
C. WaitForFullGCApproach()
D. WaitForPendingFinalizers()
Answer: B
NO.3 You need to create a method that can be called by using a varying number of parameters.
What should you use?
A. derived classes
B. interface
C. enumeration
D. method overloading

IT Certification Guaranteed, The Easy Way!

Answer: D
Explanation:
Member overloading means creating two or more members on the same type that differ only in the
number or type of parameters but have the same name. Overloading is one of the most important
techniques for improving usability, productivity, and readability of reusable libraries. Overloading on
the number of parameters makes it possible to provide simpler versions of constructors and
methods. Overloading on the parameter type makes it possible to use the same member name for
members performing identical operations on a selected set of different types.
NO.4 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
3

IT Certification Guaranteed, The Easy Way!

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
NO.5 DRAG DROP
An application serializes and deserializes XML from streams. The XML streams are in the following
format:

The application reads the XML streams by using a DataContractSerializer object that is declared by
the following code segment:

You need to ensure that the application preserves the element ordering as provided in the XML
stream.
You have the following code:

Which attributes should you include in Target 1, Target 2 and Target 3 to complete the code? (To
answer, drag the appropriate attributes to the correct targets in the answer area. Each attribute 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.)
4

IT Certification Guaranteed, The Easy Way!

Answer:

NO.6 You plan to store passwords in a Windows Azure SQL Database database.
You need to ensure that the passwords are stored in the database by using a hash algorithm,
Which cryptographic algorithm should you use?
A. ECDSA
B. RSA-768
C. AES-256
D. SHA-256
Answer: D
NO.7 You are developing a C# application. The application includes the following code segment, (Line
numbers are included for reference only.)

IT Certification Guaranteed, The Easy Way!

The application fails at line 17 with the following error message: "An item with the same key
has already been added."
You need to resolve the error.
Which code segment should you insert at line 16?

A. Option A
B. Option B
C. Option C
D. Option D
Answer: A
NO.8 An application includes a class named Person. The Person class includes a method named
GetData.
You need to ensure that the GetData() from the Person class.
Which access modifier should you use for the GetData() method?
A. Internal
B. Protected
C. Private
D. Protected internal
E. Public
Answer: B
Explanation:
Protected - The type or member can be accessed only by code in the same class or structure, or in a
class that is derived from that class. http://msdn.microsoft.com/en-us/library/ms173121.aspx The
protected keyword is a member access modifier. A protected member is accessible within its class
6

IT Certification Guaranteed, The Easy Way!

and by derived class instances.


NO.9 You have an application that will send confidential information to a Web server.
You need to ensure that the data is encrypted when it is sent across the network.
Which class should you use?
A. CryptoStream
B. AuthenticatedStream
C. PipeStream
D. NegotiateStream
Answer: A
NO.10 DRAG DROP
You are developing a C# application. The application includes a class named Rate. The following code
segment implements the Rate class:

You define a collection of rates named rateCollection by using the following code segment:
Collection<Rate> rateCollection = new Collection<Rate>() ;
The application receives an XML file that contains rate information in the following format:

You need to parse the XML file and populate the rateCollection collection with Rate objects.
You have the following code: Which code segments should you include in Target 1, Target 2, Target 3
and Target 4 to complete the code? (To answer, drag the appropriate code segments to the correct
targets 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.)

IT Certification Guaranteed, The Easy Way!

Answer:

IT Certification Guaranteed, The Easy Way!

NO.11 You are developing code for a class named Account. The Account class includes the following
method:

You need to ensure that overflow exceptions are thrown when there is an error.
Which type of block should you use?
A. checked
B. try
C. using
D. unchecked
Answer: A
NO.12 You are modifying an existing banking application.
The application includes an Account class and a Customer class. The following code segment defines
the classes.

You populate a collection named customerCollection with Customer and Account objects by using the
following code segment:

You create a largeCustomerAccounts collection to store the Account objects by using the
following code segment:

IT Certification Guaranteed, The Easy Way!

Collection<Account> largeCustomerAccounts = new Collection<Account> ();


All accounts with a Balance value greater than or equal to 1,000,000 must be tracked.
You need to populate the largeCustomerAccounts collection with Account objects.
Which code segment should you use?

A. Option A
B. Option B
C. Option C
D. Option D
10

IT Certification Guaranteed, The Easy Way!

Answer: C
NO.13 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: A
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/enus/library/f02979c7.aspx
NO.14 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.
11

IT Certification Guaranteed, The Easy Way!

- Minimize the amount of system overhead and the amount of memory usage.
Which type of object should you use in the method?
A. DbDataAdapter
B. unTyped DataSet
C. OleDbDataAdapter
D. DbDataReader
Answer: D
Explanation:
The DbDataReader class reads a forward-only stream of rows from a data source.
Reference: DbDataReader Class
https://msdn.microsoft.com/enus/library/system.data.common.dbdatareader(v=vs.110).aspx
NO.15 DRAG DROP
You are developing an application by using C#. The application includes an array of decimal values
named loanAmounts. You are developing a LINQ query to return the values from the array.
The query must return decimal values that are evenly divisible by two. The values must be sorted
from the lowest value to the highest value.
You need to ensure that the query correctly returns the decimal values.
How should you complete the relevant 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:

12

IT Certification Guaranteed, The Easy Way!

NO.16 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

13

IT Certification Guaranteed, The Easy Way!

D. Option D
Answer: B
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
)

14

You might also like