Objective-C Flashcards

1
Q

Who owns Objective C?

A

Apple

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the two main Objective-C frameworks used?

A

Foundation and AppKit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Name three features that Objective-C 2.0 Added?

A

Garbage Collection, Syntax Enhancement, Runtime Performance Improvmenets

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the difference between the #include and #import statements?

A

import has the same function as #include but includes a builtin #include guard.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the 5 foundation framework classes in Objective-C?

A

NSNumber, NSString, NSMutableString, NSArray, NSMutableArray

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How is a constructor used in Objective-C?

A

The method name always starts with init and is called after allocing the required memory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is an id?

A

A datatype that is a pointer to any type of objects and supports dynamic referencing when used as a return type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How is a destructor implemented in Objective-C?

A

It is always called dealloc and is handled automatically rather than being explicitly called by the program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the two types of memory management used in Objective C?

A

Manual Retain-Release (MRR) and Automatic Reference Counting (ARC)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How is MRR implemented?

A

Manage Memory by tracking how many owners an object has, retain and release to register and release ownership of an object. Once an object has 0 owners it is destroyed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How is ARC implemented?

A

ARC uses the same process as MRR but it is handled automatically and so release, retrain, and autorelease must not be called explicitly.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How are objects different in Objective-C and C++ different?

A

In Objective-C objects are based on a message passing paradigm where objects communicate by sending messages to each other whereas in C++ objects conform to a class based paradigm.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are the advantages of using A wrapper class such as NSNumber?

A

Type Safety as it allows you to encapsulate all numeric scalar values, Compatability as many API’s in Objective-C expect an object rather than a primative data type.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are disadvantages of using a wrapper class such as NSNumber?

A

Performance Overhead and Memory Consumption

How well did you know this?
1
Not at all
2
3
4
5
Perfectly