What is event-driven programming A) A programming paradigm where execution is determined by a sequence of loops. B) A programming paradigm where execution is determined by user events, sensor outp
What is event-driven programming A) A programming paradigm where execution is determined by a sequence of loops. B) A programming paradigm where execution is determined by user events, sensor outp
int x = 5;
int y = 2;
double result = x / y;
Console.WriteLine(result);
A) 2.5
B) 2
C) Error
D) 5/2
B) 2
Which of the following correctly takes user input in a C# console application?
A) Console.WriteLine();
B) Console.ReadLine();
C) int x = 10;
D) Console.Output();
B) Console.ReadLine();
Which of the following statements about event-driven programming is FALSE?
A) It is based on user interactions like mouse clicks and key presses.
B) It requires event handlers to respond to events.
C) The program runs all code sequentially, ignoring user inputs.
D) It is commonly used in GUI applications.
C) The program runs all code sequentially, ignoring user inputs.
Which of the following is an example of an event source?
A) A variable storing a number
B) A button in a GUI application
C) A comment in code
D) A loop that runs indefinitely
B) A button in a GUI application
Which programming paradigm does event-driven programming belong to?
A) Object-oriented programming
B) Functional programming
C) Procedural programming
D) Reactive programming
A) Object-oriented programming
In C#, which operator is used to get the remainder of a division?
A) /
B) %
C) *
D) //
B) %
What is the .NET Framework primarily used for?
A) Creating mobile applications only
B) Developing Windows, Web, and Web Service applications
C) Writing low-level assembly code
D) Managing hardware devices
B) Developing Windows, Web, and Web Service applications
Which of the following languages can be used with the .NET Framework?
A) C#
B) Visual Basic
C) COBOL
D) All of the above
D) All of the above
What is the first method that runs when a C# console application starts?
A) Start()
B) Execute()
C) Main()
D) Run()
C) Main()
What is the purpose of Console.WriteLine() in C#?
A) To read input from the user
B) To display output on the console
C) To pause program execution
D) To create a new class
B) To display output on the console
Which C# data type is used to store decimal numbers?
A) int
B) string
C) double
D) bool
C) double
What will happen if you try to run a C# application without the .NET Framework
installed on the computer?
A) It will run normally
B) It will display an error message
C) It will convert to another programming language
D) It will run but with limited features
B) It will display an error message
Which C# data type is used to store true or false values?
A) int
B) string
C) bool
D) double
C) bool
What does the Console.ReadLine() method do in C#?
A) Prints a message to the console
B) Reads input from the user
C) Pauses the program indefinitely
D) Closes the console application
B) Reads input from the user
Which part of a C# program must match the file name?
A) Method name
B) Class name
C) Namespace name
D) Variable name
B) Class name
Which of the following statements is TRUE about C#?
A) C# is not an object-oriented programming language
B) C# can only be used for web applications
C) C# runs on the .NET Framework
D) C# does not support console applications
C) C# runs on the .NET Framework
What is the starting point of every C# console application?
A) Console.WriteLine()
B) Main() method
C) namespace declaration
D) using statement
B) Main() method
What is the purpose of the using statement in C#?
A) It defines the starting point of the program
B) It is used to include namespaces in a program
C) It declares a variable
D) It stops the program from running
B) It is used to include namespaces in a program
What will happen if you don't include Console.ReadKey() at the end of a console
application?
A) The program will not compile
B) The program will crash
C) The console window will close immediately after execution
D) The program will run indefinitely
C) The console window will close immediately after execution
Which of the following is NOT a valid C# data type?
A) int
B) float
C) text
D) bool
C) text
What is the correct way to declare a boolean variable in C#?
A) boolean isTrue = true;
B) bool isTrue = true;
C) bool isTrue = "true";
D) Boolean isTrue = "true";
B) bool isTrue = true;
Which keyword is used to define a class in C#?
A) define
B) struct
C) class
D) object
C) class
Which of the following is NOT a part of the .NET Framework?
A) Common Language Runtime (CLR)
B) Framework Class Library (FCL)
C) Java Virtual Machine (JVM)
D) .NET Compiler
C) Java Virtual Machine (JVM)
What will be the output of the following C# program?
int x = 10;
x += 5;
Console.WriteLine(x);
A) 10
B) 5
C) 15
D) Error
C) 15
Which keyword is used in C# to accept user input from the console?
A) Console.WriteLine()
B) Console.ReadLine()
C) Console.ReadKey()
D) Console.Write()
B) Console.ReadLine()
What will be the output of the following C# code?
int a = 5, b = 2;
double result = (double)a / b;
Console.WriteLine(result);
A) 2
B) 2.5
C) 2.0
D) Error
B) 2.5
What will be the output of the following C# code?
int num = 10;
num++;
Console.WriteLine(num);
A) 9
B) 10
C) 11
D) Error
C) 11
Which of the following is NOT a valid C# variable name?
A) _studentName
B) 2ndScore
C) total_amount
D) firstName
B) 2ndScore
What will be the value of result after executing the following code?
int a = 5;
int b = 2;
double result = a / b;
Console.WriteLine(result);
A) 2.5
B) 2
C) 2.0
D) Error
B) 2
What does GUI stand for?
a) General User Interaction
b) Graphical User Interface
c) General Unified Interface
d) Graphical Utility Input
b) Graphical User Interface
What is the main purpose of a GUI?
a) To allow users to interact with a program visually
b) To speed up the computer’s processing power
c) To write code more efficiently
d) To store large amounts of data
a) To allow users to interact with a program visually
Which C# framework is used to create graphical user interfaces in Visual Studio?
a) Windows Console Application
b) ASP.NET Core
c) Windows Forms
d) Java Swing
c) Windows Forms
Which of the following is NOT a GUI control in C#?
a) Label
b) TextBox
c) Timer
d) Console
d) Console
What is the purpose of the Toolbox in Visual Studio?
a) To store project files
b) To provide a collection of GUI controls and components
c) To debug C# applications
d) To execute C# code
b) To provide a collection of GUI controls and components
Where is the Toolbox located in Visual Studio by default?
a) Bottom-right corner
b) Top menu bar
c) Left-hand side
d) Middle of the screen
c) Left-hand side
How do you add a component from the Toolbox to a form?
a) Click on the component and press Enter
b) Click and drag the component onto the form
c) Right-click and select "Add to Form"
d) Type the component name manually in the code
b) Click and drag the component onto the form
Which of the following controls is used to display text but cannot be edited by the
user?
a) TextBox
b) Label
c) ComboBox
d) ListBox
b) Label
What property should be modified to change the text displayed on a Label
control?
a) Text
b) Name
c) Font
d) Visible
a) Text
What is the naming convention prefix for a Button control?
a) txt
b) lbl
c) btn
d) box
c) btn
What is the correct way to name a TextBox used for entering a username?
a) lblUsername
b) txtEnterName
c) btnUser
d) boxUsername
b) txtEnterName
What happens when you double-click a button in the design view of Visual Studio?
a) The button is removed from the form
b) The properties window opens
c) The event handler for the button’s Click event is created in the code
d) A new button is added to the form
c) The event handler for the button’s Click event is created in the code
What is an event handler in C#?
a) A property that determines how a button looks
b) A method that runs when a specific event occurs, such as clicking a button
c) A class that stores all the controls in a GUI
d) A special setting in the properties window
b) A method that runs when a specific event occurs, such as clicking a button
Which of the following is an example of an event?
a) Setting a button’s background color
b) Clicking a button
c) Writing code in the editor
d) Changing the font of a Label
b) Clicking a button
What event is triggered when a user types in a TextBox?
a) Click
b) TextChanged
c) Enter
d) Load
b) TextChanged
Which property should be set to True to make a TextBox behave like a password
field?
a) HideText
b) PasswordMode
c) UseSystemPasswordChar
d) MaskInput
c) UseSystemPasswordChar
How do you retrieve the text entered in a TextBox named txtUserName?
a) string userName = GetText(txtUserName);
b) string userName = txtUserName.Text;
c) string userName = InputText(txtUserName);
d) string userName = txtUserName.Value;
b) string userName = txtUserName.Text;
What will the following line of code do?
txtUserName.Text = "";
MessageBox.Show("Thank you!");