Font size
WorksheetsC# Programming Quiz
Total questions: 25
Worksheet time: 25mins
The command to compile a C# program is (a) .
The starting point of every C# program is the (a) method.
A C# source code file ends with the extension (a) .
To read input from the user, we use Console. (a) ().
To print text with a new line, we use Console. (a) ().
Every variable in C# must have a data type.
True
False
The operator ! means NOT in C#.
True
False
int is used for decimal numbers.
True
False
The for loop repeats a block of code a set number of times.
True
False
The try-catch statement is used to handle exceptions.
True
False
Which is NOT included in the .NET SDK?
C# Compiler
.NET CLI
Visual Studio
Which of the following is NOT a C# data type?
int
bool
text
Which operator checks if two values are equal?
=
==
!=
Which loop guarantees at least one execution of its body?
for
while
do-while
Which statement is best for multiple-choice branching?
if
switch
try
Which keyword is used to declare a constant?
var
const
static
Which jump statement ends the current loop immediately?
continue
break
return
Which jump statement skips the current loop cycle?
break
continue
exit
Which part of exception handling always runs, even if there is no error?
throw
catch
finally
Which keyword lets the compiler decide the type automatically?
auto
var
let
What will this print? int number = 5; Console.WriteLine(number);
5
number
Error
What is the result? Console.WriteLine(10 / 2);
2
5
10/2
What is the output? int a = 5, b = 10; Console.WriteLine(a > b ? "Yes" : "No");
Yes
No
Which converts a string to an integer?
int.Parse()
Convert.ToInt32()
Both
What will this program print? string[] fruits = { "Apple", "Banana" }; foreach (string f in fruits) { Console.WriteLine(f); }
Apple
Banana
Apple Banana
