Skip to main content

Visual Programming MCQs with Answers

Practice important Visual Programming MCQs with answers and explanations.

Multiple Choice Questions

Q221: Which method is used to get a string representation of an exception?
  • A: ToString()
  • B: Message()
  • C: Print()
  • D: ExceptionString()
View Answer
A

Q222: What exception type would File.OpenRead likely throw if the file is not found?
  • A: FileNotFoundException
  • B: SecurityException
  • C: IOException
  • D: DirectoryNotFoundException
View Answer
A

Q223: In C#, how do you handle multiple exceptions separately?
  • A: Using multiple try blocks
  • B: Using multiple finally blocks
  • C: Using multiple catch blocks
  • D: Using catch inside finally
View Answer
C

Q224: What is the correct order of execution in a try-catch block?
  • A: try -> finally -> catch
  • B: try -> catch -> finally
  • C: catch -> try -> finally
  • D: finally -> try -> catch
View Answer
B

Q225: Which of the following is NOT a correct way to catch an exception in C#?
  • A: catch(Exception ex)
  • B: catch(FileNotFoundException fnfex)
  • C: catch(int ex)
  • D: catch(SystemException ex)
View Answer
C

Q226: How do you trigger a custom event in C#?
  • A: By calling the event like a method
  • B: By assigning a delegate
  • C: By declaring a new delegate
  • D: By creating a new class
View Answer
A

Q227: What is the correct way to register a method to an event in C#?
  • A: event += new EventHandler(methodName);
  • B: event = methodName;
  • C: event -= methodName;
  • D: event += methodName;
View Answer
D

Q228: Which method is invoked when the custom event startevent is fired?
  • A: onclickmeclicked
  • B: onstartevent
  • C: startdelegate
  • D: run
View Answer
B

Q229: What is the purpose of the finally block in exception handling?
  • A: To handle exceptions
  • B: To perform cleanup actions
  • C: To skip exceptions
  • D: To log errors
View Answer
B

Q230: Which file operation is performed in the finallydemo class?
  • A: Reading a file
  • B: Writing to a file
  • C: Closing a file
  • D: Opening a file
View Answer
C

Test Your Knowledge

Take a timed quiz on Visual Programming

🚀 Start Quiz Now