Objective-C Flashcards

1
Q

Tiobe

A

Code quality analysis company

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

import

What kind of inclusion is this?

A

Textual inclusion. Fancy copy/paste with a few improvements over #include.

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

What’s the problem?

#define readonly 1
#import
A

The macro defines readonly BEFORE the import, which means that definitions for readonly change within system files. This generates errors in the system files.

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

import

What is the code size for

A

More than 350KB.

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

What are the problems with precompiled headers?

A

UIKit/Cocoa framework used these. Creates namespace problems.

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

What is

@import iAd;

A

Replaces #import . Imports framework semantics. No macro issues. No more “Choose Framework”. This is an opt-in build feature. Mapping of #import is automatic for legacy code.

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

What is a workspace?

A

A group of projects.

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

What is derived data?

A

Symbol indices, build products, window layouts, etc.

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

When are modules supported?

A

iOS 7 & Mavericks. No C++ or user frameworks.

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

What is (instancetype)?

A

It is a contextual keyword.

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

What are explicitly-typed enums?

A

Enums that give errors when you assign to the wrong type.

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

What are tagged pointers?

A

For small value-like objects, value is actually stored in the pointer. Bottom four bits are always zero because objects are 16-byte aligned. When that unused portion is 1, the rest of the pointer becomes data. Don’t exploit this! Implementation detail. :)

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

What are boxed values?

A

Scalar values wrapped in objects.

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

What is the convenience function equivalent of…

@’Z’

A

[NSNumber numberWithChar:’Z’]

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

What is the difference between bool and BOOL?

A

bool is C, BOOL is Objective-C. YES and NO macros are defined as (BOOL)1 and (BOOL)0.

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

What is this code:

@(getenv(“PATH”))

A

A boxed expression.

17
Q

How do you box an enum?

A

As a boxed expression:

enum foo {
FOO
}
@(FOO)

18
Q

What is CADisplayLink?

A

A Quartz Core Framework class that allows you to sync up drawing with the display rate.

19
Q

What is a blit?

A

Block Level Transfer.

20
Q

What is this?

^NSComparisonResult(id obj1, id obj2) { …

A
NSComparisonResult is the return type to denote the ordering of two objects. 
typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);