General C# Flashcards

(19 cards)

1
Q

How can the C# programming language be described?

A

C# is a general-purpose, type-safe, object-oriented programming language

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What return type(s) does the Main function have?

A

It may have void or integer to return a value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What parameters can the Main function have?

A

Either none or an array of strings

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are identifiers?

A

Names that programmers choose for their classes, methods, variables and so on.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What should be written in camel case?

A

Parameters, local variables and private fields

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What should be written in Pascal case?

A

All identifiers except: parameters, local variables and private fields

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are keywords?

A

Names that mean something special to the compiler

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How can you use an identifier that clashes with a reserved keyword?

A

You can do this by qualifying it with the @ prefix (e.g. class @class)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are punctuators?

A

Punctuators help demarcate the structure of the program (e.g. {, } and ;)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are implicit conversions?

A

Conversions that happen automatically

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are explicit conversions?

A

Conversions that require a cast

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

When are implicit conversions allowed?

A

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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

When is an explicit conversion required?

A

When the compiler can not guarantee the will always succeed or if information may be lost during conversion.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

When is a variable/constant a value type variable/constant?

A

When the content is simply a value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a reference type variable/constant?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

For which types are the numeric operators (+, -, *, /, %) defined?

A

For all numeric types except the 8- and 16-bit integral types.

17
Q

What makes a valid identifier

A

A valid identifier must be a whole word, made up of Unicode characters, starting with a letter or underscore.

18
Q

What are contextual keywords?

A

With contextual keywords, ambiguity cannot arise within the context in which they are used and can therefor be used as identifiers.

19
Q

What does an operator do?

A

An operator transforms and combines expressions.