100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
Programming

Objective-C Interview Questions

Commonly asked Objective-C interview questions covering memory management, runtime behavior, protocols, and blocks, with explanations of what strong answers cover.

PracticeIntermediate10 min readJul 10, 2026
Analogies

What Interviewers Actually Probe For

Objective-C interviews rarely test whether you've memorized every Foundation class; they test whether you understand the runtime concepts that cause real production bugs: reference counting and retain cycles, the difference between class and instance methods, protocol conformance, and block capture semantics. Strong candidates explain not just what a mechanism does but why it exists and what specific bug it prevents, because that's the signal that the knowledge came from real debugging experience rather than rote memorization.

🏏

Cricket analogy: A strong interview answer explaining why a retain cycle happens is like a commentator explaining why a batsman got out, not just that the stumps were hit, but the exact technical flaw in the shot selection that led there.

Memory Management Questions

A frequent question is 'explain what causes a retain cycle and how you'd fix it,' expecting the candidate to describe two objects holding strong references to each other, such as a parent view controller and a block property that captures self strongly, preventing either from ever reaching a retain count of zero. The correct fix involves either declaring one side weak, most commonly the delegate or the block's captured self, or using a capture list like __weak typeof(self) weakSelf = self; inside the block to break the cycle.

🏏

Cricket analogy: A retain cycle between a view controller and its block is like two batsmen both refusing to run for a single, each waiting for the other to commit first, until a __weak reference acts like a decisive call that finally breaks the standoff.

objectivec
// Classic retain cycle
@interface ImageLoader : NSObject
@property (nonatomic, copy) void (^completion)(UIImage *image);
@end

@implementation ViewController
- (void)loadImage {
    self.loader.completion = ^(UIImage *image) {
        self.imageView.image = image; // captures self strongly -> cycle
    };
}

// Fix: weak-strong dance
- (void)loadImageFixed {
    __weak typeof(self) weakSelf = self;
    self.loader.completion = ^(UIImage *image) {
        __strong typeof(weakSelf) strongSelf = weakSelf;
        if (!strongSelf) return;
        strongSelf.imageView.image = image;
    };
}
@end

The 'weak-strong dance' — capturing a weak reference, then promoting it to a strong local reference inside the block body — is a standard, interview-worthy pattern because it avoids both the retain cycle and a crash if self is deallocated mid-execution of the block.

Runtime, Protocols, and Blocks

Interviewers often ask about the difference between a protocol and a category: a protocol declares a contract of methods a conforming class must implement, similar to an interface, while a category adds new methods to an existing class, including classes you don't own, without subclassing. A related favorite is explaining how a block captures variables: local variables are captured by value (a snapshot at block-creation time) while __block-qualified variables are captured by reference, allowing the block to actually mutate the original variable's storage.

🏏

Cricket analogy: A protocol is like a fielding position's job description, whoever stands at cover must be ready to field and throw, while a category is like adding a new specialized skill, say reverse-sweep coaching, to an existing veteran player without replacing them.

A common interview trap: candidates confuse a category with a class extension. A category is declared with a name in parentheses (e.g., @interface NSString (MyAdditions)) and can be used to add methods from anywhere, including in a separate file, whereas a class extension (an unnamed category, typically at the top of the .m file) can only be used within the same compilation unit and can add private properties, which regular categories cannot do.

  • Interviewers value understanding why a mechanism exists and what bug it prevents, not just its definition.
  • A retain cycle occurs when two objects hold strong references to each other, most commonly a block capturing self strongly.
  • The weak-strong dance (__weak then __strong inside the block) is the standard fix for block-related retain cycles.
  • A protocol declares a method contract a class must implement; a category adds methods to an existing class without subclassing.
  • Local variables are captured by value in a block; __block-qualified variables are captured by reference and can be mutated.
  • A class extension (unnamed category) can add private properties and is scoped to the same compilation unit, unlike a regular named category.
  • Explaining concrete debugging scenarios, not just definitions, is what distinguishes strong candidates in Objective-C interviews.

Practice what you learned

Was this page helpful?

Topics covered

#Programming#ObjectiveCStudyNotes#ObjectiveCInterviewQuestions#Objective#Interview#Questions#Interviewers#StudyNotes#SkillVeris#ExamPrep