xcode q&a

21
X code INTERVIEW QUESTIONS JOBSMATE.COM

Upload: jobs-mate

Post on 10-Jan-2017

123 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Xcode q&a

X codeINTERVIEW QUESTIONS

JOBSMATE.COM

Page 2: Xcode q&a

JOBSMATE.COM

1. Explain what is Xcode?

Xcode is Apple’s integrated development environment (IDE) that you use to design apps for Apple products. It provides various tools to manage your entire development workflow from creating your app, to testing, submitting and optimizing it to the App store.

2. Explain what is struct?

struct is a special C data type that encapsulates other pieces of data into a single cohesive unit.

3. Explain how you can add frameworks in Xcode project?

To add frameworks in Xcode project

• Choose the project file from the project navigator on the left side of the project window

• Choose the target where you want to add frameworks in the project settings editor

• Choose the “Build Phases” tab, and select the small triangle next to “Link Binary With Libraries” to view all of the frameworks in your application

Page 3: Xcode q&a

JOBSMATE.COM

• To add frameworks click on “+” sign below the list of frameworks

• To choose multiple frameworks, press and hold the command key while choosing the framework

4. Mention what is the difference between bounds and frame?

Frame: The frame of a view is the rectangle, represented as a location (X, Y) and size (width, height) corresponding to the superview it is contained within

Bounds: The bounds of a view is the rectangle, represented as a location (X, Y) and size (width, height) corresponding to its own co-ordinate system (0,0)

5. Explain what is the difference between Xcode, Cocoa and Objective C?

Xcode: It is the integrated development environment (IDE) that developer use to write software for IOS or OS X.

Objective-C: It is the language most preferred by developer to write programs for apple

Cocoa: It is the application

Page 4: Xcode q&a

JOBSMATE.COM

6. Explain what is Xcode command line tools package?

Command line tools package is a self-contained package available separately from Xcode. It enables you to do command line development in OS X. It consists of two components like command line tools such as Clang and OS X SDK.

7. Mention what are the new features in Xcode 6?

In Xcode 6, new features include

• Support for Swift: Xcode 6 explicitly supports the Swift code, it is very simple and easy to make a brand new app using 100% swift code to existing frameworks.

• Playgrounds: It enables the interactive experience of a scripting language, like you can show variables in a graph, watch an animated SpriteKit Scene or inspect each step when drawing a view. Once you are done with code in the playground, you can move it into your project

• Command Line: You can use Swift syntax to interact and evaluate with your running app or write new code in a script like environment

Page 5: Xcode q&a

JOBSMATE.COM

• Performance Testing: The XCTest framework is extended to support performance test, and is completely synchronized with Xcode and Xcode Server. It also raises alerts for regression when test results change

• View Debugging: Xcode allows easy debugging and includes new debugging tools like debug gauges to monitor I/O usage and enhance iCloud gauge

8. Mention what is the use of PO command in Xcode?

PO command is useful during debug time. In normal scenario, to print the value of a variable, you have to move the mouse pointer there and select print description print value of it. With PO command, you can print value by just writing the “PO variable name” in output window, and press enter.

9. Mention what are the two different smart groups in Xcode?

Simple smart groups are classified into two categories

Simple filter smart group: It matches files based on file name “globbing” used in the shell

Simple expression smart group: It matches files using regular expression

Page 6: Xcode q&a

JOBSMATE.COM

10. Explain how you can delete a smart group created in Xcode?

It is not possible to delete smart groups individually, so you can delete smart group in Xcode either by

• Deleting all the smart groups saved in an individual project

• Or by deleting all the global smart groups available in the project

11. Explain how you can migrate to Xcode?

To migrate to Xcode you need to import your ProjectBuilderWO projects into Xcode by following steps

• Select file -> Import project -> Open the import project assistant

• From the import project assistant, select the import projectBuilderWO projects and tap mon the next button

• Choose the button to select the project document

• Enter the name you want to use for the new Xcode project in the New Project Name Field and click finish

Page 7: Xcode q&a

JOBSMATE.COM

12. Mention what are the source items used by Xcode?

Xcode uses four different types of source items

• Source File

• Source Group

• Source Folder

• Framework

13. What is the short cut to open the “Code Snippet Library” in Xcode?

(CMD+OPT+Cntrl+2) is the short-cut to open the “Code Snippet Library” in Xcode.

14. Mention the short-cut to edit variables in Scope?

To edit variables in Scope, you can use the command Cntrl+cmd+E.

Page 8: Xcode q&a

JOBSMATE.COM

15. Mention what are the build phases available in Xcode?

There are three build phases in Xcode that is available by default

Compile Sources

Link binary with libraries

Copy bundle resources

16. Explain how app delegate is declared by Xcode project templates?

App delegate is defined as a sub-class of UIResponder by Xcode project templates.

17. Mention what are all instruments available in Xcode?

To trace and profile Mac OS X and iOS code an application is used referred as Instruments. It allows you to track one or more than one processes and analyze the collected data. It helps you to understand the behavior of both operating system and the user programs.

Page 9: Xcode q&a

JOBSMATE.COM

18. Explain what does @synthesize do?

Keyword @synthesize tell the compiler that it should create the setter or getter for the property if you do not supply them with the @implementation block.

19. How would you create your own custom view?

Subclass the UIView class.

20. What is fast enumeration?

Fast enumeration is a language feature that allows you to enumerate over the contents of a collection. (Your code will also run faster because the internal implementation reduces message send overhead and increases pipelining potential.)

21. What is a struct?

A struct is a special C data type that encapsulates other pieces of data into a single cohesive unit. Like an object, but built into C.

Page 10: Xcode q&a

JOBSMATE.COM

22. What is the difference between a NSArray and a NSMutableArray?

A NSArray’s contents cannot be modified once it’s been created whereas a NSMutableArray can be modified as needed, i.e items can be added/removed from it.

23. Explain retain counts.

Retain counts is the way in which memory is managed in ObjectiveC. When you create an object, it has a retain count of 1. When you send an object a retain message, its retain count is incremented by 1. When you send an object a release message, its retain count is decremented by 1. When you send an object a autorelease message, its retain count is decremented by 1 at some stage in the future. If an object’s retain count is reduced to 0, it is deallocated.

24. What’s the difference between frame and bounds?

The frame of a view is the rectangle, expressed as a location (x,y) and size (width, height) relative to the superview 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).

Page 11: Xcode q&a

JOBSMATE.COM

25. Is a delegate retained?

No, the delegate is never retained! Ever!

26. Explain the difference between NSOperationQueue concurrent and nonconcurrent?

In the context of an NSOperation object, which runs in an NSOperationQueue, the terms concurrent and nonconcurrent do not necessarily refer to the sidebyside execution of threads. Instead, a nonconcurrent operation is one that executes using the environment that is provided for it while a concurrent operation is responsible for setting up its own execution environment.

27. Where can you test Apple iPhone apps if you don’t have the device?

iOS Simulator can be used to test mobile applications. Xcode tool that comes along with iOS SDK includes Xcode IDE as well as the iOS Simulator. Xcode also includes all required tools and frameworks for building iOS apps. However, it is strongly recommended to test the app on the real device before publishing it.

Page 12: Xcode q&a

JOBSMATE.COM

28. Does iOS support multitasking?

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

29. Which JSON framework is supported by iOS?

SBJson framework is supported by iOS. It is a JSON parser and generator for ObjectiveC.

SBJson provides flexible APIs and additional control that makes JSON handling easier.

30. What are the tools required to develop iOS applications?

iOS development requires Intelbased Macintosh computer and iOS SDK.

31. Name the framework that is used to construct application’s user interface for iOS?

The UIKit framework is used to develop application’s user interface for iOS. UIKit framework provides event handling, drawing model, windows, views, and controls specifically designed for a touch screen interface.

Page 13: Xcode q&a

JOBSMATE.COM

32. Name the application thread from where UIKit classes should be used?

UIKit classes should be used only from an application’s main thread. Note: The derived classes of UIResponder and the classes which manipulate application’s user interface should be used from application’s main thread.

33. Which API is used to write test scripts that help in exercising the application's user interface elements?

UI Automation API is used to automate test procedures. Tests scripts are written in JavaScript to the UI Automation API. This in turn simulates user interaction with the application and returns log information to the host computer.

34. What is delegate?

The helper object is called the delegate.

Page 14: Xcode q&a

JOBSMATE.COM

35. What are categories?

Categories allow you to add functionality to already existing classes without extending them.

36. Is there over loading function in object c?

No not there

37. How to customize u r app in iphone?

Winterboard is an application that let you customize your iPhone / iPod 2.0+.

38. What is the Winterboard?

Winterboard allows you to customize Springboard of your iphone. Using Winterboard you can change iPhone icons, customize applications, status bar graphics, iPhone dock graphics, install themes and change wallpapers of your iPhone Springboard. You can even customize sounds on your iPhone. With Winterboard you can theme almost everything that comes to your mind. Before iPhone 2.0 there was Summerboard but Winterboard has replaced it since iPhone 2.0 and can even load themes of Summerboard.

Page 15: Xcode q&a

JOBSMATE.COM

39. What is the springboard?

Springboard is the standard application that manages the iOS (formerly iPhone OS) home screen.

40. Is it support multiple inheritance?

Not supported

41. What is the difference b/w iphone and ipad?

Size is bigger than I phone. Split view application is added in ipad.

42. What is the difference between retain and copy?

Retain: this retains the new value in your setter method

This makes a copy of the string in your setter method

43. What is the memory management?

It allocates and reallocates memory and find out memory leaks.

Page 16: Xcode q&a

JOBSMATE.COM

44. How the app delegate is declared by Xcode project templates?

App delegate is declared as a subclass of UIResponder by Xcode project templates.

45. What happens if IApplication object does not handle an event?

In such case the event will be dispatched to your app delegate for processing.

46. Which app specific objects store the app's content?

Data model objects are app specific objects and store app’s content. Apps can also use document objects to manage some or all of their data model objects.

47. Are document objects required for an application? What does they offer?

Document objects are not required but are very useful in grouping data that belongs in a single file or file package.

Page 17: Xcode q&a

JOBSMATE.COM

48. Which object manage the presentation of app's content on the screen?

View controller objects takes care of the presentation of app's content on the screen. A view controller is used to manage a single view along with the collection of sub views. It makes its views visible by installing them in the app’s window.

49. Which is the super class of all view controller objects?

UIViewController class. The functionality for loading views, presenting them, rotating them in response to device rotations, and several other standard system behaviors are provided by UIViewController class.

50. What is the purpose of UIWindow object?

The presentation of one or more views on a screen is coordinated by UIWindow object.

51. What is the configuration file name in iOS explain in brief? (Or) What is plist file and explain about it is usage?

The PLIST file type is primarily associated with 'Property List XML File'. A PLIST file is an XML file using Apple’s plist DTD. PLIST stands for Property List, and refers to the fact that PLIST files typically hold lists of properties. PLIST files are a standard part of Apple's OS X Core Foundation.

Page 18: Xcode q&a

JOBSMATE.COM

52. What is atomic and nonatomic? Which one is safer? Which one is default?

Both are same unless we use our setter and getter methods. If we create our own setter and getter method, then atomic is useful in thread processing, but it is slow. Nonatomic does not give guarantee on thread processing but it is fast.

53. When will be the autorelease object released?

The default autorelease pool is drained every time through the run loop, not once per application lifecycle. So as soon as your current stack of method calls completes, and you're back waiting for a UI event, the pool is drained.

54. Is there any garbage collector concept available in iOS?

No. Garbage collection is too large an overhead for the limited battery life etc. on the device. You must program always with an alloc/release pattern in mind.

55. What is @synthesize?

@property and @synthesize provides the getter and setter (accessors) methods rather than you having to write it out yourself. The declaration is made with @property and it is implemented with @synthesize.

Page 19: Xcode q&a

JOBSMATE.COM

56. Difference between table view and picker view?

Remember that a UITableView is a subclass of a UIScrollView, and the UITableViewDelegate gets all the UIScrollViewDelegate method calls too. scrollViewDidScroll: sounds like it would easily fit the bill for knowing when the table view was scrolled.

57. What is a class difference between a class and a structure?

1. Structures didn’t support data hiding, but classes can.

2. Private functions totally hidden in classes.

3. There is also difference in memory allocation.

4. Members of a class are private by default, whereas members of a struct are public by default.

5. Inheritance between classes is also private by default, and inheritance between structs is public by default.

6. A structure cannot be inherited by a class where as a class can be inherited by a structure.

Page 20: Xcode q&a

JOBSMATE.COM

58. What is protocol?

• A protocol is an important language feature in ObjectiveC. Protocols provide, among other things, the ability to realize multiple inheritance in a singleinheritance language.

• Think of a protocol as an interface in the Java language. Just as classes in Java can implement multiple interfaces, so can classes in ObjectiveC adopt multiple protocols.

• A protocol is just a list of methods. Each method in this list can be tagged as either required (@required, the default) or optional (@optional). If a class adopts a protocol, it must implement at least all required methods in that protocol

59. Default Audio Formate in iPhone?

Files in the Advanced Audio Coding (AAC) format are the default audio format that Apple uses for its iTunes online music store.

Page 21: Xcode q&a

JOBSMATE.COM

Thank you!