Introduction to Objective C(con't)

12 important questions on Introduction to Objective C(con't)

What does lazy instantiation mean?

Using the getter method to instantiate a "property object" if its still nil.

When you alloc init, what happens to the properties?

They all get "set" to nil

Can local variables contain "garbage" when you don't set them to nil?

No, local get set to nil when created
  • Higher grades + faster learning
  • Never study anything twice
  • 100% sure, 100% understanding
Discover Study Smart

Do classnames start with lower or upper case?

They start with Upper case

How does a instance method declaration looks like with no arguments and no return type?

-(void) thisIsAmethodWithNoArguments;
*notice the name starts with a lower case, get use to this habit!

when there is a return type, it could look like this:
-(Card *) thisIsAnotherMethodWithNoArguments;
*this is the return type.

What must be done when we use an "unknown" class in our header or implementation file?

We must import its header file

Do we need to put parentheses around the type in a method?

Yes, for example: - (Card *) aMethod: (NSString *) aString asExample: (Card *) aCard;

When a pointer is 0, how do we call this?

nil

When we create a getter for a property , and its name is "card" of type NSString, how would it look like?

- (NSString *) card {
  return _card;
}

What does this line of code do: self.card[index] (cards is an NSArray)

it will call the method objectAtIndexedSubscript:
The bracket notation look a lot cleaner, and feels like an Array.

What happens when we call objectAtIndexedSubscript: with zero as an argument, or an send it to an empty array?

It will crash

What does UIKit, and where do we need it for?

Its the iOS user-interface framework, we need it co build and manage the GUI!

The question on the page originate from the summary of the following study material:

  • A unique study and practice tool
  • Never study anything twice again
  • Get the grades you hope for
  • 100% sure, 100% understanding
Remember faster, study better. Scientifically proven.
Trustpilot Logo