Fundamentals Flashcards

Learn fundamentals of Objective-C

1
Q

int

A

storing integers - %i or %d

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

char

A

storing characters - %c

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

float

A

storing numbers with decimals - %f

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

double

A

same as float but double accuracy - %e

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

Counting

A

Always start with zero

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

Conditionals

A

For making a decision

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

==

A

equality operator check

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

=

A

For assigning the first value to the second

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

x++

A

Increase by 1 for loops

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

While

A

Like “for” but conditional runs after block of code

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

Pointer

A

Point to a location (for computer memory)

int* foo = 123

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

OOP

A

Variable and Functions trade for Objects and attributes

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

Objects

A

Are instance of a class

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

Instant Method

A
One object in a class 
i.e. - (void) addGas;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Class Method

A
All objects in class
i.e. All Cars
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Method syntax

A

[recipient message];
who method
Nested ex. [NSString alloc] init];
best practice never do more than 2

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

Accessor Methoods

A

Get data

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

Setter Methods

A

Update attributes of objects - no need to return a value

- (void) setCaption: (NSString*)input;

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

Data Encapsulation

A

Data is contained by methods in classes

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

Classes Contain 2 Files

A

Implementation (.m) and Interface (.h)

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

Interface File (.h)

A

Defines instance variables and public methods

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

Implementation File (.m)

A

Actual code for methods in interface file including private methods

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

NS

A

Next Step

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

NSString

A

String text that is immuatable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
NSMutableString
String that is mutable
26
NSArray
Array of objects that is immutable
27
NSMutableArray
Array of objects that is mutable
28
NSNumber
Holds numeric value
29
Inheritance
All classes inherit from parent class (ex. methods)
30
@property (weak)
Attributes is used as a reference. Attribute is not owned by the object
31
@property (strong)
Attribute is owned by the object and will be save in memory
32
ARC
Automatic Reference Counting used to make memory counting easier
33
NSArray
Holds a list of objects
34
NSDictionary
Holds a list of key/value object pairs
35
@
Common prefix for all Objective-C literals
36
Literals
NSString, NSArray, NSDictionary, etc.
37
Nil
Prints a null meaning no value Value of an object pointer when it isn't pointing to anything
38
*
Pointer to where information can be found
39
%p
Prints output
40
id
Generic container to put in any type of object (string, array, etc,) No need for * because id is a pointer by definition
41
selector
SEL object to call during runtime - how you send in methods names as parameters SEL firstNameSelector = @selector(firstName); NSLog(@"[person firstName] = %a", [person performSelector:@selector(firstName)]);
42
enums
list of predefined values / constants
43
structs
structure group of variables
44
unsigned int
integers with no negatives %u
45
void
Return nothing
46
dot syntax
Only for "getter" & "setter" methods (accessor)
47
method with input
method:input
48
Class Method
+ (NSString*) caption;
49
dealloc
Called on an object to remove it from memory Use finalize method with garbage on
50
reference counting
alloc an object, retain an object, you should release for each occurrence
51
2 Reason to Create an Object
1. To keep it as an instance variable | 2. To use temporarily for single use inside a function
52
Memory Management inside a function
If you create an object with alloc or copy, send it a release or autorelease. Any other way, do nothing.
53
retain
For @property to retain input value
54
@synthesize
Automatically generates the setter and getters for us in Implementation file @synthesize caption;
55
self.
Syntax for setter method which includes memory management
56
categories
Allows you to add methods to an existing class without subclassing it or needing to know further details. Utilities is Category. @interface NSString (Utilities) - (BOOL) isURL; @end
57
new line
/n
58
Precedence
Parenthesis, exponents, multiplication, division, add, subtract
59
Modulus
The remainder % int m = 38 % 7; return 3
60
new line
/n
61
@class
used when we only want to declare the object of any class..
62
@interface
``` Creates a class @interface Fraction: NSObject { int numerator; int denominator; } ```