Recall & Review
beginner
What does the format specifier "C" do when formatting numbers in C#?
The "C" specifier formats a number as currency, adding the currency symbol and two decimal places by default.
Click to reveal answer
beginner
How do you format a DateTime to show only the year and month in C#?
Use the format specifier "yyyy-MM" with DateTime.ToString(), which shows the full year and two-digit month.
Click to reveal answer
intermediate
What is the difference between "D" and "d" format specifiers for dates in C#?
"D" shows the long date pattern (e.g., "Monday, June 5, 2023"), while "d" shows the short date pattern (e.g., "6/5/2023").
Click to reveal answer
beginner
How does the "N" format specifier format numbers in C#?
"N" formats numbers with thousands separators and two decimal places by default (e.g., "1,234.56").
Click to reveal answer
beginner
What does the format specifier "F" do when formatting numbers?
"F" formats a number as a fixed-point number with a default of two decimal places (e.g., "1234.56"). You can specify decimals like "F3" for three decimals.
Click to reveal answer
Which format specifier would you use to display a number as currency in C#?
✗ Incorrect
The "C" specifier formats numbers as currency, adding the currency symbol and decimals.
What does the "d" format specifier show when formatting a DateTime?
✗ Incorrect
"d" shows the short date pattern, which is a concise date format.
How would you format a number with thousands separators and two decimals in C#?
✗ Incorrect
"N" adds thousands separators and formats with two decimals by default.
Which format specifier shows the full year and month in a DateTime string?
✗ Incorrect
Using "yyyy-MM" custom format shows the full year and two-digit month.
What does the "F3" format specifier do when formatting a number?
✗ Incorrect
"F3" formats a number as fixed-point with exactly 3 decimal places.
Explain how to format a number as currency and as a fixed-point number in C#.
Think about how money and precise decimals look.
You got /4 concepts.
Describe the difference between the "D" and "d" date format specifiers in C#.
One is detailed, the other is brief.
You got /4 concepts.