Test Your Knowledge: Quiz
Question 3-1. What defines a statement in C#?
Question 3-2. What values can a bool
type have?
Question 3-3. What are the two kinds of types in C#, and what’s the difference between them?
Question 3-4. What is the difference between a float
and a double
?
Question 3-5. What’s the definition of a variable?
Question 3-6. What does definite assignment mean?
Question 3-7. Which of the following code statements will compile?
int myInt = 25; long myLong = myInt; int newInt = myLong;
Question 3-8. For each of the following pieces of data, which variable type would you use, and which should be represented with constants?
Your age in years
The speed of light in meters per second
The number of widgets in your warehouse
The amount of money in your bank account
The text of the U.S. Declaration of Independence
Question 3-9. Given the following declaration, how would you refer to the constant for Green
and what would its value be?
enum WavelengthsOfLight { Red = 7000, Orange = 6200, Yellow = 5800, Green = 5300, Blue = 4700, Violet = 4200 }
Question 3-10. How do you indicate a string literal?
Get Learning C# 3.0 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.