C# Quiz
Test what you have learned in this C# tutorial. Choose an answer for each question and read the explanation.
Tips
- Try each question before looking back at the lessons
- Revisit any chapter where you made a mistake
- Run small programs with dotnet run to check the answers yourself
Quiz Questions
Exercise
Which line prints text and then moves to a new line?
Exercise
What does Console.ReadLine() return?
Exercise
Which line uses string interpolation correctly?
Exercise
What is the value of 17 / 5 in C# when both are int?
Exercise
In C#, can a switch statement compare strings?
Exercise
How many times does this loop run? for (int i = 1; i < 4; i++)
Exercise
Which type can grow when you add items to it?
Exercise
What does the ref keyword do on a method parameter?
Exercise
What is a constructor in C#?
What Next?
Well done on finishing the C# tutorial. Practise by building a console app for a shop bill, a student result system, or a to-do list using List. Since C# and Java are so similar, the Java tutorial is a great next step.
