30 Objective-C Quiz Questions and Answers

Objective-C is a programming language primarily used for developing applications on Apple’s macOS and iOS platforms. It is an extension of the C programming language, adding object-oriented features and dynamic runtime capabilities. Objective-C was created by Brad Cox and Tom Love in the early 1980s and later adopted by NeXT Computer, the company founded by Steve Jobs after leaving Apple. Apple then incorporated Objective-C into its development ecosystem when it acquired NeXT, making it the primary language for macOS and iOS app development.

Just so you know

With OnlineExamMaker quiz software, anyone can create & share professional online assessments easily.

Table of content

Part 1: 30 Objective-C quiz questions & answers

1. Objective-C is an extension of which programming language?
a) C++
b) C#
c) Java
d) C
Answer: d) C

2. Who developed Objective-C?
a) Steve Jobs
b) Tim Cook
c) Brad Cox and Tom Love
d) Bill Gates
Answer: c) Brad Cox and Tom Love

3. What does the “@” symbol represent in Objective-C?
a) Pointer operator
b) Message sending operator
c) String literal
d) Instance variable prefix
Answer: b) Message sending operator

4. Which framework provides essential classes and functionalities in Objective-C?
a) Core Data
b) Foundation
c) UIKit
d) Core Graphics
Answer: b) Foundation

5. Objective-C follows which programming paradigm?
a) Functional programming
b) Object-oriented programming
c) Procedural programming
d) Imperative programming
Answer: b) Object-oriented programming

6. What is ARC in Objective-C?
a) Automatic Reference Counter
b) Advanced Runtime Configuration
c) Automatic Release Control
d) Automatic Reference Counting
Answer: d) Automatic Reference Counting

7. How are comments written in Objective-C?
a) /* This is a comment */
b) // This is a comment
c)
d) # This is a comment
Answer: b) // This is a comment

8. In Objective-C, what is the syntax for declaring a class interface?
a) class MyClass {}
b) interface MyClass {}
c) @interface MyClass {}
d) def MyClass {}
Answer: c) @interface MyClass {}

9. How do you create an instance of a class in Objective-C?
a) MyClass obj = [MyClass new];
b) MyClass obj = MyClass();
c) MyClass *obj = [[MyClass alloc] init];
d) new MyClass obj;
Answer: c) MyClass *obj = [[MyClass alloc] init];

10. What does the “alloc” method do in Objective-C?
a) Allocates memory for a new object.
b) Deallocates memory for an object.
c) Initializes an object.
d) Allocates memory for an array.
Answer: a) Allocates memory for a new object.

11. What is the purpose of the “dealloc” method in Objective-C?
a) It allocates memory for an object.
b) It deallocates memory for an object.
c) It initializes an object.
d) It releases memory for an object.
Answer: b) It deallocates memory for an object.

12. How do you define a property in Objective-C?
a) @property int age;
b) var age: Int;
c) int age;
d) property age;
Answer: a) @property int age;

13. In Objective-C, how do you call a method on an object?
a) [object methodName]
b) object.methodName
c) object->methodName
d) methodName(object)
Answer: a) [object methodName]

14. What is the purpose of the “self” keyword in Objective-C?
a) It refers to the superclass of the current class.
b) It refers to the current instance of the class.
c) It is used to create a new instance of a class.
d) It is used to access static methods.
Answer: b) It refers to the current instance of the class.

15. What is the syntax for creating a method in Objective-C?
a) method myMethod {}
b) func myMethod() {}
c) def myMethod {}
d) -(returnType)myMethod {}
Answer: d) -(returnType)myMethod {}

Part 2: Download Objective-C questions & answers for free

Download questions & answers for free

16. In Objective-C, how do you declare a method that takes two parameters?
a) -(void)myMethod(param1, param2)
b) -(void)myMethod:(param1):(param2)
c) -(void)myMethod:(param1) andParam:(param2)
d) -(void)myMethod(param1, andParam: param2)
Answer: c) -(void)myMethod:(param1) andParam:(param2)

17. Which directive is used to import a header file in Objective-C?
a) #import
b) import
c) include
d) #include
Answer: a) #import

18. What is the purpose of the “@synthesize” directive in Objective-C?
a) It imports a header file.
b) It synthesizes accessor methods for properties.
c) It defines a protocol.
d) It allocates memory for an object.
Answer: b) It synthesizes accessor methods for properties.

19. What is the purpose of the “IBOutlet” keyword in Objective-C?
a) It marks a variable as an instance variable.
b) It marks a variable as an outlet for Interface Builder.
c) It marks a variable as a constant.
d) It marks a variable as a weak reference.
Answer: b) It marks a variable as an outlet for Interface Builder.

20. In Objective-C, what is the difference between “retain” and “copy” in property declarations?
a) “retain” increases the reference count, while “copy” creates a shallow copy of the object.
b) “retain” creates a shallow copy of the object, while “copy” increases the reference count.
c) “retain” creates a deep copy of the object, while “copy” increases the reference count.
d) “retain” increases the reference count, while “copy” creates a deep copy of the object.
Answer: d) “retain” increases the reference count, while “copy” creates a deep copy of the object.

21. What does the “super” keyword do in Objective-C?
a) It refers to the superclass of the current class.
b) It creates a new instance of a class.
c) It is used to access static methods.
d) It refers to the current instance of the class.
Answer: a) It refers to the superclass of the current class.

22. In Objective-C, how do you define a protocol?
a) interface MyProtocol {}
b) protocol MyProtocol {}
c) @protocol MyProtocol {}
d) def MyProtocol {}
Answer: c) @protocol MyProtocol {}

23. What is the purpose of a protocol in Objective-C?
a) It defines a set of properties and methods that a class must implement.
b) It is used for memory management.
c) It defines a new data type.
d) It declares a class interface.
Answer: a) It defines a set of properties and methods that a class must implement.

24. In Objective-C, what is the syntax for adopting a protocol in a class?
a) class MyClass : MyProtocol {}
b) class MyClass adopts MyProtocol {}
c) class MyClass implements MyProtocol {}
d) class MyClass @protocol MyProtocol {}
Answer: a) class MyClass : MyProtocol {}

25. Which method is called automatically when an object is about to be deallocated in Objective-C?
a) dealloc
b) delete
c) release
d) free
Answer: a) dealloc

Pro Tip

You can build engaging online quizzes with our free online quiz maker.

26. What does the “nil” keyword represent in Objective-C?
a) An empty array
b) A null pointer
c) An empty string
d) An uninitialized variable
Answer: b) A null pointer

27. How do you check if an object is nil in Objective-C?
a) object == nil
b) object = nil
c) object.isNull
d) object.isNil
Answer: a) object == nil

28. In Objective-C, what does the “block” syntax represent?
a) A multi-line comment
b) A function pointer
c) A lambda expression
d) A switch-case statement
Answer: c) A lambda expression

29. How do you define a block in Objective-C?
a) ^(returnType)(parameters) {}
b) block(returnType, parameters) {}
c) (returnType)(parameters) ^
d) block(returnType, parameters)^ {}
Answer: a) ^(returnType)(parameters) {}

30. What is the purpose of the “dispatch_async” function in Objective-C?
a) It dispatches a block to run on the main thread asynchronously.
b) It dispatches a block to run on a background thread asynchronously.
c) It schedules a block to run after a specified delay.
d) It schedules a block to run periodically.
Answer: b) It dispatches a block to run on a background thread asynchronously.

Part 3: Best online quiz making platform – OnlineExamMaker

OnlineExamMaker is online testing platform that provides the best quiz maker tool for both teachers & businesses. This all-in-one platform offers a wide range of features and tools that enable efficient quiz creation, secure test administration, remote proctoring, and insightful result analysis. OnlineExamMaker includes advanced online proctoring features, ensuring exam integrity and preventing cheating. AI-powered video monitoring, facial recognition, and screen sharing analysis help exam organizers maintain the credibility and fairness of the assessments.

Create Your Next Quiz/Exam with OnlineExamMaker

SAAS, free forever
100% data ownership