General C# Flashcards
(19 cards)
How can the C# programming language be described?
C# is a general-purpose, type-safe, object-oriented programming language
What return type(s) does the Main
function have?
It may have void or integer to return a value
What parameters can the Main
function have?
Either none or an array of strings
What are identifiers?
Names that programmers choose for their classes, methods, variables and so on.
What should be written in camel case?
Parameters, local variables and private fields
What should be written in Pascal case?
All identifiers except: parameters, local variables and private fields
What are keywords?
Names that mean something special to the compiler
How can you use an identifier that clashes with a reserved keyword?
You can do this by qualifying it with the @
prefix (e.g. class @class
)
What are punctuators?
Punctuators help demarcate the structure of the program (e.g. {
, }
and ;
)
What are implicit conversions?
Conversions that happen automatically
What are explicit conversions?
Conversions that require a cast
When are implicit conversions allowed?
When the compiler can guarantee they will always succeed and no information is lost in conversion. (Except very large long values lose some precision when converted to double)
When is an explicit conversion required?
When the compiler can not guarantee the will always succeed or if information may be lost during conversion.
When is a variable/constant a value type variable/constant?
When the content is simply a value
What is a reference type variable/constant?
It’s a type consisting of two parts: and object and the reference, where the content is the reference to the object that holds the value.
For which types are the numeric operators (+, -, *, /, %) defined?
For all numeric types except the 8- and 16-bit integral types.
What makes a valid identifier
A valid identifier must be a whole word, made up of Unicode characters, starting with a letter or underscore.
What are contextual keywords?
With contextual keywords, ambiguity cannot arise within the context in which they are used and can therefor be used as identifiers.
What does an operator do?
An operator transforms and combines expressions.