Exam Prep Questions

Question 1

Your application allows users to select a culture, such as English, French, or Spanish, from an options drop-down list. Users complain that some information is not displayed correctly, even after they select the proper culture. What could be the problem?

  • A. The users are running your application on an English-only version of Windows.

  • B. You're using a neutral CultureInfo object to retrieve information instead of a specific CultureInfo object.

  • C. The users have not yet installed .NET Framework Service Pack 1.

  • D. Your application is constructed as an executable file rather than a satellite library.

A1:

Answer B is correct. Neutral cultures do not contain enough information to properly localize an application. You should be using the appropriate specific culture instead. Answer A is incorrect because you can display culture-specific information on an English-only version of Windows. Answer C is incorrect because the use of .NET Framework Service Pack 1 is not related to the given problem. Answer D is incorrect because the fact that the application is an executable file cannot be the reason for the given problem.

Question 2

Your application needs to search for substrings in longer strings, and this searching should be culture aware. What should you use to perform these searches?

  • A. CultureInfo.CompareInfo

  • B. Array.Sort()

  • C. String.IndexOf()

  • D. String.IndexOfAny()

A2:

Answer A is correct. The CultureInfo.CompareInfo property returns an object of the CompareInfo type. The CompareInfo type implements a set of methods for culture-sensitive string comparisons. Answer B is incorrect because the Array.Sort() method does not locate substrings. Answers C and D are incorrect because the String.IndexOf() and String.IndexOfAny() methods can find substrings but are not culture aware.

Question 3

Your application allows users to select a culture from the Culture drop-down list in the Welcome page. Users want to include the day of the week when your application displays dates. They want this to be in the culture selected by them. What can you do to address this need? (Select the two best answers.)

  • A. Use the DateTime.ToLongDateString() method to format dates.

  • B. Use the CultureInfo.DateTimeFormat property to retrieve the names of the weekdays, and select the proper name from that array.

  • C. Force the user to enter the day of the week whenever he enters a date in the system.

  • D. Use the RegionInfo object to retrieve the names of the weekdays, and select the proper name from that array.

A3:

Answers A and B are correct. Both the DateTime class and the CultureInfo class can supply the information you need here. Answer C is incorrect because there's no point in forcing the user to enter days when they're already available. Answer D is incorrect because the RegionInfo object does not expose weekday names.

Question 4

A user wants to see French dates and currencies displayed in an application but wants the user interface to remain in English. How can you accomplish this?

  • A. Set the CurrentCulture property to a CultureInfo object that represents the fr-FR culture, and set the CurrentUICulture property to a CultureInfo object that represents the en-US culture.

  • B. Set the CurrentCulture property to a CultureInfo object that represents the en-US culture, and set the CurrentUICulture property to a CultureInfo object that represents the fr-FR culture.

  • C. Set the CurrentCulture property to a CultureInfo object that represents the fr-FR culture, and set the CurrentUICulture property to a CultureInfo object that represents the fr-FR culture.

  • D. Set the CurrentCulture property to a CultureInfo object representing the en-US culture, and set the CurrentUICulture property to a CultureInfo object representing the en-US culture.

A4:

Answer A is correct. The CurrentCulture property controls formatting, and the CurrentUICulture property controls user interface resource loading. Answers B and C are incorrect because, if the CurrentUICulture property is set to a CultureInfo object that represents the fr-FR culture, the user interface will be displayed in French. Answer D is incorrect because in this case currencies and dates as well as the user interface will be displayed in English.

Question 5

Your application displays order information including the total cost of each order. You are beginning to sell this application in multiple countries . How should you ensure that the correct currency symbol is used in all cases?

  • A. Allow the user to select a culture from a list. Then create a CultureInfo object based on the user's selection and assign it to the Thread.CurrentThread.CurrentCulture property. Use the ToString() method to format currency amounts.

  • B. Accept the Thread.CurrentThread.CurrentCulture property as it is set when you run your application; then use the ToString() method to format currency amounts.

  • C. Prompt the user for a currency symbol and store it in the Registry.

  • D. Allow the user to select a currency symbol from a list of supported symbols.

A5:

Answer A is correct. Allowing the user to choose a culture is the best option in the given scenario. Answer B is incorrect because the user might be running a version of Windows that's not appropriate for her culture. Answers C and D are incorrect because there's no need to prompt or store a currency symbol when all the necessary currency symbols are stored in the .NET Framework.

Question 6

Your Web application includes three assembly resource files: Strings.resx contains the default (English) resources; Strings.en-US.resx contains the English resources; and Strings.France.resx contains the French resources. Users report that they are getting the default English user interface when they've selected the option for a French user interface. What should you do?

  • A. Instruct users to close and reopen the application after selecting a new user interface language.

  • B. Add French resources to the Strings.resx file.

  • C. Rename the French resource file Strings.fr-FR.resx .

  • D. Delete the Strings.en-US.resx file from the project.

A6:

Answer C is correct. Naming for assembly resource files must follow the scheme the .NET Framework expects. Otherwise, the .NET Framework won't be able to find the resource file. Answer A is incorrect because resources can be dynamically loaded and there is no need to restart the application. Answer B is incorrect because, in the .NET Framework, localized resources are stored in separate files (that are identified with a culture code) and loaded according to the UI culture setting. Answer D is incorrect because, if you delete the Strings.en-US.resx file from the project, searches for the requested resource will fall back on the default resource file String.resx , which again has English resources.

Question 7

You are writing an application on a system that uses U.S. English Windows (culture code en-US ). The application will run on a system that uses Japanese Windows (culture code jp-JP ) and will send information to Windows services on the target computer. Which culture should you use to format your application's output?

  • A. en-US

  • B. jp-JP

  • C. jp

  • D. The invariant culture

A7:

Answer D is correct. You should always use the invariant culture for communication with Windows services. Answers A, B, and C are incorrect because even the localized Windows version should communicate with the Windows service in invariant format.

Question 8

Your Web application contains Unicode strings encoded in UTF-16 format. You want to save a copy of those strings to disk in UTF-8 format. What should you do?

  • A. Use the UnicodeEncoding.GetBytes() method to perform the conversion.

  • B. Use the UnicodeEncoding.GetChars() method to perform the conversion.

  • C. Use the UTF8Encoding.GetBytes() method to perform the conversion.

  • D. Use the UTF8Encoding.GetChars() method to perform the conversion.

A8:

Answer C is correct. The UTF8Encoding.GetBytes() method encodes Unicode characters into bytes that are appropriate for storing to disk. Answers A and B are incorrect because the methods of the UnicodeEncoding class do not support encoding to the UTF-8 format. Answer D is incorrect because the UTF8Encoding.GetChars() method does the reverse job ”that is, it decodes an array of bytes to Unicode characters.

Question 9

A Web page in your application reports the number of characters in a particular data entry form. You're dividing the number of bits taken up by the data by 16 to arrive at this figure. Users of the localized version in Saudi Arabia complain that the number of characters is persistently overestimated. What should you do?

  • A. Divide the number of bits by 32 to arrive at a more accurate figure.

  • B. Use the String.Length() method to retrieve the actual length of the string.

  • C. Divide the number of bits by 8 to arrive at a more accurate figure.

  • D. Use a GetTextElementEnumerator object to enumerate the characters.

A9:

Answer D is correct. The problem is that the algorithm for simple division by 16 does not take into account composed characters. The GetTextElementEnumerator object correctly enumerates all the characters in a Unicode string. Answers A and C are incorrect because a simple division by 32 or 8 will not account for the composed characters in a Unicode string. Answer B is incorrect because String.Length() method does not take the combined characters into account.

Question 10

You are shipping an application to France and Russia and are using assembly resource files to hold localization resources. Now you need to start shipping to Spain. If the application is running on the Spanish version of Windows, you want to show the user interface in Spanish. What should you do? (Select two.)

  • A. Create an assembly resource file to hold the user interface text translated into Spanish.

  • B. Build a new project that contains only the Spanish version of the form, and then build this new project to sell in Spain.

  • C. Use a ResourceManager object to assign resources from the new assembly resource file at runtime.

  • D. Create a new CultureInfo object for the Spanish (Spain) culture. Assign this object to the Thread.CurrentThread.CurrentUICulture property.

A10:

Answers A and C are correct. To display a translated user interface on a form, you must supply a translated resource file and use code to move the resources to the form at runtime. Answer B is incorrect because creating a completely different project for the Spanish version requires additional coding efforts. Answer D is incorrect because, if the application is running on the Spanish version of Windows, the value of the Thread.CurrentThread.CurrentUICulture property is already set for the Spanish culture.



MCAD Developing and Implementing Web Applications with Visual C#. NET and Visual Studio. NET (Exam [... ]am 2)
MCAD Developing and Implementing Web Applications with Visual C#. NET and Visual Studio. NET (Exam [... ]am 2)
ISBN: 789729016
EAN: N/A
Year: 2005
Pages: 191

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net