C# Mastery Hub
Home
Challenges
Discussion
Lessons
Core Topics
C# Fundamentals
Console Applications
Classes & OOP
Windows Forms
ASP.NET Core
SQL Server
VS & SQL Connection
RDLC Reports
.NET MAUI
Getting Started
Getting Started
Website Development
SEO Guide
Security
Project Workflow
Extra Topics
Cloud & Deployment
AWS Cloud
Deployment
About
Contact
Test Your Knowledge
Console Applications Quiz
Answer all questions to test your understanding
1
What is the entry point of a C# console application?
Main()
Start()
Run()
Execute()
2
Which command creates a new console application using .NET CLI?
dotnet new console
dotnet create console
dotnet new app
dotnet init console
3
What is the purpose of the 'using System;' statement in a C# file?
To import the System namespace
To create a new System object
To define a new class
To declare a variable
4
Which Visual Studio template is used for creating a console application?
Console App (.NET Core)
Windows Forms App
ASP.NET Core Web App
Class Library
5
What is the difference between Console.Write() and Console.WriteLine()?
Write() adds a new line, WriteLine() doesn't
WriteLine() adds a new line, Write() doesn't
They do the same thing
Write() only works with numbers
6
Which method is used to read user input from the console?
Console.Read()
Console.ReadLine()
Console.ReadKey()
All of the above
7
What is string interpolation in C#?
A way to concatenate strings using +
A way to embed expressions inside strings using $
A method to replace characters
A way to split strings
8
Which method should you use to safely convert a string to an integer?
int.Parse()
Convert.ToInt32()
int.TryParse()
All of the above are equally safe
9
How do you change the text color in a console application?
Console.Color = ConsoleColor.Red;
Console.ForegroundColor = ConsoleColor.Red;
Console.TextColor = ConsoleColor.Red;
Console.SetColor(ConsoleColor.Red);
10
What is the purpose of separating calculation logic into a separate class?
To follow the Single Responsibility Principle
To make the code run faster
To use more memory
To make the code more complex
11
Which exception is thrown when dividing by zero in C#?
NullReferenceException
DivideByZeroException
ArgumentException
IndexOutOfRangeException
12
What is the purpose of a while loop in the calculator application?
To keep the program running until the user exits
To make the program faster
To calculate multiple operations at once
To display the menu only once
13
Why should you use try-catch blocks in a calculator application?
To make the code run faster
To handle errors gracefully without crashing
To avoid writing validation code
To make the code more complex
14
Which namespace contains file handling classes in C#?
System.IO
System.File
System.Data
System.Collections
15
Which method writes text to a file and overwrites if the file already exists?
File.AppendAllText()
File.WriteAllText()
File.AddText()
File.CreateText()
16
What is the purpose of the 'using' statement with StreamReader/StreamWriter?
To make the code run faster
To automatically dispose of resources
To import namespaces
To create a new file
17
How do you check if a file exists in C#?
File.Exists()
File.IsExists()
File.CheckExists()
File.HasFile()
18
Which method reads all lines from a file into a string array?
File.ReadAllText()
File.ReadAllLines()
File.ReadLines()
File.ReadText()
Submit Quiz