Amazon.com Widgets Chapter 9 Quiz
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 21, 2014, 12:21:13 PM
Home Help Search chat Login Register 
News: Read this please.The Great Kangaroo Escape Looking for reviews of the 4th ed on Amazon!   Twitter:  @skochan
                     

+ Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
|-+ Study Group
| |-+ Objective-C Quizzes
| | |-+ Chapter 9 - Polymorphism, Dynamic Typing, and Dynamic Binding
| | | |-+ Chapter 9 Quiz
Pages: [1] Go Down
Print
Author Topic: Chapter 9 Quiz (Read 4537 times)
skochan
Administrator
Hero Member
*****
Posts: 3114







on: May 17, 2009, 10:18:28 AM

A 10-question quiz on Chapter 9.
 
Chapter 9 Quiz

Cheers,

Steve Kochan
Logged
jkiley
Newbie
*
Posts: 43



Email




Reply #1 on: May 17, 2009, 10:55:25 AM

Thanks, Steve.  Thinking through the answers to these helped me get a clearer idea of what exactly polymorphism and dynamic binding actually are.
Logged
skochan
Administrator
Hero Member
*****
Posts: 3114







Reply #2 on: May 17, 2009, 03:58:38 PM

You're welcome!  I try to word the questions so they're more of a review than an actual test.  Glad this one helped!

Cheers,

Steve Kochan
Logged
csuter
Newbie
*
Posts: 2


Email




Reply #3 on: May 19, 2009, 06:21:01 PM

A 10-question quiz on Chapter 9.

I haven't looked at Chapter 9; I've only looked at the quiz, but I think there are a few misleading questions in this quiz.

   1. People might think that methods with the same name *have* to have the same arguments and return types. They don't although the compiler does need to know at compile time which of the methods to call. For example, you might have a number of classes derived from, say, GraphicObject that support a draw method and another set of drawing classes derived from TextObject, that support a draw method returning a different return type or different arguments and that would be perfectly legal. (You wouldn't want to do that, but that's beside the point.)

   2. respondsToSelector returning YES doesn't necessarily mean the method is implemented in the class. It could be handled by the forwarding mechanism.

Regards,

Chris
Logged
skochan
Administrator
Hero Member
*****
Posts: 3114







Reply #4 on: May 19, 2009, 06:58:01 PM

Chris,

Thanks for the input. 

For #1, the question refers to dynamic typing, where the the class of the receiver is not known until runtime.

And for #2, I will also rephrase the question.

Cheers,

Steve Kochan
Last Edit: May 19, 2009, 07:02:26 PM by skochan Logged
csuter
Newbie
*
Posts: 2


Email




Reply #5 on: May 19, 2009, 07:19:46 PM

For #1, the question refers to dynamic typing, where the the class of the receiver is not known until runtime.

I did realise that. I was just concerned that because of the way it was worded, people might come away thinking that all methods with the same name must have the same return type and arguments. Typically you would send messages to an object of some type from which other objects are derived, like a GraphicsObject class, and in that case the compiler would be able to distinguish a draw method in that class from another one. That's obviously still a case where the receiver is not known until runtime.

Regards,

Chris
Logged
skochan
Administrator
Hero Member
*****
Posts: 3114







Reply #6 on: May 19, 2009, 07:25:39 PM

Chris,

Yes, I see your point Chris.  I will rephrase the question, as I was referring to an id object being sent a message.  I may also need to clarify that further in the text.

Thanks,

Steve Kochan
Last Edit: May 20, 2009, 07:46:50 AM by skochan Logged
Pages: [1] Go Up
Print
Jump to:



Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Entire forum contents (c) 2009 classroomM.com. All rights reserved.