Chapter 12: Internationalization
1. How do you set a button jbt's text to a character with the Unicode 13AE?
a. jbt.setText("13AE");
b. jbt.setText("\13AE");
c. jbt.setText("\u13AE");
d. jbt.setText("/u13AE");
e. jbt.setText('\u13AE');
#
2. How do you create a locale for the United States?
a. new Locale("en", "US");
b. new Locale("US", "en");
c. Locale.US;
d. a and c;
#
3. Which of the following method is defined in the Locale class?
a. getLanguage();
b. getCountry();
c. getVariant();
d. all the above;
#
4. Which of the following method is correct to obtain the available locales in the classes Calendar, Collator, DateFormat, and NumberFormat?
a. getLocales();
b. getAllLocales();
c. getAvailableLocales();
d. None of the above;
#
5. Which of the following set of code lines displays the current time in locale sensitive format?
a.
GregorianCalendar gcal = new GregorianCalendar();
System.out.println(gcal.toString());
b.
Date d = new Date();
System.out.println(d.toString());
c.
GregorianCalendar gcal = new
GregorianCalendar(new TimeZone("CST"));
System.out.println(gcal.toString());
d.
GregorianCalendar gcal = new GregorianCalendar();
DateFormat myFormat = DateFormat.getDateTimeInstance();
myFormat.setTimeZone(TimeZone.getTimeZone("CST"));
System.out.println(myFormat.format(gcal.getTime()));
#
6. Which of the following code is correct to obtain hour from a Calendar object cal?
a. cal.getHour();
b. cal.hour();
c. cal.get(Hour);
d. cal.get(Calendar.HOUR);
#
7. Which of the following code is correct to set a time zone in a Calendar object?
a. cal.timeZone("CST");
b. cal.setTimeZone("CST");
c. cal.getTimeZone();
d. cal.get(Calendar.HOUR);
#
8. Which of the following are the valid date and time format?
a. SHORT;
b. MEDIUM;
c. LONG;
d. FULL;
e. All the above;
#
9. Which of the following code is correct to create an instance for formatting numbers?
a. NumberFormat.getPercentInstance(locale);
b. NumberFormat.getNumberInstance(locale);
c. NumberFormat.getInstance(locale);
d. None of the above;
#
10. Which of the following code is correct to create an instance of ResourceBundle?
a. ResourceBundle.getBundle();
b. ResourceBundle.getBundle(locale);
c. ResourceBundle.getBundle(resourcefilename);
d. None of the above;
#
11. Which of the following code displays the numbers with at least two digits before and after the decimal point?
a.
NumberFormat numberForm = NumberFormat.getNumberInstance();
DecimalFormat df = (DecimalFormat)numberForm;
df.applyPattern("00.00");
b.
NumberFormat numberForm = NumberFormat.getNumberInstance();
numberForm.setMaximumFractionDigits(2);
numberForm.setMinimumFractionDigits(2);
c.
NumberFormat numberForm = NumberFormat.getNumberInstance();
numberForm.setMaximumFractionDigits(2);
d. a and b.
& End of the questions. Answers begins
1.c
2.d
3.d
4.c
5.d
6.d
7.c
8.e
9.a
10.c
11.a