NAME

Question types


Start with


Question limit

of 45 available terms

Print test

45 True/False questions

  1. The program section in detailThis section contains the code to solve your particular problem, which can be spread out across many files. Somewhere you must have a routine called main. That's where your program begins execution.

          

  2. Factory or class methodsMethods that apply only to your car

          

  3. Applying the same methods to different objects is one of the key concepts of object-oriented programmingnote

          

  4. A value is returned from a method using the return statement.Note

    return 0;

          

  5. Class names should begin with a capital lettercar

          

  6. Initialize the objectMethods that apply only to your car

          

  7. The init method also returns a value - namely, the initialized object. You store the return value in your variable myFraction- (void) setNumerator: (int) n;

          

  8. Three-line sequence (final shorthand)Describes the data (the instance variables that objects from a class will store) and contains the actual code that implements the methods declared in the interface section.

          

  9. In the past, iOS programmers were responsible for telling the system when they were done using an object that they allocated by sending the object a release message. That was done in accordance to the memory management system known as manual reference counting. As of Xcode 4.2, programmers no longer have to worry about this and can rely on the system to take care of releasing memory as necessary. This is done through a mechanism known as Automatic Reference Counting (ARC). ARC is enabled by default.Note

    return 0;

          

  10. General format for the @interface sectionDescribes the class and its methods

          

  11. The ultimate goal for objectscar

          

  12. The @interface sectionContains the program code to carry out the intended purpose of the program.

          

  13. Rules for forming names- (int) returns an integer
    - (void) returns no value
    - (double) returns a decimal

    Tells the program what type of value the method returns

          

  14. Applying methods to classes or instances[ yourCar setSpeed: 55 ];

    set the speed to 55 mph

          

  15. Display the value of myFractionNSLog (@"The value of myFraction is: ");
    [myFraction print]

    invokes the print method

          

  16. Allocating a new object (using alloc)Fraction *myFraction;

          

  17. The program sectionContains the program code to carry out the intended purpose of the program.

          

  18. @synthesizeApplying a method to an object will affect the state of that object

          

  19. How to get a new carYour particular car

          

  20. instanceApplying a method to an object will affect the state of that object

          

  21. The @ interface section details1. You have to define where the class came from when you define a new class. That is, you have to name it's parent class.

    2. You need to define the type of operations, or methods, that can be used when working with objects from this class.

    3. You also need to list items known as properties

          

  22. leading (-) signindicates an instance method

          

  23. A method that takes an argument[ yourCar setSpeed: 55 ];

    set the speed to 55 mph

          

  24. Create an object to store a fraction// Set fraction to 1/3

    [myFraction setNumerator: 1];
    [myFraction setDenominator: 3];

    The first message statement sends the setNumerator: message to myFraction. The argument that is supplied is the value 1.

    Inside the setNumerator: method, the passed value of 1 is stored inside the variable n. The single program line in that method effectively stores that value in the instance variable numerator.

          

  25. When deciding on a name, don't be lazy. Pick names that reflect the intended use of the object or variable.Note

          

  26. More data is stored with the object than just that indicated, but you don't need to worry about that here. You'll note that the instance variables are shown as being set to 0.Fraction *myFraction;

          

  27. The @implementation sectionYou have to describe the data that members of the class will contain. These members are called instance variables. You declare the methods in the @interface section and then you define them in the @implementation section.

          

  28. ObjectA thing.

          

  29. Each time a new car is manufactured, a new instance from the class of car is created, and each instance of the car is referred to as an object.myFraction = [[Fraction alloc] init]

          

  30. The name of the classcar

          

  31. An instance of a carYour particular car

          

  32. Fraction *myFractionThe asterisk represents a reference (or pointer) to a object. The variable myFraction doesn't actually store the fraction's data. Instead it stores a reference - which is a memory address - indicating where the object's data is located in memory. You can think of it as an empty box.

          

  33. methodAn action that is performed on an instance of a class or to the class itself

          

  34. Create the object (ask the factory to build a car). This zeros out all of the object's instance variables.Fraction *myFraction;

          

  35. stateApplying a method to an object will affect the state of that object

          

  36. The @implementation section in detailDescribes the data (the instance variables that objects from a class will store) and contains the actual code that implements the methods declared in the interface section.

          

  37. leading (+) signindicates an instance method

          

  38. Return Values- (int) returns an integer
    - (void) returns no value
    - (double) returns a decimal

    Tells the program what type of value the method returns

          

  39. Specifying an integer argument[ yourCar setSpeed: 55 ];

    set the speed to 55 mph

          

  40. You can also declare the instance variables for a class in the interface section. This is considered a better way to define a class.@interface NewClassName: ParentClassName
    propertyAndMethodDeclarations;
    @end

          

  41. When a method name ends with a colon, it means that it is expecting to see an argument.- (void) setNumerator: (int) n;

          

  42. Set the value of your fraction// Set fraction to 1/3

    [myFraction setNumerator: 1];
    [myFraction setDenominator: 3];

    The first message statement sends the setNumerator: message to myFraction. The argument that is supplied is the value 1.

    Inside the setNumerator: method, the passed value of 1 is stored inside the variable n. The single program line in that method effectively stores that value in the instance variable numerator.

          

  43. instance methodsA unique occurrence of a class

          

  44. Two-line sequence of allocating a new instance of a class and initializing itFraction *myFraction = [[Fraction alloc] init]

          

  45. The @implementation section general format@implementation NewClassName
    {
    memberDeclarations;
    }
    methodDefinitions;
    @end

    NewClassName is the same name that was used for the class in the @interface section.

    The memberDeclarations section specifies what types of data are stored in your instance of the class. It is enclosed inside its own curly braces

    i.e.
    int numerator;
    int denominator;

    The members declared in this section are known as instance variables. Each time you create a new object, a new and unique set of instance variables are also created.

    The methodDefinition part of the @implementation section contains the code for each method specified in the @interface section.

    Each method starts by identifying the type of the method (class or instance; + or -), its return type, and its arguments and their types. Instead of the line ending in a semicolon, the code for the method follows, enclosed in a set of curly braces.

    -(void) print
    {
    code
    }