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
Windows Forms Quiz
Answer all questions to test your understanding
1
What is the entry point of a Windows Forms application?
Form1.cs
Program.cs
App.config
Main.cs
2
Which file is auto-generated by the Windows Forms designer?
Form1.cs
Form1.Designer.cs
Program.cs
App.config
3
What method in Program.cs starts the Windows Forms application?
Application.Run(new Form1())
Application.Start(new Form1())
Application.Execute(new Form1())
Application.Launch(new Form1())
4
What is the purpose of the [STAThread] attribute in Program.cs?
To make the application run faster
To enable single-threaded apartment mode for COM components
To disable threading
To enable multi-threading
5
What happens when you press F5 in Visual Studio with a WinForms project?
The application builds and runs
The application is published
The application is deployed
The application is closed
6
Which control is used for single-line text input?
Label
TextBox
Button
ComboBox
7
What naming prefix is recommended for a TextBox control?
lbl
txt
btn
cmb
8
What does the Anchor property do in Windows Forms?
Keeps the control centered
Keeps the control's distance fixed from an edge as the form resizes
Makes the control fill the form
Makes the control invisible
9
Which property makes a control fill an entire form or panel?
Anchor
Dock
Margin
Padding
10
How do you read the text from a TextBox in code?
txtName.Value
txtName.Text
txtName.Content
txtName.String
11
What is the most common way to wire up a Button click event?
Double-click the button in the designer
Write code in the constructor
Use the Properties panel
Use the Load event
12
Which event fires when a form first loads?
Click
Load
TextChanged
FormClosing
13
What does the FormClosing event allow you to do?
Prevent the form from closing
Close the form immediately
Minimize the form
Maximize the form
14
Which event fires when text in a TextBox changes?
Click
Load
TextChanged
SelectedIndexChanged
15
What is the signature of a typical event handler in WinForms?
void HandlerName(object sender, EventArgs e)
void HandlerName(EventArgs e)
bool HandlerName(object sender, EventArgs e)
void HandlerName()
16
Which control is used to create a menu bar in Windows Forms?
ToolStrip
MenuStrip
ContextMenuStrip
StatusStrip
17
What method displays a MessageBox with an OK button?
MessageBox.Display()
MessageBox.Show()
MessageBox.Open()
MessageBox.Popup()
18
What does OpenFileDialog.ShowDialog() return?
DialogResult.OK or DialogResult.Cancel
The file path
The file contents
A boolean value
19
How do you access the selected file from OpenFileDialog?
openDialog.SelectedFile
openDialog.FileName
openDialog.FilePath
openDialog.Path
20
What does setting DialogResult = OK do in a custom form?
Closes the form and returns OK to the caller
Minimizes the form
Maximizes the form
Hides the form
21
What control is used to display tabular data in Windows Forms?
ListBox
DataGridView
ComboBox
ListView
22
How do you bind a DataGridView to a DataTable?
dgv.DataSource = table
dgv.DataBind(table)
dgv.SetDataSource(table)
dgv.Bind(table)
23
What property of a ComboBox controls what the user sees?
ValueMember
DisplayMember
TextMember
ShowMember
24
What property of a ComboBox controls the underlying value?
ValueMember
DisplayMember
TextMember
ShowMember
25
What is the purpose of BindingSource in Windows Forms?
To simplify data binding between controls and data sources
To create database connections
To format data for display
To validate user input
26
How do you open a second form without making it modal?
form.Show()
form.ShowDialog()
form.Open()
form.Display()
27
How do you open a second form modally?
form.Show()
form.ShowDialog()
form.Open()
form.Display()
28
How do you get data back from a child form?
Using public properties on the child form
Using static variables
Using global variables
Using the Windows registry
29
What does the using statement do when creating a modal form?
Ensures the form is disposed properly
Makes the form run faster
Prevents the form from closing
Makes the form stay on top
30
What property makes a form an MDI container?
IsMdiContainer
IsMdiParent
MdiContainer
MdiParent
31
Which method is used to execute INSERT, UPDATE, or DELETE commands?
ExecuteReader()
ExecuteNonQuery()
ExecuteScalar()
ExecuteTable()
32
What event is used to refresh the DataGridView after saving?
Click
Load
Custom refresh method
FormClosing
33
How do you check if a user confirmed a delete operation?
MessageBox.Show with Yes/No buttons
MessageBox.Show with OK/Cancel buttons
MessageBox.Show with Yes/No/Cancel buttons
MessageBox.Show with OK only
34
What property tracks the currently selected row in a DataGridView?
CurrentRow
SelectedRow
ActiveRow
FocusedRow
35
How do you clear a TextBox in Windows Forms?
txtBox.Text = ''
txtBox.Clear()
txtBox.Empty()
txtBox.Reset()
Submit Quiz