Microsoft Certified Solutions Developer (MCSD) Certification Practice Test

Disable ads (and more) with a membership for a one time $2.99 payment

Prepare for the Microsoft Certified Solutions Developer Test with flashcards and multiple choice questions. Each question comes with hints and explanations. Boost your confidence for the exam day!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


Which of these is used to format currency in C#?

  1. C

  2. d

  3. D

  4. M

The correct answer is: C

The formatting character used to format currency in C# is indeed the letter "C." When you apply this format specifier to a numeric value, it instructs the .NET framework to convert the number to a string that represents a currency value, formatted according to the culture-specific settings of the environment in which the code is running. For example, if you have a decimal value representing money and use the "C" format specifier, it will display the value with the appropriate currency symbol and format, such as including commas for thousands and two decimal places. This makes it particularly useful when you need to output monetary values in applications that deal with financial transactions. The other choices do not serve this purpose: "d" and "D" are used for formatting dates, while "M" is typically used for month formatting. Therefore, they do not provide the correct representation for currency values in C#.