Top Level Statements Flashcards

1
Q

What are top-level statements?

A

Statements that are not part of a class method or namespace.

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

Starting from what version of C# is using top-level statements allowed?

A

C# 9.

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

How many files with top-level statements can exist in a C# program?

A

One.

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

In a file with top-level statements, can you include using directives?

A

Yes, but they must be placed before the top-level statements.

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

Can a file with top-level statements contain namespaces and types?

A

Yes, but they must come after the top-level statements.

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

How can you access the arguments of an executable in a file with top-level statements?

A

Using the pre-declared args variable.

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

Can you use await in a file with top-level statements?

A

Yes.

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

Can you return an int in the top-level statements?

A

Yes.

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