Review Questions

1:Why are there two ways to categorize the types in C#?
2:Why does C# have other simple types than int?
3:Which kind of attributes distinguish the different types from each other?
4:What does it mean to be a strongly typed language like C#?
5:Is it possible to assign a value of type int to a variable of type short, without an explicit conversion? Why or why not?
6:How do you specify a literal to be of type float?
7:Write a line of code that declares a private instance variable called distance, which is of type float and is initialized to 100.5.
8:A variable of type byte is holding the value 255. The program now attempts to increment the value by one. What happens: If the compiler switch is set to unchecked? If it is set to checked? ...

Get C# Primer Plus 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.