Elance iOS Technical Test Answers 2015



True or False? When you create a new iOS project from a template, the template automatically makes a controller object for you.

FALSE
True

 

 

In Objective C, when an application launches and runs the 'main' function, the frame for 'main' is put at the _____ of the stack.

bottom
top

 

 

How can an application respond to they keyboard being dismissed by the user

UIKeyboardWillHideNotification
[UIResponder shouldResignFirstResponder]
This cannot be done
[UIResponder didResignFirstResponder]
[UIResponder resignFirstResponder]

 

 

If you have a CGPathRef and need to draw this path to a core animation layer, which object would you use.

CALayer
CGPathLayer
CAShapeLayer
CGPathRefLayer
CAPathLayer

 

 

Which one of the following is true?

You can only create and draw to an image context on the main thread
You can modify UIKit drawing on a background thread
None of these are true
You can modify Core Animation layers on a background thread

 

 

Which scenario will not result in NSOperation throwing an exceptions:

When you try to add a completion block to an operation that is already executing or finished.
When the return value from a completion block is nil.
When you try to retrieve the result of an NSInvocationOperation object that was canceled.
When the operation is executing or finished (possibly because it was canceled) and its start method is called again.
When the operation is not ready to execute but its start method is called.

 

 

NSXMLParser is which kind of parser ?

DOM Parser
SAX Parser

 

 

Which 3D Framework was added in iOS since iOS 8?

CoreGraphics
CoreAnimation
Quartz
SpriteKit
SceneKit

 

 

What object is responsible for launch time initalization and transitions?

viewDidAppear
Main.m
AppDelegate
viewDidLoad

 

 

Which of the following best describes the differences between iOS 7 and iOS 6?

iOS 6 is not supported on iPhone 5s and iPhone 5c
iOS 7 user interface has been completely redesigned.
iOS 7 supports Autolayout.
iOS 7 user interface has been completely redesigned and has 64-Bit Support.

 

 

In Objective C, what happens when you send a message to a variable that is nil?

You will receive an error message
None of these
Nothing happens
You will receive a confirmation

 

 

Automatic migration between Core Data model versions is sufficient for many cases. Which one of the following cases would require additional migration code?

A mandatory attribute is made optional
A new attribute has been added to an Entity
An optional attribute is made required
A relationship has changed from a 'to-one' to a 'to-many' relationship

 

 

What structure can be used to define a portion of a series?

CGPoint
NSSet
NSRange
NSString

 

 

In ARC enabled project: [someObject release];

Crash on run time
Nothing will do
Compile error
Some time crash some time run well

 

 

Which of the following code snippets would work for changing the position of a view?

(none of these)
CGPoint center = view.center; center.x = 0; center.y = 100; view.center = center;
view.frame.x = 0; view.frame.y = 100;
view.frame.size.x = 0; view.frame.size.y = 100;

 

 

+(void)doSomething{}

Both true
Is a instance method
both false
Is a class method

 

 

Which of the following objects is considered "the managers in an application" by keeping the other objects in sync?

All of these
View objects
Controller objects
Model objects

 

 

Which of the following holds data and knows nothing about the user interface?

Model objects
View objects
Controller objects
All of these

 

 

What is used to sort Core Data results?

[self sort]
NSSort
NSSortDescriptor
NSCoreDataSort

 

 

In order to test your application in XCode, which testing frameworks are available?

OCMock, OCUnit, XCTest
(all of these)
Tes.ting
NUnit, JUnit
MinUnit, IOSUnit

 

 

What is the difference between Cocoa and Cocoa Touch?

Cocoa Touch is the application framework for developing applications in Mac OS X. Cocoa is the application framework for iPhone,iPad and iPod Touch .
Cocoa Touch is another name for a Cocoa framework
Cocoa is the application framework for developing applications in Mac OS X. Cocoa Touch is the application framework for iPhone,iPad and iPod Touch .

 

 

What function do you call to close the current view and go back to the root?

closeCurrentView
popToMainViewController
popToRootViewController
pushRootViewController

 

 

True or False: viewDidLoad comes after viewDidAppear?

False
True

 

 

What's the difference between a frame and bounds?

It's the same
Bounds origin is always (0, 0), a frame origin is relative to his container view
Frame is for UIKit objects, bounds are for CoreGraphics.

 

 

What is a category?

A way to add instance variables to a class which already exists
A namespace
A group of classes
A category is a way to add methods to a class which already exists

 

 

If you use threading, on which thread should UI Transitions be called?

The main thread
The background thread
Concurrent threads
Any thread

 

 

What data type do you initialize if you want a list of items that can change?

NSDictionary
NSMutableDictionary
NSMutableArray
NSArray

 

 

What is the function in Objective C that determines what is in the cells of a tableView?

cellForTableView
cellForRowAtIndexPath
tableViewCellContents
tableView.cell.content

 

 

What structure can hold an x and y coordinate that defines a location?

CGSize
CGRect
NSFrame
CGPoint

 

 

Is it possible to make a full application without using Interface Builder?

Yes, on any platform
No, you always have to use Interface Builder to meet Apple's app standards
Yes, but only for iPad

 

 

Which of the following objects is visible to the user?

Model objects
Controller objects
None of these
View objects

 

 

In manual memory management, what do you do when you don't need a reference on a object ?

[obj free]
free(obj)
[obj dealloc]
[obj release];

 

 

If an asset is for iPad only, how do you specify it in the file name?

!iPad
~iPad
~iPhone
!iPhone

 

 

What data object can store a timestamp the best?

NSArray
NSString
NSDate
NSNumber

 

 

An indexPath has a Section and a ____

Grid
Column
Coordinate
Row or item

 

 

What data type do you initialize if you want a string that can change?

NSMutableString
NSString
NSCore
NSChangeableString

 

 

What is @2x used for?

Retina Assets
NSStrings
Normal Assets
All Images

 

 

The archive that holds the saved create and configure view objects is known as:

XID
XBI
XML
XIB

 

 

ARC Stands for:

Automatic Retained Collections
Autoreleased Reference Counters
Automatic Reference Counting
Allocated Reference Cycles

 

 

Which of the following symbols do you prefix a character string with when you want a hard coded string?

#
&
@
*

 

 

How do you reference your app bundle?

self.bundle
self.app.fileSystem
app.io
[NSBundle mainBundle]

 

 

What's the difference between NSArray and NSMutableArray?

NSMutableArrayʼs contents can not be modified once itʼs been created whereas a NSArray can be modified as needed
NSArray is an abstractClass class and NSMutableArray is a protocol
NSArrayʼs contents can not be modified once itʼs been created whereas a NSMutableArray can be modified as needed
NSArray has a limited capacity of 256 items where as NSMutableArray is unlimited

 

 

Which of the following keyboard shortcuts will run your app on the simulator?

Command-R
Command-G
Command-A
Command-P

 

 

What file contains configuration data for the app?

config.m
Main.m
Info.plist
AppDelegate.h

 

 

What is a delegate?

A delegate is a variable
A delegate holds the type of data a variable stores
A delegate allows one NSObject to send messages to another NSObject, and listen to those messages
A delegate is a UIView

 

 

What function is called for each cell in a Table View?

viewWillLoad
cellDidAppear
cellForRowAtIndexPath
viewDidLoad

 

 

True or False: The main thread handles touch inputs

True
False

 

 

When using ARC, how do you destroy an object in Objective C?

Set the variable that points at it to 1
All of these
Set the variable that points at it to 0
Set the variable that points at it to nil

 

 

True or False: A Collection View is another name for a tableView

False
True

 

 

What is the name of the type of SQL Database that iOS Supports?

SQL
NoSql
MySql
SQLite

 

 

When do you use the "assign" value for a property?

On strings
On arrays and dictionaries
Never. It should always be either: atomic, nonatomic, strong or weak
For primitive values such as BOOLs or NSIntegers

 

 

What do you use to expose preferences for your app in the Settings section of the device?

Settings.bundle
settings.m
NSSetting
Variables.bundle

 

 

What class supports the sharing of small amounts of data such as strings or dates to iCloud?

NSUrlConnection
NSOperation
NSUbiquitousKeyValueStore

 

 

What methods should you call when you add a children view controller?

- (void)removeFromParentViewController
- (void)removeFromSuperview
- (void)addChildViewController:(UIViewController *)childController
- (void)addSubview:(UIView *)view

 

 

How can you make the following code display with rounded corners? UIView *rectView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)]; rectView.backgroundColor = [UIColor redColor]; rectView.layer.cornerRadius = 8; [self.view addSubview:rectView];

[rectView drawRect:rectView.bounds];
rectView.roundedCornersVisible = YES;
[rectView setNeedsDisplay];
rectView.layer.masksToBounds = YES;

 

 

Which of the following statements is TRUE?

When using Grand Central Dispatch your app is assigned three Serial dispatch queues
When using Grand Central Dispatch you can create as many serial dispatch queues as you want
When using Grand Central dispatch only three Serial dispatch queues can operate concurrently
(none of these are correct)

 

 

What are the two types of predicates?

Comparison and Compound predicates.
Expression and Operator predicates
Filter and exclusion predicates

 

 

What flag prevents the device from turning off wifi if your app is running?

NSWifi
UIRequiresPersistentWiFi
UINetworkFlag
Airplane Mode

 

 

Which is intended for storing small amount of sensitive data that are specific to your app like encrypted container and other secrets?

All the above
None of the above
Setting.bundle
info.plist
Keychain

 

 

What is a SEL?

A pointer to a method
The C type of a class
The C type of a message selector
A selection

 

 

Which statement is NOT true of notifications?

Objects register with a notification center to receive notifications
Notifications are identified by the name instance method
Notifications must be registered on the App Delegate
Notifications are used to broadcast messages to possibly several recipients unknown from the sender

 

 

Which of the follow statements is TRUE of the use of categories?

A category can only be declared for abstract classes.
The syntax to declare a category uses the @protocol keyword.
The compiler synthesises any instance variable or property accessor methods for the category.
You can also use categories to split the implementation of a complex class across multiple source code files.

 

 

In Objective C, what class will allow you to use one or more blocks concurrently?

NSConcurrency
NSConcurrentBlock
NSBlock
NSBlockOperation

 

 

Which of the following lines of code will cause a run time crash?

NSDictionary *dict = [NSMutableDictionary dictionary];
NSArray *array = [NSArray arrayWithObject:nil];
NSNumber *num = [NSNumber numberWithInt:[NSNumber numberWithInt:1]];
NSArray *array = @[ @"1", @"1", @"2", @"YES" ];

 

 

In Core Data, what is the object representation of a record called?

NSManagedObjectModel
NSEntityDescription
NSManageObjectContext
NSManagedObject

 

 

What would be the localized resource name for French?

fr.plist
fr.lproj
fr.local
french.lproj

 

 

True or False: You can weak link to an entire framework?

True
False

 

 

What is the preferred way to store paths to files?

NSURL
fileWithPath
NSSystemResource
NSFile

 

 

True or False? An object with at least one owner can be destroyed.

False
True

 

 

What is a persistent object store?

It is retained database objects
It is the relationships between tables in your data
It is the schema for your object
It represents an external file of persisted data.

 

 

True or False: You can use %@ to specify a dynamic property in Objectve C.

False
True

 

 

How can you temporarily disable layer actions in a Core Animation?

Using the CAStopAnimation class
Using the CATransaction class
Using the CAStop class
Using the CAExit class

 

 

What happens if you use fgets and do not give it a size smaller than the buffer?

It will use the size of the object as its size
It will overwrite the data past the size
None of these
It will clip its size automatically

 

 

This code doesn't do much, but which line will call the + (void)initialize method on the class SomeClass 1. - (void)doSomething 2. { 3. [SomeClass someClassMethod]; 4. SomeClass *obj = [[SomeClass alloc] init]; 5. NSString *descriptionString = [obj getNewString]; 6. }

line 4
line 1
line 5
line 3

 

 

What protocol is used to create an action object?

NSAction
CAAction
None of these
CoreAnimation

 

 

In which scenario should you use an NSDictionary over an NSArray?

When insertion time should be fast
When item retrieval should be fast and in constant time
When storing literals
It does't matter, they're both data structures and can be used interchangeably

 

 

In Core Data, what is the name of the object representation for the database schema?

NSManagedObject
NSEntityDescription
NSManageObjectContext
NSManagedObjectModel

 

 

In Objective C, which of the following is group of objects that can be visualized as a physical set of frames?

The set
The stack
The frame
The heap

 

 

Which instrument would be most suited to debug whether a view is drawn from cache or redrawn?

Core Animation
Time Profiler
Zombies
Open GL ES Driver

 

 

Which of the following is true?

A class cannot be declared as abstract
Instance variables must begin with underscore
A class cannot implement more than one protocol
Instance variables have to be declared in the header file containing the class definition

 

 

The app is in the background but not executing code. What State App is it in?

None of above
InActive
Suspended
Terminated
Background

 

 

True or False: In Objective C, all instance methods are accessors.

TRUE
False

 

 

What is the effect of using 'weak' in the following @property definition: @property (nonatomic, weak) SomeClass *responder; ?

The responder object is not retained and the pointer is set to nil when the object is destroyed
The responder object is not retained and the pointer will point to free memory when the object is destroyed
The responder object is retained and the pointer is set to nil when the object is destroyed
The responder object is retained and the pointer will point to free memory when the object is destroyed

 

 

how can we return multiple values from function?

void*
return multiple(...)
tuple
not possible

 

 

When adding objects to NSMutableDictionary, the key...

Can be any object
Must be wither an NSString or an NSNumber
Must conform to the NSCopying protocol
Must be a string literal

 

 

What class can implement Document Objects?

NSArray
NSDocument
UIDocument
NSUrl

 

 

Which of the following methods is used to deallocate all the noncritical custom data structure associated with your view controller?

None of above
didReceiveMemoryWarning
viewDidUnload
viewWillUnload
dealloc