The Main Method Flashcards

1
Q

What is the Main method?

A

The entry point of a C# application.

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

Do libraries and services require the Main method?

A

No.

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

What happens when an application starts?

A

The Main method is invoked.

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

How many entry points can exist in a C# application?

A

One.

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

From what version of C# can you write statements at the top level of the C# file and have them executed as if they were inside the Main method?

A

C# 9.

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

Can the Main method be public?

A

No.

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

Can the Main method be declared as an instance method?

A

No.

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

What are the possible return values of the Main method?

A

void or int.

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

Starting from C# 7.1, what additional possible return types were added to the Main method?

A

Task and Task.

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

When specifying the Main method with return value Task or Task, what modifier is needed?

A

The async modifier.

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

Does the Main method receive arguments?

A

Yes, and it is optional to specify the parameter, it is an array of strings that represent the arguments passed to the executable.

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

When the Main method returns an int, what does this value mean?

A

The exit status of the program.

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