Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to print "Hello World" in the Unity console.
Unity
Debug.[1]("Hello World");
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using Debug.Print instead of Debug.Log
Trying to use Console.WriteLine which is not used in Unity
✗ Incorrect
Use Debug.Log to print messages to the Unity console.
2fill in blank
mediumComplete the code to print the value of the variable score using Debug.Log.
Unity
int score = 10; Debug.[1]($"Score is {score}");
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using Debug.Print or Debug.Write which do not exist in Unity
Forgetting the $ before the string for interpolation
✗ Incorrect
Use Debug.Log to print variables with string interpolation.
3fill in blank
hardFix the error in the code to correctly print the player's name.
Unity
string playerName = "Alex"; Debug.[1](playerName);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using
Println or WriteLine which are not Unity methodsTrying to use
Debug.Show which does not exist✗ Incorrect
Unity uses Debug.Log to print messages, not Println or WriteLine.
4fill in blank
hardFill both blanks to print the player's score only if it is greater than 50.
Unity
int score = 75; if (score [1] 50) { Debug.[2]($"High score: {score}"); }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using
< instead of > in the conditionUsing
Debug.Print which is not a Unity method✗ Incorrect
Use > to check if score is greater than 50 and Debug.Log to print the message.
5fill in blank
hardFill all three blanks to create a dictionary of player names and scores, then print only those with scores above 80.
Unity
var playerScores = new Dictionary<string, int> {
{"Alice", 90},
{"Bob", 70},
{"Charlie", 85}
};
foreach (var [1] in playerScores)
{
if ([2].Value [3] 80)
{
Debug.Log($"[2].Key scored [2].Value");
}
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names inconsistently
Using < or = instead of > in the condition
✗ Incorrect
Use player as the loop variable, check if player.Value > 80, and print the player's name and score.