Top 15 Cocoa Api Interview Questions
Q1. What Is Appkit Framework; Specify Some Of Its Features?
Appkit framework is needed for imposing graphical, event -pushed consumer interface in OSX like window, buttons, panels, menus, scroller, text area, table views and so on.
The root of the Appkit framework is the NSResponder elegance.
Appkit is split more often than not into these regions:
User Interface Classes
Global Application Object – NSApplication
Windows and Views – NSWindow, NSView
Controller Classes – NSObjectController, NSArrayController, NSDictionaryController, NSTreeController
Panels (Dialogs) – NSPanel
Menus and Cursors – NSMenu, NSMenuItem, NSCursor
Grouping and Scroll Views – NSBox, NSScrollView, NSSplitView and so on
Tables and Outline Views
Text and Fonts – NSFont, NSFontManager.
Graphics and Colors – NSImage, NSColor, NSColorPanel. NSColorWell, NSGraphicsContext, NSBezierPath and many others.
Printing and Faxing (NSPrinter, NSPrintPanel, NSPageLayout, NSPrintInfo).
Document and File System Support NSFileWrapper, NSFileManager.
Sharing Data with other packages – NSPasteBoard.
Drag & Drop.
Spell Check – NSSpellServer.
Q2. What Is The Main Development Environment For Cocoa?
XCode and Interface Builder (For UI Development the usage of drag and drop from an item library).
Applications can also be built using a text editor and building the software from command line the use of make documents and use the gdb debugger to debug the utility from command line.
Using XCode and Interface builder it is very clean to design, manipulate, construct and debug software products.
Q3. What Is Cocoa?
Cocoa is an application surroundings and a set of item oriented components to expand OSX and iOS Apps.
Cocoa apps are primarily evolved the usage of Objective C & Swift language.
Objective C is primarily based out of ANSI C for this reason ANSI C code can be mixed with Objective C code while developing a Cocoa Application.
Cocoa Applications also can consist of C++ code.
Cocoa has 3 center frameworks:
Foundation Framework (Part of the core service layer).
App Kit Framework (Application Frameworks).
Core Data Framework.
Q4. What Are The Compiling Options In Xcode?
GCC : The GNC C Compiler (gcc)
LLVM: GCC (Low level digital system compiler). Provides past optimization instances.
Clang: Fast collect instances and diagnostics
Q5. What Are The Performance Tools Available For Cocoa Application Development?
Instruments : Instruments may be used to expose the subsequent
CPU Usage
Disk Reads and Writes
Memory Statistics
Thread interest
Network facts and so on
Shark: Traces characteristic calls and graphs reminiscence allocation.
Big Top: Graphs overall performance traits.
Spin Control: Gathers information about what the application turned into doing while the rainbow spinner appeared.
Malloc Debug: Shows how a whole lot reminiscence the software is ingesting and which features allocated huge amounts of reminiscence. Also enables discover leaks by using finding allotted memory that isn't referenced everywhere within the software.
Quartz Debug: allows debug applications that do huge amounts of drawing and imaging.
Q6. What Is Xcode?
XCode is the engine that powers Apple’s included development environment (IDE) for OSX and iOS.
Using XCode developers can:
Create and Manage Projects,
Specify structures and goals, Dependencies and Build Configurations
Build the mission
Debug the undertaking
Can build code written in C, C++, and Objective C
Create photo person interface.
Manage Source Code using subversion & git.
Q7. What Is Interface Builder?
Interface builder is a graphical tool for developing user interfaces.
Has the subsequent layout element:
Nib Files /XIB files:carries the gadgets appearing on a person interface in an archived shape.
Objects Library: Contains a list of UI Objects.
Inspector: Used for configuring the objects of a user interface.
Connection Panel: connects shops to actions.
Q8. What Are The Primary Cocoa Frameworks Required To Build A Cocoa Application?
There are two important frameworks required for constructing Cocoa Applications:
Mac OSX Cocoa Applications– Appkit Framework and Foundation Framework.
IOS Apps – UIKit Framework and Foundation Framework.
Q9. State Some Of The Important Classes In Cocoa?
NSNumber: Can instantiate item that contains integers, floats or doubles.
NSDate: For storing streams of bytes, writing records items to the file device and reading from them.
NSDate: Displaying dates, instances in many codecs. Time modifications primarily based on time zones.
NSString: Different illustration of man or woman strings consisting of UTF-eight and so forth.
NSAttributedString: Supports strings with attributes which include font and so on.
NSArray: Ordered series of gadgets, uses 0 primarily based indexing.
NSDictionary: Managing key fee pairs, Dictionaries are unordered and have to contain precise keys.
NSSet: Similar to NSArray but unsorted. Contains wonderful gadgets.
NSFileManager: Used for file operations.
NSThread: Used for creating multithreaded packages.
NSOperation & NSOperationQueue : To carry out more than one operations (concurrent & Non-Concurrent) in precedence and dependence order.
NSXMLParser: To method XML Data.
NSXML: Used to symbolize a XML document as a hierarchical tree.
Q10. What Is The Basic Difference Between The Foundation And The Appkit Framework?
Foundation (Foundation. Framework):
Root Object
Classes representing simple facts types together with strings and byte arrays.
Collection of instructions for storing other Objects.
Classes representing system records which include dates.
Classes representing Communication Ports.
Application Kit (AppKit.Framework):
Graphical, event-pushed person interface- Windows, panels, buttons, menus, scrollers, text fields and so on.
Communication with hardware devices and screen buffers.
Event coping with, utility and file control.
Integrate and manage fonts, colorings, printing and many others.
Q11. What Are The Different Layers Of The Mac Osx?
The Mac OSX is layered into the following:
User Experience:
Aqua
Dashboard
Spotlight
Accessibility
Application Frameworks:
Carbon
Java
Applet
Graphics and Media (Application Services):
Core Animation
Core Image
Core Video
QuickTime
OpenGL
Quartz
Core Audio
Core Services:
Carbon Core
Launch Services
Core Foundation
Foundation
Q12. What Is Foundation Framework; Specify Some Of Its Features?
The Foundation framework defines a base layer of classes that may be used for any sort of Cocoa program.
Foundation framework is designed for:
Define simple item conduct and introduce regular conventions for things like reminiscence control, object mutability, and notifications.
Supporting internationalization and localization with (amongst other matters) package generation and Unicode strings.
For supporting object persistence.
For helping object distribution.
Providing a few measure of working-machine independence to assist portability.
Providing item wrappers or equivalents for programmatic primitives, which includes numeric values, strings, and collections. It additionally presents utility lessons for having access to underlying system entities and offerings, along with ports, threads, and report structures.
The basis magnificence hierarchy is rooted at NSObject Class at the side of NSObject and NSCopying protocols
The Foundation Framework is logically grouped into Categories.
Value Objects:
Encapsulates values of primitive facts types inclusive of strings, integers , floats, dates and so forth
NSNumber instantiates numbers that includes integers, floats, doubles
NSDate, NSTimeZone, NSCalendar, NSDateComponents affords objects that represent instances, dates, calendar and locales
Collections:
NSArray, NSDictionary, NSSet in conjunction with the mutable variants
Operation System Services:
File System and URL NSFileManager. NSFileHandle, NSURL etc
Concurrency NSThread, NSOperation, NSOperationQueue
Interprocess Communication – NSPipe
Networking – NSNetService, NSNetServiceBrowser
Notifications
Archiving and Serialization
XML Processing – NSXML
Predicates and Expressions – NSPredicate, NSCompoundPredicate, NSComparisonPredicate.
Spotlight Queries NSMetadataItem. NSMetadataQuery.
Q13. What Are The Root Classes In Cocoa?
The root elegance does no longer inherit from another class and all other training inherit from the basis elegance.
The root magnificence mainly accesses and interacts with the goal C runtime.
Cocoa has two root lessons:
NSObject
NSProxy (vital within the dispensed item architecture)
Q14. What Is Core Data?
Core Data is a cocoa framework that gives infrastructure for dealing with item graphs & persistent garage.
Core Data saves version objects to a chronic save and fetches.
Central idea of Core Data is managed object. A managed item is a model item that is an instance of NSManagedObject.
Managed Context – All controlled objects must be registered within the managed object context. The context permits an software to feature items to the graph and remove them from it.
Q15. What Does Cocoa Offer?
Event Driven Behavior – Cocoa offers the infrastructure for occasion pushed conduct.
It enables manage application, windows and workspaces
Has a wealthy library of person interface objects to be had in Interface builder. UI Objects can be dragged dropped from the interface builder or can be comprised of code. Some sample UI gadgets are (buttons, tables, views, home windows, panels, drawers, segmented manage etc).
Supports the following:
Drawing and imaging
Interaction with report system and workspaces
Concurrency, multithreading , lazy loading etc
Internationalization
Different textual content representation
Maintains application possibilities
Networking, communication with servers
Printing help, basic printing to advanced printing options which include pagination and content material formatting
Handles Undo and Redo management
Audio and Video using QuickTime framework
Data change the usage of Copy Paste and Drag Drop
Document based totally architecture (similar to word or excel)
Script-ability, i.E Applications responding to commands emitted from Apple Scripts (e.G: Play, Pause songs in iTunes the use of Apple Scripts).

