Objective C Interview Questions and Answers

Last updated on Feb 06, 2023
  • Share
Objective C Interview Questions

Most Frequently Asked Objective C Interview Questions

Here in this article, we will be listing frequently asked Objective C Interview Questions and Answers with the belief that they will be helpful for you to gain higher marks. Also, to let you know that this article has been written under the guidance of industry professionals and covered all the current competencies.

Q1. What is Objective C & why it is used for?
Answer

An ANSI-based version of the standard C programming language, Objective-C is the key programming language used for mobile app development by companies that make apps for OS X and iOS. Objective-C is developed on top of C language by adding Small Talk features that make it an object-based language.

Q2. Who introduced Objective-C & when?
Answer

Objective-C was created by Tom Love and Brad Cox at their company Stepstone in the early 1980s.

Q3. What is the latest version of objective-c?
Answer

Apple released Objective-C 2.0 at the Worldwide Developers Conference in 2006. It is its latest version.

Q4. What is protocol in Objective-C?
Answer

A protocol announces a programmatic interface that a class chooses to implement. It enables two classes that are related by inheritance to “talk” with each other in order to accomplish a goal.

Q5. What are the different types of protocols?
Answer

Protocols are of two types - formal and informal.
An extension of the Objective-C language, a formal protocol announces a list of methods that client classes are likely to implement.

An informal protocol is one of the categories on NSObject that makes all objects adopters of the protocol. Implementing methods in an informal protocol is optional.

Q6. How is #import different from #include?
Answer

#import function ensures a file is included only once so that you do not have a problem with recursive include.
import is a super set of include and it ensures file is included once.

Q7. What is the function of the category?
Answer

A category is used to add methods to an existing class. The added methods are usually inherited by subclass and are difficult to differentiate from the original methods at runtime. Categories are used to distribute the implementation of their classes into separate source files.

#import “SystemClass.h”
@interface SystemClass (CategoryName)
    // method declarations
@end

 

Q8. When will you use NSArray and NSMutableArray? Which one is faster?
Answer

NSMutableArray is the subclass of NSArray and they both manage collections of objects known as arrays. NSArray is responsible for creating static arrays, whereas NSMutableArray is responsible for creating dynamic arrays.

Q9. What is fast enumeration?
Answer

The object is a collection of as an array or set of Cocoa classes that may include the collection classes. This collection of classes adopts the NSFastEnumeration protocol. This protocol can be used to retrieve elements that are held by an instance by using a syntax that is similar to a standard C for loop.

Look at this instance:
NSArray *anArray = // get an array;
for (id element in anArray)
{
   /* code that acts on the element */
}

Q10. What is @synthesize?
Answer

@synthesize creates getter and setter for the variables and allows you to specify attributes for variables. When you @synthesize the property to the variable, you generate getter and setter for that variable.

Reviewed and verified by Best Interview Question
Best Interview Question

With our 10+ experience in PHP, MySQL, React, Python & more our technical consulting firm has received the privilege of working with top projects, 100 and still counting. Our team of 25+ is skilled in...