Visual Programming MCQs with Answers
Practice important Visual Programming MCQs with answers and explanations.
Multiple Choice Questions
Q41: What is an "improving driver" in the flower delivery system?
- A: A driver who accepts more assignments over time.
- B: A driver whose assignments increase or stay the same day by day.
- C: A driver who has higher rankings over time.
- D: A driver who takes additional training.
View Answer
B
Q42: What does event-driven programming focus on?
- A: Writing code that executes sequentially without interruptions.
- B: Performing operations based on the occurrence and handling of events.
- C: Maximizing CPU usage by continuous polling.
- D: Managing memory allocation efficiently.
View Answer
B
Q43: Which of the following is a key benefit of event-driven programming mentioned in the lecture?
- A: It simplifies multi-threading.
- B: It scales well to applications with multiple GUI elements and many event sources.
- C: It eliminates the need for asynchronous operations.
- D: It ensures real-time performance.
View Answer
B
Q44: In the context of the lecture, what does "deterministic" mapping mean in event processing systems?
- A: The mapping from real-world events to system events always follows a predictable pattern.
- B: The mapping is random and cannot be predicted.
- C: The mapping does not correlate with real-world events.
- D: The mapping only applies to synchronous operations.
View Answer
A
Q45: Why might one prefer event-driven programming over a non-event-driven approach?
- A: Because event-driven programming always performs better.
- B: Because it avoids blocking operations and can handle multiple events efficiently.
- C: Because it uses less memory.
- D: Because it requires less code.
View Answer
B
Q46: In the code example, what would happen if the iskeyboardpressed() function always returns false?
- A: The program would never terminate.
- B: The program would only respond to file changes.
- C: The program would respond to both keyboard and file events.
- D: The program would exit immediately.
View Answer
B
Q47: In the refactored code, which part is responsible for handling file change events?
- A: The onkeypress() function.
- B: The onfilechanged() function.
- C: The main() function.
- D: The f.peek() function.
View Answer
B
Q48: In the refactored code, why is f.close() called after handling file changes?
- A: To ensure the file is not read again.
- B: To release the file resource.
- C: To check if the file has changed.
- D: To reopen the file.
View Answer
B
Q49: What would be a potential problem in the code example provided in Lecture 1 that was mentioned in Lecture 2?
- A: Busy wait.
- B: Memory leak.
- C: Syntax errors.
- D: Security vulnerabilities.
View Answer
A
Q50: What is the purpose of refactoring code into functions like onkeypress() and onfilechanged()?
- A: To make the code run faster.
- B: To make the code more focused and handle one thing at a time.
- C: To make the code use less memory.
- D: To make the code less readable.
View Answer
B