Implementing Globalization, Drawing, and Text Manipulation Functionality in a .NET Framework Application

These questions are derived from the Self Test Software Practice Test for Microsoft exam #70-536CSHP – TS: Microsoft .NET Framework 2.0 – Application Development Foundation (C#.NET)


Objective: Implementing Globalization, Drawing, and Text Manipulation Functionality in a .NET Framework Application
SubObjective: Format data based on culture information (Refer System.Globalization namespace)


Single Answer, Multiple Choice


You are an application developer for a company. You have created an application used by branches of your company in different geographical locations. Your application offers localization services to various cultures and regions of the world.

You receive a request from a network administrator in Ireland to confirm the regional settings available in Microsoft .NET 2.0. The administrator needs your application to display this information on the command line.

Which code should you use to display regional settings in Ireland?



  1. RegionData regIreland = new RegionData(” Ireland”);
    Console.WriteLine(“DisplayName: ” + regIreland.DisplayName);
    Console.WriteLine(“ThreeLetterWindowsRegionName: ” +
      regIreland.ThreeLetterWindowsRegionName);
    Console.WriteLine(“IsMetric: ” + regIreland.IsMetric);
    Console.WriteLine(“CurrencySymbol: ” + regIreland.CurrencySymbol);
    Console.WriteLine( “ISOCurrencySymbol: ” + regIreland.ISOCurrencySymbol );

  2. RegionData regIreland = new RegionData(“IE”);
    Console.WriteLine(“DisplayName: ” + regIreland.DisplayName);
    Console.WriteLine(“ThreeLetterWindowsRegionName: ” +
      regIreland.ThreeLetterWindowsRegionName);
    Console.WriteLine(“IsMetric: ” + regIreland.IsMetric);
    Console.WriteLine(“CurrencySymbol: ” + regIreland.CurrencySymbol);
    Console.WriteLine( “ISOCurrencySymbol: ” + regIreland.ISOCurrencySymbol );

  3. RegionInfo regIreland = new RegionInfo(” Ireland”);
    Console.WriteLine(“DisplayName: ” + regIreland.DisplayName);
    Console.WriteLine(“ThreeLetterWindowsRegionName: ” +
      regIreland.ThreeLetterWindowsRegionName);
    Console.WriteLine(“IsMetric: ” + regIreland.IsMetric);
    Console.WriteLine(“CurrencySymbol: ” + regIreland.CurrencySymbol);
    Console.WriteLine( “ISOCurrencySymbol: ” + regIreland.ISOCurrencySymbol );

  4. RegionInfo regIreland = new RegionInfo(“IE”);
    Console.WriteLine(“DisplayName: ” + regIreland.DisplayName);
    Console.WriteLine(“ThreeLetterWindowsRegionName: ” +
      regIreland.ThreeLetterWindowsRegionName);
    Console.WriteLine(“IsMetric: ” + regIreland.IsMetric);
    Console.WriteLine(“CurrencySymbol: ” + regIreland.CurrencySymbol);
    Console.WriteLine( “ISOCurrencySymbol: ” + regIreland.ISOCurrencySymbol );


Answer:
D. RegionInfo regIreland = new RegionInfo(“IE”);
Console.WriteLine(“DisplayName: ” + regIreland.DisplayName);
Console.WriteLine(“ThreeLetterWindowsRegionName: ” +
  regIreland.ThreeLetterWindowsRegionName);
Console.WriteLine(“IsMetric: ” + regIreland.IsMetric);
Console.WriteLine(“CurrencySymbol: ” + regIreland.CurrencySymbol);
Console.WriteLine( “ISOCurrencySymbol: ” + regIreland.ISOCurrencySymbol );

Tutorial:
You should use the following code to display regional settings in Ireland:

RegionInfo regIreland = new RegionInfo(“IE”);
Console.WriteLine(“DisplayName: ” + regIreland.DisplayName);
Console.WriteLine(“ThreeLetterWindowsRegionName: ” +
  regIreland.ThreeLetterWindowsRegionName);
Console.WriteLine(“IsMetric: ” + regIreland.IsMetric);
Console.WriteLine(“CurrencySymbol: ” + regIreland.CurrencySymbol);
Console.WriteLine( “ISOCurrencySymbol: ” + regIreland.ISOCurrencySymbol );

The RegionInfo class represents information about a particular region or country. When instantiating a RegionInfo object, you must specify either a string representing the region or an integer representing the culture. The culture information represents the language and region, but when using the RegionInfo class, only the region information is used. The region string can be either the two- or three-letter region identifier. For example, “US” or ” USA” would indicate the United States of America region. The RegionInfo class provides many region-specific properties including DisplayName, TwoLetterISORegionName, ThreeLetterISORegionName, ThreeLetterWindowsRegionName, IsMetric, and CurrencySymbol.

You should not use the code fragments that instantiate a RegionData object because this class is intended only for graphics. You should use the RegionInfo class.

You should not use the code fragments that specify ” Ireland” as the region code because this is the country name, not the region code. This code will produce a run-time error if used.

Reference:
MSDN2 Library > Development Tools and Languages > Visual Studio > .NET Framework Programming in Visual Studio > Globalizing and Localizing Applications > Encoding and Localization > Names Associated with a RegionInfo Object

MSDN2 Library > .NET Development > .NET Framework SDK > Class Library Reference > System.Globalization > RegionInfo Class > RegionInfo Members

Like what you see? Share it.Google+LinkedInFacebookRedditTwitterEmail
cmadmin

ABOUT THE AUTHOR

Posted in Archive|

Comment: