0
0
C Sharp (C#)programming~10 mins

Main method as entry point in C Sharp (C#) - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to declare the main method as the entry point.

C Sharp (C#)
static void [1](string[] args) {
    Console.WriteLine("Hello World");
}
Drag options to blanks, or click blank then click option'
AEntry
BMain
CRun
DStart
Attempts:
3 left
💡 Hint
Common Mistakes
Using a method name other than Main.
Forgetting the string[] args parameter.
2fill in blank
medium

Complete the code to make the main method accessible as the program entry point.

C Sharp (C#)
[1] static void Main(string[] args) {
    Console.WriteLine("Welcome!");
}
Drag options to blanks, or click blank then click option'
Aprivate
Bprotected
Cpublic
Dinternal
Attempts:
3 left
💡 Hint
Common Mistakes
Using private or protected access modifiers.
Omitting the access modifier.
3fill in blank
hard

Fix the error in the main method declaration to make it a valid entry point.

C Sharp (C#)
public static [1] Main(string[] args) {
    Console.WriteLine("Start");
}
Drag options to blanks, or click blank then click option'
Avoid
Bint
Cstring
Dbool
Attempts:
3 left
💡 Hint
Common Mistakes
Using a return type other than void or int without returning a value.
Forgetting to specify a return type.
4fill in blank
hard

Fill both blanks to declare a main method that returns an integer exit code.

C Sharp (C#)
public static [1] Main(string[] [2]) {
    return 0;
}
Drag options to blanks, or click blank then click option'
Aint
Bargs
Cargv
Dvoid
Attempts:
3 left
💡 Hint
Common Mistakes
Using void return type when returning a value.
Using incorrect parameter names.
5fill in blank
hard

Fill all three blanks to declare a valid main method with string array parameter and return type.

C Sharp (C#)
[1] static [2] Main([3][] args) {
    Console.WriteLine("Program started");
    return 0;
}
Drag options to blanks, or click blank then click option'
Apublic
Bint
Cstring
Dvoid
Attempts:
3 left
💡 Hint
Common Mistakes
Using void return type but returning a value.
Using wrong parameter type.