CS 185C/286 - Lecture 11

Cover page image

Cay S. Horstmann

Lecture 11 Quiz 1

What does this code do?

NSUInteger* day = [cal ordinalityOfUnit:NSMonthCalendarUnit
   inUnit:NSYearCalendarUnit
   forDate:now];
  1. It gets the day of now
  2. It gets the month of now
  3. It's a syntax error because the colons don't line up
  4. It's a syntax error because day shouldn't be a pointer

Lecture 11 Quiz 2

What is wrong with this code fragment?

NSString* greeting = @"Hello";
      if (!(greeting == @"Farewell"))
        NSLog(@"We will meet again");
  1. greeting shouldn't be a pointer
  2. There shouldn't be @ before the strings
  3. You can't compare NSString references with ==
  4. You need braces in the body of the if statement

Today's Lecture/Lab

Garbage Collection

Inheritance

More GUI Minutiae

More Objective-C Trivia

Reading Before Next Class

Lab