Test your knowledge

  1. When you use the static var keywords to declare a type property:
    1. You cannot override the type property in the subclasses.
    2. You can override the type property in the subclasses.
    3. You can override the type property only in the superclass.

  2. When you use the class var keywords to declare a type property:
    1. You cannot override the type property in the subclasses.
    2. You can override the type property in the subclasses.
    3. You can override the type property only in the superclass.

  3. When you use the final keyword to declare an instance method:
    1. You cannot override the instance method in the subclasses.
    2. You can override the instance method in the subclasses.
    3. You can override the instance method only once, that is, in just one subclass.

  4. Polymorphism means:
    1. We can call the same method--that is, the same name and arguments--in instances of classes that aren't included in the same hierarchy tree.
    2. We can use the same method--that is, the same name and arguments--to cause different things to happen according to the class on which we invoke the method.
    3. We must declare the same method--that is, the same name and arguments--to enable a class to become a subclass of its superclass.

  5. We can redefine specific operators by declaring:
    1. A type method with a name that matches the operator symbols in the appropriate class.
    2. An instance method with a name that matches the operator symbols in the appropriate class.
    3. An operator function with a name that matches the operator symbols.

  6. If the value for animal.age is 5, which of the following lines increases the value of animal.age to 6 in Swift 3:
    1. animal.age++
    2. ++animal.age
    3. animal.age += 1

  7. Methods that use the public access level:
    1. Are accesible but not overridable outside of the defining module.
    2. Are accesible and overridable outside of the defining module.
    3. Are neither accesible nor overridable outside of the defining module.

  8. Methods that use the open access level:
    1. Are accesible but not overridable outside the defining module.
    2. Are accesible and overridable outside the defining module.
    3. Are neither accesible nor overridable outside the defining module.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.225.117.56