Visual Programming MCQs with Answers
Practice important Visual Programming MCQs with answers and explanations.
Multiple Choice Questions
Q781: What does the touchesMoved:withEvent: method handle in touch events?
- A: Initial touch event
- B: Finger moving across the screen
- C: Touch removal from the screen
- D: System interruption during touch
View Answer
B
Q782: How do you handle a double tap in a touch event?
- A: Call [self clearAll]
- B: Call [self setNeedsDisplay]
- C: Call [self endTouches:]
- D: Call [self startUpdatingLocation]
View Answer
A
Q783: What class is used to represent a line in the drawing app?
- A: CGPoint
- B: UIView
- C: Line
- D: UIColor
View Answer
C
Q784: How do you clear all lines from the drawing view?
- A: Call [linesInProcess removeAllObjects] and [completeLines removeAllObjects]
- B: Call [self setNeedsDisplay]
- C: Call [self clearAll]
- D: Call [self drawRect:]
View Answer
C
Q785: In the drawRect: method, how are complete lines drawn?
- A: Set color to red and iterate through linesInProcess
- B: Set color to black and iterate through completeLines
- C: Set color to blue and iterate through linesInProcess
- D: Set color to green and iterate through completeLines
View Answer
B
Q786: What does the transformLineColorsWithBlock: method do?
- A: Transforms line colors using a block
- B: Clears all lines from the view
- C: Updates the line endpoints based on touch movements
- D: Draws all lines in the completeLines array
View Answer
A
Q787: How is color calculated based on the line's angle and length?
- A: Using transformLineColorsWithBlock: with a predefined block
- B: Using drawRect: method to set color for each line
- C: Using colorize method with a block for calculating colors
- D: Using clearAll method to reset colors
View Answer
C
Q788: Which method is called to start a new thread in the DidFinishLaunchingWithOptions: method?
- A: [NSThread detachNewThreadSelector:toTarget:withObject:]
- B: [NSThread start]
- C: [NSThread run]
- D: [NSThread create]
View Answer
A
Q789: How does Grand Central Dispatch manage concurrent tasks?
- A: By creating new threads for each task
- B: By using dispatch queues to manage pools of threads
- C: By manually managing thread synchronization
- D: By running tasks on the main thread only
View Answer
B
Q790: What does the dispatch_sync function do in GCD?
- A: Executes a block asynchronously on a specified queue
- B: Executes a block synchronously on a specified queue
- C: Delays the execution of a block on the main thread
- D: Cancels the execution of a block on a specified queue
View Answer
B