Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to print a line with a new line at the end.
C Sharp (C#)
Console.[1]("Hello, world!");
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using Write instead of WriteLine when a new line is needed.
✗ Incorrect
The WriteLine method prints the text and moves to the next line.
2fill in blank
mediumComplete the code to print text without moving to a new line.
C Sharp (C#)
Console.[1]("Hello, "); Console.WriteLine("world!");
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using WriteLine when you want to continue printing on the same line.
✗ Incorrect
The Write method prints text but stays on the same line.
3fill in blank
hardFix the error in the code to print two lines correctly.
C Sharp (C#)
Console.[1]("First line"); Console.[1]("Second line");
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using Write which does not add a new line, causing lines to run together.
✗ Incorrect
To print two separate lines, use WriteLine for both so each ends with a new line.
4fill in blank
hardFill both blanks to print numbers 1 to 3 on the same line separated by spaces.
C Sharp (C#)
for (int i = 1; i <= 3; i++) { Console.[1](i + " "); } Console.[2]();
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using WriteLine inside the loop causing each number to print on a new line.
✗ Incorrect
Use Write inside the loop to print numbers on the same line, then WriteLine to move to the next line after the loop.
5fill in blank
hardFill all three blanks to print a greeting with a name on the same line.
C Sharp (C#)
string name = "Alice"; Console.[1]("Hello, "); Console.[2](name); Console.[3]("!");
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using WriteLine which moves to a new line after each print.
✗ Incorrect
Use Write for all parts to print on the same line without moving to a new line.