Visual Programming MCQs with Answers
Practice important Visual Programming MCQs with answers and explanations.
Multiple Choice Questions
Q111: What is unboxing in C#?
- A: Converting a string to a char
- B: Storing a reference type in a value type
- C: Retrieving a value type from a reference type
- D: Converting a class to an interface
View Answer
C
Q112: Which of the following is an example of Generics in C#?
- A: Public class genericlist
- B: Public class genericlist<>
- C: Public class genericlist
- D: Public class genericlist
View Answer
D
Q113: What is the purpose of pre-processor directives like #if, #else, and #endif in C#?
- A: To manage memory
- B: To control conditional compilation
- C: To declare variables
- D: To define classes
View Answer
B
Q114: Which syntax is used for single-line comments in C#?
- A:
- B: /* comment */
- C: // comment
- D: # comment
View Answer
C
Q115: What is the purpose of XML documentation in C#?
- A: To create a user manual
- B: To generate documentation comments for code
- C: To compile the program
- D: To manage memory
View Answer
B
Q116: What does the using directive do in C#?
- A: It manages memory automatically
- B: It imports namespaces for use in the code
- C: It compiles the program
- D: It defines global variables
View Answer
B
Q117: How do you keep the console window from disappearing quickly when running a C# program in Visual Studio?
- A: Use System.wait()
- B: Use Console.readkey()
- C: Use Console.readline()
- D: Use System.pause()
View Answer
C
Q118: Which command is used to compile a C# program from the command line?
- A: javac Welcome.cs
- B: csc.exe Welcome.cs
- C: gcc Welcome.cs
- D: dotnet Welcome.cs
View Answer
B
Q119: What namespace is typically used for GUI-based applications in C#?
- A: System
- B: System.Drawing
- C: System.Windows
- D: System.Windows.Forms
View Answer
D
Q120: What does the following C# code do? Messagebox.Show("Hello world!");
- A: Prints "Hello world!" in the console
- B: Displays a message box with "Hello world!"
- C: Writes "Hello world!" to a file
- D: Logs "Hello world!" to a system log
View Answer
B