C Programming
This test contains the basic and advanced question related to Objective C. This test is useful for CS/GATE and other students.
Questions
Which of the following is not a restriction in Posing in Objective-C?
- A posing class can call overridden methods through super keyword.
- The posing class must not define any new instance variables other than target class.
- A posing class can not override methods defined in the categories.
- The target class is unaware of any information about posing class.
- A class may only pose as one of its direct or indirect super classes.
Which of the following information is not included in NSError object?
- Domain
- Code
- User info
- Application specific information
- Implemented code
Which of the following is an incorrect statement about NSSet in Objective C?
- It has distinct objects.
- It is immutable.
- It is used to store and retrieve primitive values.
- The elements can be altered in NSSet.
- An NSSet can be created through the set with objects: class method.
Which of the following is an incorrect statement about the NSNumber class in Objective C?
- It is a lightweight class.
- It is used to store and retrieve primitive values.
- %@ format specifier is used for this class.
- NSNumber objects are immutable.
- The NSNumber object can be made mutable.
Which of the following is an incorrect statement about data encapsulation in Objective-C?
- It contains program statements.
- It contains program data.
- It binds data and functions.
- Dynamic binding is also possible in data encapsulation.
- This property has all private variables in the code.
Which of the following is a false statement about 'properties' in Objective C?
- These are used to declare the data of a class.
- The most commonly used parameters are copy/retain/assign in the Property.
- The assign keyword generates a setter, which do not have retained objects.
- The assign can be interchanged with another object's property.
- The read-only keyword is used to generate the setters.
Which of the following is a false statement about the synthesised property?
- It is used to implement the code for the accessors.
- Synthesised accessors are atomic.
- Synthesised accessors can not be nonatomic.
- The getters must have a value as per the setters.
- There is no cost for the synthesised property if garbage collection is enabled.
Which of the following is an incorrect statement about garbage collection (GC) in Objective C?
- Garbage collection reduces the effect of memory management methods.
- The dealloc method can not be called during GC.
- The methods like copy and mutable copy messages, copy the value of the object in case GC is enabled.
- The final method can not be implemented if GC is enabled.
- Garbage collection is off by default.
Which of the following is an incorrect statement about using the protocols in Objective C?
- These are used to declare methods for others to implement.
- These are used to declare the interfaces to a particular class.
- Protocols establish the common attributes among the classes in different hierarchy.
- Protocols manage the execution state of the application.
- Protocols play an important role in OS X and iOS development.
Which of the following Class Clusters are in Objective C?
- These are used to maintain a common abstract superclass for all the subclasses.
- These provide the specific values based on the inputs for all the subclasses.
- The abstract class for the Cluster can not be defined with the composite object.
- Bool is a Cluster class of NSNumber.
- It uses the functionality like abstract factory.
Which of the following is an incorrect statement about reference counting in Objective C memory management?
- Each object must have a value.
- Initially the count is set to 1.
- The objects can be accessed at zero count.
- When the count hits zero, the object is immediately freed from memory.
- The actions will increment or decrement this count.
Which of the following is a correct statement about 'autorelease' in Objective C?
- It acts as a medium between the memory system and the garbage collection.
- All the released objects are included in the autorelease pool.
- All of the objects must be passed in a method pool.
- Some objects can be forced to autorelease.
- Every program must create its own object.
Which of the following is an incorrect statement about Automatic Reference Counting (ARC) in Objective C?
- The release and retain of the methods are done automatically.
- The release and retain of the methods are done automatically as well as manually.
- There is low memory leak.
- Reference counting works in this approach.
- It uses the same reference counting system as (Manual Retain-Release) MRR.
Which of the following is not a characteristic of the Objective C category?
- A category can be declared for any class in the source code.
- It cannot be declared for any class, only for the classes that have original implementation of source code.
- All the methods in a category should be applicable to all the instances of the class.
- All the methods in a category should be applicable to all subclasses of the original class.
- At runtime, there's no difference between a method added by a category with its implementation.
Which of the following is not a characteristic of Extensions in Objective-C?
- An Extension can be declared for any class in the source code.
- It cannot be declared for any class in the source code.
- Extensions are also known as anonymous categories.
- The methods and variables declared inside the extensions are not accessible to the child classes.
- @interface keyword is used to declare the extension.