Font size
WorksheetsC# Programming Basics Quiz
Total questions: 10
Worksheet time: 5mins
What is the purpose of variables in C# programming?
The purpose of variables in C# programming is to handle user input.
The purpose of variables in C# programming is to store and manipulate data.
The purpose of variables in C# programming is to improve code readability.
The purpose of variables in C# programming is to execute conditional statements.
Which data type is used to store whole numbers in C#?
string
int
float
boolean
What is the syntax for declaring an integer variable in C#?
string myVariable;
var myVariable;
double myVariable;
int myVariable;
Which control statement is used to select only a certain part of code?
for
loop
while
if
What is the output of the following code? int x = 5; int y = 3; int z = x + y; Console.WriteLine(z);
2
3
8
15
Which data types are used to store decimal numbers in C#?
double
float
integer
real
What is the purpose of if-else statements in C#?
To declare variables in C#.
To execute a block of code repeatedly.
To control the flow of a program based on conditions.
To handle exceptions in C#.
Select the symbol for equivalence in C#
>
<
=
==
What is the issue with the below code:
Console.Readline("Hello stranger");
Readline
Console
"Hello Stranger"
;
Select the correct statement to find the average of three numbers
average = (num1 + num2 + num3) / 3
average = (num1 + num2 + num3) divide by 3
average = num1 + num2 + num3 / 3
average = (num1 + num2 + num3) / 4
