Reputation: 89
Which of the following is NOT a root class in the context of Objective-C?
a. NSObject
b. NSNetworkService
c. NSBase
d. NSProxy
(its a single select question)
I get this question in a online exam for iOS 6. I knowNSObject
and NSProxy
are root classes. But I am not aware of any class with name NSNetworkService
or NSBase
.
I am wondering what is the correct answer for this question.
Note: I have cleared that test and not posting this question for cheating.
Upvotes: 6
Views: 751
Reputation: 4291
I'm not aware of the classes NSNetworkService
and NSBase
(of course someone could name his class with prefix NS
). NSObject
and NSProxy
are base classes, though. So the correct answer is b
and c
.
Edit (thanks Abizern): In the context of iOS, only NSObject
is available which would add answer d
to the set of classes NOT being a root class. I guess the opposite question "Which of the following classes are root classes?" would have been easier to answer given the fact that you said you can choose only one option ;)
Upvotes: 3
Reputation: 3506
see in the following link
1) NSObject
is the root class of most Objective-C class hierarchies; it has no superclass.
2) Cocoa supplies two root classes: NSObject
and NSProxy
. Cocoa defines the latter class, an abstract superclass, for objects that act as stand-ins for other objects; thus NSProxy
is essential in the distributed objects architecture. Because of this specialized role, NSProxy
appears infrequently in Cocoa programs. When Cocoa developers refer to a root or base class, they almost always mean NSObject
.
Edit
see this link http://samplecodebank.blogspot.in/2013/06/NSNetService-getInputStream-example.html
but there is no any discription of NSBase
on Google or SO
So the answer is c. NSBase
Upvotes: 0