Objective C is an alternate programming language use by IOS system for their applications. Apple-IOS use Swift and Objective C to build IOS software and applications for their different devices. If you want to land in Apple company as an Objective-C developer here we have provided the most important Objective-C interview questions which will definitely help you crack to the interview.
Objective C Interview questions
Question: What is OOP’s?
Answer: Object Oriented Programming is a model of programming languages which use class and objects to create the programme. Here object can be defined as a data field which can have unique attributes and behavior.
Question: What is Objective C?
Answer: Objective C is a programming language used to design OS X and iOS software. It is a superset of C language because it supports object-oriented programming and a dynamic runtime.
Question: What is Polymorphism?
Answer: Polymorphism is a concept in OOP’s which says that the same operator can perform a different kind of operations on different data types.
Question: What is Dot Notation?
Answer: Dot notation is used by the class instance or objects to invoke the class attributes, properties, and methods.
Question: What is Abstraction?
Answer: Abstraction is a technique of hiding the unnecessary code from the user.
Question: Who designed Objective-C?
Answer: Tom Love and Brad Cox
Question: What is the paradigm of Objective-C?
Answer: Objective C is a Reflective, Class-Based Object-oriented programming language.
Question: What is the protocol in Objective C?
Answer: Objective C supports single inheritance but with the help of protocol, we can perform multiple inheritances. In other programming languages, it is known by interface or trait.
Question: Name the protocols that Objective C uses.
- Ad hoc protocols aka informal protocols
- Compiler-enforced protocol aka formal protocols
Question: Name Objective C components.
- Preprocessor orders
- Statement and expression
Question: Why do we use #import in Objective C?
Answer: #import is used as an upgrade of #include that solve the problem of recursive include.
Question: What is the difference between #import and #include?
Answer: #import added in Objective C to replace #include because #include was not able to solve the problem of recursive include. #import make sure that the file included in the source only once.
Question: What is an accessor method?
Answer: An access method related to an object which set which value and property of a class can a class instance invokes.
Question: What is the use of Category in Objective C?
Answer: Categories are used to add extra functionality to an object without making any changes in it.
Question: What is NSArray in objective C?
Answer: In Objective C we use the Foundation Framework NSArray class to handle the Array objects. The NSArray contains many methods to create and manipulate arrays.
Question: What does @synthesize do in Objective-C?
Answer: The @synthesize creates accessor (getter and setter) methods for a variable.
Question: What is Fast enumeration in Objective C?
Answer: When we enumerate through a collection in objective C is known as fast enumeration.
Question: What are collections in Objective C name some of them?
Answer: A collection is a foundation framework object in Objective C which are used to store objects.
Some of the most important collections in Objective C are:
Question: What is the syntax of method calling in Objective C?
Answer: Method calling syntax outside the class:[class_name method_name]
Method calling in the same class:[self method_name]
Question: What is the difference between copy and readonly?
Answer: When we use copy, it creates getters and setters whereas Readonly, only create getters no setters.
Question: What is NSObject in objective C and what its use?
Answer: NSObject is the root class of most Objective C classes and all other classes are derived from it. NSObject is used to allocate and initialize other objects like arrays, string, dictionaries, etc.
Question: When would we use NSArray and NSMutableArray?
- NSArray: We use NSArray when we do not want any changes in the declares array items.
- NSMutableArray: We use NSMutableArray when we want an array which declared items to be changed.
Question: How do we create a string object in Objective C?
Answer: We can use NSString and its sub-class NSMutableString to create string Objects.
Question: What is the difference between function calls and messages?
Answer: In a function call, the function and arguments linked together in compiled code whereas the message and receiving object do not link until the program gets executed.
Question: What is id in Objective C?
Answer: The id is a kind of pointer which points an object in Objective C.
Question: What are the blocks in Objective C?
Answer: A block in Objective c helps to form a distinct segment of code that can be passed around the functions or methods as if they were values.
Question: What is a Responder Chain in Objective C?
Answer: When the responder objects get linked in series, they form a Responder chain, which starting point is a responder and endpoint is an app object. The responder chain is used to handle the event if the first responder would not able to handle the event, so the event gets passed to the second object present in the Responder chain.
Question: Does Objective C support method or function overloading?
Answer: No, Objective C does not support function overloading so for each function we need to define different names.
Question: What is Cocoa?
Answer: Cocoa is an application Environment and covers Object-oriented parts which help to create OSX and iOS Applications.