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

Top-level statements in modern 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 print "Hello, World!" using top-level statements.

C Sharp (C#)
Console.[1]("Hello, World!");
Drag options to blanks, or click blank then click option'
AWriteLine
BPrint
CDisplay
DOutput
Attempts:
3 left
💡 Hint
Common Mistakes
Using methods like Print or Display which do not exist in Console.
Forgetting the parentheses after the method name.
2fill in blank
medium

Complete the code to declare a variable and print its value using top-level statements.

C Sharp (C#)
int number = 5;
Console.[1](number);
Drag options to blanks, or click blank then click option'
APrint
BShow
CDisplay
DWriteLine
Attempts:
3 left
💡 Hint
Common Mistakes
Using methods that do not exist in Console like Print or Show.
Trying to print without parentheses.
3fill in blank
hard

Fix the error in the top-level statement that tries to read input from the user.

C Sharp (C#)
string name = Console.[1]();
Console.WriteLine($"Hello, {name}!");
Drag options to blanks, or click blank then click option'
ARead
BReadLine
CInput
DGetLine
Attempts:
3 left
💡 Hint
Common Mistakes
Using Console.Read which reads a single character code.
Using non-existent methods like Input or GetLine.
4fill in blank
hard

Fill both blanks to declare a variable and print a message using top-level statements.

C Sharp (C#)
var [1] = "C#";
Console.[2]($"Learning [1] is fun!");
Drag options to blanks, or click blank then click option'
Alanguage
BWriteLine
CPrint
Dcode
Attempts:
3 left
💡 Hint
Common Mistakes
Using invalid variable names.
Using Console.Print which does not exist.
5fill in blank
hard

Fill all three blanks to declare two variables and print their sum using top-level statements.

C Sharp (C#)
int [1] = 10;
int [2] = 20;
Console.[3]([1] + [2]);
Drag options to blanks, or click blank then click option'
Aa
Bb
CWriteLine
DPrint
Attempts:
3 left
💡 Hint
Common Mistakes
Using invalid method names like Print.
Using variable names that are not consistent.