Visual Programming MCQs with Answers
Practice important Visual Programming MCQs with answers and explanations.
Multiple Choice Questions
Q231: What happens if an exception occurs during file operations in the try block?
- A: The program terminates abruptly
- B: The exception is ignored
- C: The exception is caught and handled
- D: The exception is re-thrown
View Answer
C
Q232: Which of the following best describes an attribute in C#?
- A: A function
- B: A method
- C: A class
- D: A declarative tag
View Answer
D
Q233: What attribute causes a compile-time warning if a method is used?
- A: Obsolete
- B: Serializable
- C: STAThread
- D: CLSCompliant
View Answer
A
Q234: What is the effect of the [Obsolete] attribute?
- A: It marks a method as deprecated
- B: It prevents a method from being used
- C: It improves method performance
- D: It changes method visibility
View Answer
A
Q235: Which of the following correctly declares an enumeration in C#?
- A: public enum Volume { Low, Medium, High }
- B: enum Volume { Low, Medium, High }
- C: enum Volume { Low=1, Medium, High }
- D: enum Volume : byte { Low, Medium, High }
View Answer
A
Q236: What is the default underlying type of an enum in C#?
- A: byte
- B: int
- C: short
- D: long
View Answer
B
Q237: How do you perform an explicit cast from int to an enum type in C#?
- A: (int)enumType
- B: (enumType)intValue
- C: (enumType)parseInt(value)
- D: (int)Enum.Parse(enumType)
View Answer
B
Q238: Which method is used to get all values from an enum type?
- A: Enum.GetNames
- B: Enum.Parse
- C: Enum.GetValues
- D: Enum.ToString
View Answer
C
Q239: Which of the following operators can be overloaded in C#?
- A: +
- B: +=
- C: &&
- D: .
View Answer
A
Q240: Which access modifier provides the highest level of encapsulation?
- A: private
- B: protected
- C: internal
- D: public
View Answer
A