Exam 70-536 : .NET Framework Application Development Foundation Part – 15

Question: You write the following code to implement the CompanyClass.MyMethod function.
public class CompanyClass
{
public int MyMethod(int arg)
{
return arg;
}
}

You need to call the CompanyClass.MyMethod function dynamically from an unrelated class in your assembly. Which code segment should you use?

  1. CompanyClass myClass = new CompanyClass();
    Type t = typeof(CompanyClass);
    MethodInfo m = t.GetMethod("MyMethod");
    int i = (int)m.Invoke(this, new object[] { 1 });
  2. CompanyClass myClass = new CompanyClass();
    Type t = typeof(CompanyClass);
    MethodInfo m = t.GetMethod("MyMethod");
    int i = (int) m.Invoke(myClass, new object[] { 1 });
  3. CompanyClass myClass = new CompanyClass();
    Type t = typeof(CompanyClass);
    MethodInfo m = t.GetMethod("CompanyClass.MyMethod");
    int i = (int)m.Invoke(myClass, new object[] { 1 });
  4. Type t = Type.GetType("CompanyClass");
    MethodInfo m = t.GetMethod("MyMethod");
    int i = (int)m.Invoke(this, new object[] { 1 });

Correct Answer: 2


Question: You are developing an application for a client residing in Hong Kong. You need to display negative currency values by using a minus sign. Which code segment should you use?

  1. NumberFormatInfo culture = new CultureInfo("zh-HK").NumberFormat;
    culture.NumberNegativePattern = 1;
    return numberToPrint.ToString("C", culture);
  2. NumberFormatInfo culture = new CultureInfo("zh-HK").NumberFormat;
    culture.CurrencyNegativePattern = 1;
    return numberToPrint.ToString("C", culture);
  3. CultureInfo culture = new CultureInfo("zh-HK");
    return numberToPrint.ToString("-(0)", culture);
  4. CultureInfo culture = new CultureInfo("zh-HK");
    return numberToPrint.ToString("()", culture);

Correct Answer: 2


Question: You are writing a method that accepts a string parameter named message. Your method must break the message parameter into individual lines of text and pass each line to a second method named Process. Which code segment should you use?

  1. StringReader reader = new StringReader(message);
    Process(reader.ReadToEnd());
    reader.Close();
  2. StringReader reader = new StringReader(message);
    while (reader.Peek() != -1)
    {
    string line = reader.Read().ToString();
    Process(line);
    }
    reader.Close();
  3. StringReader reader = new StringReader(message);
    Process(reader.ToString());
    reader.Close();
  4. StringReader reader = new StringReader(message);
    while (reader.Peek() != -1)
    {
    Process(reader.ReadLine());
    }
    reader.Close();

Correct Answer: 4


Question: You are developing a fiscal report for a customer. Your customer has a main office in the United States and a satellite office in Mexico. You need to ensure that when users in the satellite office generate the report, the current date is displayed in Mexican Spanish format. Which code segment should you use?

  1. DateTimeFormatInfo dtfi = new CultureInfo("es-MX", false).DateTimeFormat;
    DateTime dt = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day);
    string dateString = dt.ToString(dtfi.LongDatePattern);
  2. Calendar cal = new CultureInfo("es-MX", false).Calendar;
    DateTime dt = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day);
    Strong DateString = dt.ToString();
  3. string dateString = DateTimeFormatInfo.CurrentInfoGetMonthName(DateTime.Today.Month);
  4. string dateString = DateTime.Today.Month.ToString("es-MX");

Correct Answer: 1


Question: You create an application that stores information about your customers who reside in various regions. You are developing internal utilities for this application. You need to gather regional information about your customers in Canada. Which code segment should you use?

  1. foreach (CultureInfo culture in
    CultureInfo.GetCultures(CultureTypes.SpecificCultures))
    {
    // Output the region information...
    }
  2. CultureInfo cultureInfo = new CultureInfo("CA");
    // Output the region information
  3. RegionInfo regionInfo = new RegionInfo("CA");
    // Output the region information
  4. RegionInfo regionInfo = new RegionInfo("");
    if(regionInfo.Name == "CA")
    {
    // Output the region information
    }

Correct Answer: 3


Question: You need to generate a report that lists language codes and region codes. Which code segment should you use?

  1. foreach (CultureInfo culture in CultureInfo.GetCultures(CultureTypes.SpecificCultures))
    {
    // Output the culture information...
    }
  2. CultureInfo culture = new CultureInfo("");
    CultureTypes types = culture.Culture Types;
    // Output the culture information...
  3. foreach (CultureInfo culture in CultureInfo.GetCultures(CultureTypes.NeutralCultures))
    {
    // Output the culture information...
    }
  4. foreach (CultureInfo culture in CultureInfo.GetCultures(CultureTypes.ReplacementCultures))
    {
    // Output the culture information...
    }

Correct Answer: 1

Tagged . Bookmark the permalink.

One Response to Exam 70-536 : .NET Framework Application Development Foundation Part – 15

  1. Zed says:

    If you can create a class using new, what’s the purpose of calling the method of this class using GetMethod() instead of calling method directly?

Leave a Reply