2000+ iOS Interview Questions And Answers: Your Path to Success

ganeshrajugalla
8 min readJun 2, 2023

--

“Welcome to ‘2000+ iOS Interview Questions and Answers: Your Path to Success.’ I’m Ganesh Raju Galla, and I have meticulously gathered an extensive collection of over 2000+ iOS interview questions and their comprehensive answers. Whether you are a seasoned iOS developer looking to brush up on your skills or a job seeker preparing for interviews, this series of articles is designed to be your ultimate resource.

In the initial phase, the questions in this series will focus on Objective-C, covering a wide range of topics and scenarios commonly encountered during iOS interviews. However, as we progress, I will gradually transition to including questions based on Swift and SwiftUI, ensuring that you stay up to date with the latest technologies and frameworks in iOS development.

Every week, I will be releasing a new post featuring 50 carefully curated questions and their corresponding answers. The first 600 questions in this series will focus on objective-type questions, covering a wide range of topics and scenarios commonly encountered during iOS interviews.

So, fasten your seatbelt, as we embark on a journey that will unlock the secrets of iOS interview success. Let’s dive into the first set of 50 objective-type questions and answers, laying a solid foundation for your path to success in the dynamic world of iOS development.

Please note that the revised introduction mentions the initial focus on Objective-C questions and the gradual transition to Swift and SwiftUI questions in the future.

NOTE: I have highlighted the answers in bold text. This distinctive formatting will help you easily spot the answers while reading the article.

⭐️ ① Written test questions-Grammar

1. The method corresponding to alloc is: [single-choice question]

  • A. alloc
  • B. dealloc
  • C. release
  • D. autorelease

2. The method corresponding to retain is: [single-choice question]

  • A. alloc
  • B. dealloc
  • C. release/autorelease
  • D. copy

3. The role of @property is to declare properties and their characteristics?: [single-choice question]

  • A. correct
  • B. wrong

4. The role of @synthesize is to automatically generate accessor (getter/setter) methods for attributes?: [Single-choice question]

  • A. correct
  • B. wrong

5. When is the dealloc method of an object called: [single-choice question]

  • A. The reference count (retuanCount) is reduced to -1
  • B. The reference count (retuanCount) is reduced to 1
  • C. The reference count (retuanCount) is reduced to 2
  • D. The reference count (retuanCount) is reduced to 0

6. Categories (categoryes) can be added to an existing class: [single-choice question]

  • A. Method
  • B. Attributes
  • C. action
  • D. agreement

7. Extensions can add [multiple choice questions] to the current class

  • A. action
  • B. Method
  • C. attributes
  • D. agreement

8. Protocols can be divided into two types, among which the protocol declared with which keyword may not be implemented: [single-choice question]

  • A. @optional
  • B. @required
  • C. @none
  • D. @userful

9. That class is the root class that most Objective-C classes inherit from, and it has no parent class [single-choice question]

  • A. NSNull
  • B. NS Interger
  • C. NSString
  • D. NSObject

10. The role of the agent ( delegate ) is to make one object implement the method of another object? [Judgment]

  • A. correct
  • B. wrong

11. autoreleaseThe function is: [multiple choice]

  • A. Put the object into the autorelease pool
  • B. Decrease the reference count of the object by 1
  • C. Delay calling the release method
  • D. Immediately call the release method

12. -(void) setName: (Nsstring) NewName{ self.name = NewName}: The result of being called is: [Single-choice question]

  • A. Set the value of the name attribute
  • B. Program infinite loop
  • C. Get the value of the name attribute
  • D. Copy the value of the name attribute

13. KVC The common attribute accessor methods in China are those two: [Multiple choice]

  • A. valueForKey:
  • B. setValue:forKey:
  • C. getValueForKey:
  • D. SetValue:

14. Keywords nilare expressed in Objective-C: [single choice]

  • A. An empty object
  • B. A null pointer
  • C, a null character
  • D. A null byte

15. The difference between #importand #include is: #import Can you avoid the file being cited multiple times?: [Judgment]

  • A. correct
  • B. wrong

16. Does Objective-C support operator overloading: [Judgment]

  • A. correct
  • B. wrong

17. Can a private method be declared in a header file in Objective-C: [Judgment]

  • A. can
  • B. No

Objective-C Keyword Description

Objective-C Keyword Description
@private The scope of action can only be within its own class
@protected The scope of action is within its own class and subclasses that inherit from itself. If nothing is written, this property is the default.
@public Largest range of action, anywhere
@package will not be exported externally, so any class that tries to access these member variables outside the framework will get a linkage error as a result.

18. In Objective-C, the member variables of a class are declared by default as: [single choice]

  • A. @private The scope of action can only be within its own class
  • B. @protected The scope of action is within its own class and subclasses that inherit from itself. If nothing is written, this property is the default.
  • C. @public Largest range of action, anywhere.
  • D. @package will not be exported externally, so any class that tries to access these member variables outside the framework will get a linkage error as a result.

19. Regarding exception handling in Objective-C++, the following statement is most correct: [Single-choice question]

  • A. Objective-C does not support exception handling
  • B. In Objective-C++, the exception handling of Objective-C can catch the exception of C++
  • C. In Objective-C++, Objective-C exceptions cannot catch C++ exceptions
  • D. In Objective-C++, the exception handling of Objective-C and C++ can catch exceptions from each other

20. In the method of the object dealloc, [super dealloc]the correct statement about: grammar is: [single-choice question]

  • A. [super dealloc];
  • B. [super dealloc]; should be placed in the first line of the dealloc method
  • C. [super dealloc]; should be placed in the last line in the dealloc method
  • D. [super dealloc]; The location doesn’t matter, as long as it is in the dealloc method

21. The following about the method: [[[object method1]method2] method3:[objectmethod4]];the order of method calls in: [single-choice question]

  • A. 1 2 3 4
  • B. 1 2 4 3
  • C. 4 1 2 3
  • D. 4 3 2 1

22. In ARC (Automatic Reference Counting)mode, the following method is not disabled: [Single-choice question]

  • A. retain
  • B. copy
  • C. release
  • D. autorelease

23. Which of the following objects cannot initWithContentsOfFile be constructed by calling methods: [single-choice question]

  • A. NSString
  • B. NSXMLParser
  • C. NS Dicttionary
  • D. NSData

24. Which of the following keywords will add one to the reference count of the referenced object (retainCount): [multiple choice]

  • A. alloc
  • B. init
  • C. retain
  • D. copy

25. In the file with the extension of .mm, what codes can be included: [multiple choice]

  • A.C
  • B. Objective-C
  • C. C++
  • D. Swift

26. Which of the following classes use the singleton (Singletion)pattern: [multiple choice]

  • A. File Manager
  • B. Notification Center
  • C. Application
  • D. Device

27. Among the following data types, those that can be directly put into NSArraythe array are: [multiple choice]

  • A. BOOL
  • B. NSInteger
  • C. NSString
  • D. NSArray

28(enumerate). The advantages of the quick comparative access of Objective-C cycle , the following statement is correct: [multiple choice]

  • A. It is more efficient to use fast enumeration
  • B. The syntax is more concise
  • C. It is safer to use
  • D. More data types in the workplace

29. OC contains one custom header file that should be used: [single choice]

  • A. #include
  • B. #include<>
  • C. #import “”
  • D. #import<>

30.implemented protocol Which keyword statement must be used in the method: [single-choice question]

  • A. @property
  • B. @interface
  • C. @required
  • D. @protocol

31. Declare a method: provide an array of Student objects according to ascending order the judgment conditions of the student number: [single-choice question]

  • A. — (NScomparisonResult)compareWithNumberForAscendSort:(Student)otherStudent
  • B. — (NSinteger)compareWithNumberForAscendSort:(Student)otherStudent
  • C. — (BOOL) compareWithNumberForAscendSort:(Student) otherStudent
  • D. — (int) compareWithNumberForAscendSort:(Student) otherStudent

32. If the instance variable of a class in OC grammar Can only be accessed by this class and its subclasses requires which of the following modifiers: [single-choice question]

  • A. @public
  • B. @private
  • C. @protected
  • D. @friendly

33. The incorrect description of the collection is: [single-choice question]

  • A. All collections can add elements.
  • B. Collections are divided into mutable collections and immutable collections.
  • C. Array, dictionary and NSSet store data in different ways.
  • D. All collections can save id type data.

34. NSDictionary *dict = [NSDictionary dictionaryWithObject:@"a value" forKey:@"aKey"]; NSLog(@”%@”,[dict objectForKey:@“aKey”]);[dict release]; What to output:[single-choice question]

  • A. a value Create a command line project on MacOS and set the non-ARC project to output a value
  • B. akey: a value
  • C. Crash information In the iOS project, setting a non-ARC project will crash
  • D. a vlaue : akey

35. To output a string to the OC console, you should use: [single-choice question]

  • A. NSLog()
  • B. Printf()
  • C. NSPrintf()
  • D. scanf()

36. The method named print:: has several incoming parameters: [single choice]

  • A, 0
  • B.1
  • C.2
  • D.3

37. Which of the following options @synthesizeis used in conjunction with: [Single-choice question]

  • A. @end
  • B. @interface
  • C. @implementation
  • D. @property

38. In Objective-C, the root class of all classes is: [single choice]

  • A. NSObject
  • B. NSNull
  • C. NSCoding
  • D. UIView

39. Use OC language to implement “This is Objective-C program.” The correct one is: [single-choice question]

  • A. NSLog(@“%s”, This is Objective-C program.);
  • B. NSLog(@“%@”,This is Objective-C program.);
  • C. NSLog(@“This is Objective-C program.”,%@);
  • D. D. NSLog(@“This is Objective-C program.”,%@);

40. Agreement and commission The incorrect description is: [single-choice question]

  • A. Delegation is a design pattern of iOS
  • B. The methods in the protocol must be implemented by default
  • C. The class accepts multiple protocols. These protocols are written in <> behind the parent class, and multiple protocols are separated by “.”
  • D. Define the protocol using the @protocol keyword

41. The protocol incorrect description is: [single-choice question]

  • A. Agreements are divided into formal and informal agreements.
  • B. @required can be used when the class that requires the confirmation protocol must implement the method in the protocol.
  • C. A protocol can be confirmed by multiple classes.
  • D. The method declared in the protocol defaults to @optional.

42. In the following kind description of the concept, the error is: [single-choice question]

  • A. A class is an implementation of an abstract data type
  • B. A class is a unified description under several pairs of common behaviors
  • C. A class is a template for creating objects
  • D. A class is a structure type in C language

43. In Objective-C, which of the following options are The correct way to declare attributes : [single choice]

  • A. @property(nonatomic,retain) NSString *myString;
  • B. @property(nonatomic,assign) NSString *myString;
  • C. @property(nonatomic,assign) Int myNumber;
  • D. @property(nonatomic,retain) Int myNumber;

44. NSString *name= [[NSString alloc]initWithString:@"Hello"]; NSLog(@"%d",[name retainCount]);What is the output of the above code: [single choice]

  • A. -1
  • B.0
  • C.1
  • D.2

45. ​​What will not immediately change the reference counter is: [single-choice question]

  • A. release
  • B. alloc
  • C. autorelease
  • D. retain

46. The best statement in OC entrust is: [single choice]

  • A. retain
  • B. assign
  • C. copy
  • D. readonly

47. After which of the following operations do you need to use release: [single-choice question]

  • A. delegate
  • B. assign
  • C. retain
  • D. dealloc

48(kind). The interface keywords in OC statement are: [single choice]

  • A. @import
  • B. @interface
  • C. @implemention
  • D. @protocol

49.-(id)setName:(NSString *)name:(NSString *)sex Age:(Int)age The method name is: [Single-choice question]

  • A. -(id)setName:(NSString *)name:(NSString *)setAge:(Int)age
  • B. setName:name:sex age:age
  • C. setName::age:
  • D. setName:name:age:

50. The code to replace @”2C Youth” with @”employed youth” is: [single-choice question]

  • A. [@“2C Youth” stringByAppendingOfString:@“2B” withString:@“intentionally”];
  • B. NSRange range = {0,2}; [@“2C Youth” stringByReplacingCharacterInRange:rangWithString:@“promising”];
  • C. NSRange range = {1,2}; [@“2C Youth” stringByReplacingCharacterInRange:rangWithString:@“promising”];
  • D. [@“2C Youth” stringByReplacingOccurrencesOfString:@“intentionally” withString:@“2C”];

Where to go from here:
2000+ iOS Interview Questions And Answers: Part — 2

Stay tuned for more iOS interview questions and answers. I’ll be updating the post with additional content to provide you with a comprehensive resource for your interview preparation. Keep an eye out for future updates!

By Ganesh Raju Galla| LinkedIn | Medium | GitHub

--

--