Basics C#
Its a quiz about the basics of c#!
1 / 10
What does the following line of code do?
Console.WriteLine(“Hello, World!”);
a) It creates a new variable.
b) It displays the message "Hello, World!" on the screen.
c) It asks the user for input.
d) It opens a new window.
2 / 10
Which data type would you use to store a decimal number like 3.14?
a) bool
b) int
c) string
d) double
3 / 10
What does the + symbol do in this line of code?
+
Console.WriteLine(“Name: ” + playerName);
a) It adds two numbers together.
b) It joins (concatenates) the text "Name: " with the value of playerName.
c) It creates a new string.
d) It multiplies two values.
4 / 10
Which of the following is a valid variable name in C#?
a) 2ndNumber
b) firstName
c) void
d) true
5 / 10
What does the Main method in a C# program do?
Main
a) It asks the user for input.
b) It stores information.
c) It’s the starting point of your program where the computer begins running the code.
d) It creates variables for the program.
6 / 10
What does this code output?
int age = 15; Console.WriteLine(“Age: ” + age);
a) Age: 15
b) 15
c) Age: age
d) It won’t print anything.
7 / 10
What’s wrong with this line of code?
string name = Alice;
a) The variable name is wrong.
b) You can’t use Alice as a variable name.
c) The text should be inside quotes: "Alice".
d) There is nothing wrong with this code.
8 / 10
Which data type would you use to store the result of a true or false condition?
b) string
c) int
d) char
9 / 10
Which data type would you use to store a whole number (like 10)?
a) string
b) bool
10 / 10
What is a variable in C#?
a) A command that runs a loop.
b) A place to store information, like a number or text.
c) A type of function that prints messages.
d) A tool used to display errors.
Your score is
The average score is 84%
Restart quiz