Apple Technical Interview Questions and Answers

iOS 4 and above supports multi-tasking and allows apps to remain in the background until they are launched again or until they are terminated.

Q2. Explain frame and bounds?

ANS:

The frame of a view is the rectangle, expressed as a location (x, y) and size (width, height) relative to the super view it is contained within. The bounds of a view is the rectangle, expressed as a location (x, y) and size (width, height) relative to its own coordinate system (0,0).

Q3. Define the location services?

ANS:

Applications such as Maps, camera and compass are allowed to use the information from cellular, Wi-Fi and Global Positioning System networks for determining the approximate locations.

The location is displayed on the screen, using a blue marker.

Q4. Explain iphone sdk?

ANS:

iPhone SDK is available with tools and interfaces needed for developing, installing and running custom native applications.

Native applications are built using the iPhone OSs system frameworks and Objective-C language and run directly on iPhone OS.

Native applications are installed physically on a device and can run in presence or absence of network connection.

Q5. Design a chess game. Basics of a chess game was explained and a player could be human or AI?

ANS:

Follow-up questions:

* What are the main objects?

* How do the main objects interact with each other?

* Which object or objects own the current game state information?

* Implement the method to move a piece to another position on the board. method must communicate if the move is legal or not.

* How do you test the move piece method?

Chessboard: contains a matrix of chess pieces objects

Player: contains a list of references to his/her active chess pieces.

Chess piece: contains color or player, and what type of piece is it (tower, horse...)

test3: if there was another piece at the end position, now it has been removed from the chessboard and from its players list

test4: if it is a queen, tower, ... check that before the movement there was not any other piece in the path

test5: check that the other pieces are at the same places where they were before the movement

Q6. What could be performance hits for searching on Local computer i.e. if you are searching computer for content what are the parameters you will consider for performance?

ANS:

Think about file systems and other OS components.

Not everything in computer is implemented using hast table.

In case of spotlight if you see wiki the underlying data structure is B trees.

Think in that direction what factor apart from B trees would be a performance hit.

Hint: think about file systems.

Q7. Explain Differentiate between Google search and local computer search?

ANS:

Google search is global search engine based on outside information, local computer search is within computer area data or information search.

Q8. What is B trees and its applications?

ANS:

A B-tree is just another tree data structure mostly used within file systems and databases. Common file systems that use B-trees are HFS+ (OSX), ext4 (Linux) and NTFS (Windows).

Q9. Suppose if there are two threads in your app - T1 and T2. T2 has high priority. However, for some reason the priority decreases automatically. What could be the reason? How will you debug it? How will you fix it so that priority stays the same, no matter what?

ANS:

Poll after some constant time

If T1 has priority p always set T2 priority lesser then T1 that is p+1

Q10. Designed a similar API like malloc, which has a similar functionality. How do you test the API?

ANS:

1) Give a very large size(1000000000) and check if its able to allocate

2) Provide number values 1,3,0,100

3) Give a character in size to api

4) GIve blank spaces

5) NUll value for size field in api

6) Call the api from multiple sessions

Q11. Write a function:

char * CreateEmptyString(int len);

function should return an pointer to an empty string of length len

ANS:

char * setEmpty(int len){

if (0>len) return NULL;

char * c = (char *) malloc(len+1);

memset(c, 0, len+1);

return c;

}

Q12. Why an app on iOS device behaves differently when running in foreground than in background?

ANS:

An application behaves differently when running in foreground than in background because of the limitation of resources on iOS devices.

Q13. How to design spotlight search feature in Mac OS?

ANS: B-tree or Hash Table

Q14. Which framework delivers event to custom object when app is in foreground?

ANS:

The UIK it infrastructure takes care of delivering events to custom objects. As an app developer, you have to override methods in the appropriate objects to process those events.

Q15. How to test ios simulator? or How would you test an Android simulator?

ANS:

Two methods must be applied. First, the simulator must conform to the system specification for the hardware. Every instruction that retires must behave exactly as the hardware expects, including every result, and every control register. Unit tests can be written for these individual cases and used to maintain the simulator. Next, real world programs and applications should be ported to run on the simulator. Instrumentation code can be added to provide some kind of checksum section to ensure that the simulator is outputting results the same as hardware.

Q16. Which sorting algorithm you would like to implement as unix library and why?

ANS:

Quick sort for example is important because its average runtime is O(nlog(n)) and in most cases its better than other logarithmic algorithms (Merge Sort and Heap Sort). I would ask him though, why would you want to stop at implementing just one algorithm. How about an API that can use sort based on input size (strategy design pattern ); because for different values of n different sorting algorithms can be useful.

Q17. The producers write elements to a ring buffer(fixed size) while the consumers access elements from it. Implement a write and a read function using a producer pointer and consumer pointer. The consumer pointer cannot surpass the producer pointer and when the producer pointer reaches where it starts again, it stops?

Q18. How to parse a phone number from a huge database of a n billion web pages in 30 minutes?

ANS:

The numbers do have semantic meaning, eg: location. Hence, if the database is distributed, that helps. Additionally, the DB must be stored in a N-nary search tree where N is large, reducing the height of the tree significantly.

Q19. What is the difference between an Apple Watch app and a Watch extension?

ANS:

A Watch app is all about the display. It includes the resource field and storyboards, and its what the end users see.

A Watch extension contains the logic of your app. It manages the content, responds to user interactions, and updates the user interface. The extension actually runs on the users iPhone.

Q20. Can the app get access to use the Watch microphone?

ANS:

No, at least not yet. The gatekeepers in Cupertino do not allow that right now, though you can access the iPhone microphone from the Watch.

Follow us

Employers

FreshersLive - No.1 Job site in India. Here you can find latest 2018 government as well as private job recruitment notifications for different posts vacancies in India. Get top company jobs for both fresher and experienced. Job Seekers can get useful interview tips, resume services & interview Question and answer. Practice online test free which is helpful for interview preparation. Register with us to get latest employment news/rojgar samachar notifications. Also get latest free govt and other sarkari naukri job alerts daily through E-mail.