A class can conform to only one protocol.
Ans:false
A class can have two methods with the same name, but with different argument types.
Ans:false
A method can be tagged to be called only by a specific class and its subclasses.
Ans:false
As categories can't have instance variables, what class could you use to implement a full class only with categories?
Ans: NSMutableDictionary
Can an exception caught in @catch be re-thrown?
Ans:Yes
Can you send messages to nil?
Ans:Yes
How do you allocate an object?
Ans:
How do you free an object?
Ans: [obj release]
How do you include the root "Object" class?
Ans: it depends on the compiler
How do you throw an exception?
Ans: @throw exception
If you need to allocate custom memory, in which method will you do so?
Ans: None of the above
In Obj-C 2.0, what do the fast enumeration protocols rely on to provide fast Enumerations?
Ans: C arrays
In which version of Objective-C did the fast enumeration system appear?
Ans:2.0
In which version of Objective-C did the properties system appear?
Ans: 2.0
What are @try and @catch?
Ans: Exception Keywords
What can be linked to an Obj-C program without any particular process?
Ans: C libraries
C++ libraries
What can be used as Object instance variables?
Ans: pointer, int, structures, unions
What can you do with categories?
Ans:Add methods to a class without subclassing it, Override methods to a class without subclassing it.
What class specifiers are supported?
Ans: There is no such thing as class specifiers
What comments are supported in Obj-C?
Ans: //Line comments , /* Block comments */
What does Obj-C not support?
Ans: Automatic variables
What happens if two categories define methods with the same names for the same class?
Ans: At runtime,either method will be called
What happens if you release an unretained object twice?
Ans:MemoryException is raised
What is #import
Ans:C preprocessor construct to avoid multiple inclusions of the same file.
What is a @finally block?
Ans:A block of code that is run whenever an exception is thrown or not
What is a category?
Ans:A category is a way to add methods to a class which already exists
What is a protocol?
Ans: An interface without an implementaion
What is a SEL?
Ans:A pointer to a method
What is an autoreleased object?
Ans:An object that will be released when the current AutoreleasePool is deallocated
What is an IMP?
Ans: The c type of a method implementaion pointer
What is nil?
Ans: The null object
What is not supported in Obj-C?
Ans:Method argument default
What is the C type used to work with objects in Obj-C?
Ans:Pointer
What is the default visibility for instance variables?
Ans: @protected
What is the id type?
Ans: A generic c type that objective-c uses for an arbitary oobject
What is the is a variable in objects?
Ans:Object class identification
What is the Obj-C runtime?
Ans:A c library
What is true regarding @protected?
What is true regarding @public?
Ans: It breaks encapsulation
What is true regarding C functions inside .m files?
Ans: They can contain Obj-c code, They can be static
What is true regarding strings?
Ans: Obj-c strings are not of static storage
What type of variable do you need to use to implement singletons?
Ans: Static
What's the difference between copy and deepCopy?
Ans: copy creates a copy at the first level, while deepcopy copies the instance variables
When using the garbage collector, which method, that is normally called without the collector, is not called on your objects where they are collected?
Ans: dealloc
Which C feature is not supported in Obj-C?
Ans: Support is compiler dependant
Which of the following can be inherited?
Ans: Protocols, Classes
Which of the following creates a class that conforms to a protocol?
@interface ClassName <ProticolName>
Which of the following declares a protocol?
Ans: @protocol ProtocolName
Which of the following does not happen when you throw an exception in a @synchronized block?
Ans: The object is deallocated
Which of the following is false?
Ans: When a method is called, the send is automatically availcbe as the sender variavle,like self of super.
Which of the following is incorrect?
Ans: [AClass release]
Which of the following is not recommended?
Ans: None of the above
Which of the following is the fastest?
Ans: Mutex implicit locking
No comments:
Post a Comment