Alien head

C Programming

Description: This test contains the basic and advanced question related to Objective C. This test is useful for CS/GATE and other students.
Number of Questions: 15
Created by:
Tags: objective c programmng cs gate Programming
Attempted 0/15 Correct 0 Score 0

Which of the following is not a restriction in Posing in Objective-C?

  1. A posing class can call overridden methods through super keyword.

  2. The posing class must not define any new instance variables other than target class.

  3. A posing class can not override methods defined in the categories.

  4. The target class is unaware of any information about posing class.

  5. A class may only pose as one of its direct or indirect super classes.


Correct Option: C
Explanation:

A posing class can override methods defined in categories.

Which of the following information is not included in NSError object?

  1. Domain

  2. Code

  3. User info

  4. Application specific information

  5. Implemented code


Correct Option: E
Explanation:

NSError object does not have implemented code.

Which of the following is an incorrect statement about NSSet in Objective C?

  1. It has distinct objects.

  2. It is immutable.

  3. It is used to store and retrieve primitive values.

  4. The elements can be altered in NSSet.

  5. An NSSet can be created through the set with objects: class method.


Correct Option: C
Explanation:

It is not used with primitive values as it is not a wrapper class.

Which of the following is an incorrect statement about the NSNumber class in Objective C?

  1. It is a lightweight class.

  2. It is used to store and retrieve primitive values.

  3. %@ format specifier is used for this class.

  4. NSNumber objects are immutable.

  5. The NSNumber object can be made mutable.


Correct Option: E
Explanation:

These objects can not be made mutable.

Which of the following is an incorrect statement about data encapsulation in Objective-C?

  1. It contains program statements.

  2. It contains program data.

  3. It binds data and functions.

  4. Dynamic binding is also possible in data encapsulation.

  5. This property has all private variables in the code.


Correct Option: D
Explanation:

There is no dynamic binding possible in data encapsulation as there is no method calling at runtime.

Which of the following is a false statement about 'properties' in Objective C?

  1. These are used to declare the data of a class.

  2. The most commonly used parameters are copy/retain/assign in the Property.

  3. The assign keyword generates a setter, which do not have retained objects.

  4. The assign can be interchanged with another object's property.

  5. The read-only keyword is used to generate the setters.


Correct Option: E
Explanation:

The read-only keyword means a setter will not be generated.

Which of the following is a false statement about the synthesised property?

  1. It is used to implement the code for the accessors.

  2. Synthesised accessors are atomic.

  3. Synthesised accessors can not be nonatomic.

  4. The getters must have a value as per the setters.

  5. There is no cost for the synthesised property if garbage collection is enabled.


Correct Option: C
Explanation:

One can disable the synthesised property with the keyword nonatomic.

Which of the following is an incorrect statement about garbage collection (GC) in Objective C?

  1. Garbage collection reduces the effect of memory management methods.

  2. The dealloc method can not be called during GC.

  3. The methods like copy and mutable copy messages, copy the value of the object in case GC is enabled.

  4. The final method can not be implemented if GC is enabled.

  5. Garbage collection is off by default.


Correct Option: D
Explanation:

One can implement the final method for some (though not all) of the same cases.

Which of the following is an incorrect statement about using the protocols in Objective C?

  1. These are used to declare methods for others to implement.

  2. These are used to declare the interfaces to a particular class.

  3. Protocols establish the common attributes among the classes in different hierarchy.

  4. Protocols manage the execution state of the application.

  5. Protocols play an important role in OS X and iOS development.


Correct Option: D
Explanation:

Protocols do not manage the execution state for the application and these are used to declare the application's functionality.

Which of the following Class Clusters are in Objective C?

  1. These are used to maintain a common abstract superclass for all the subclasses.

  2. These provide the specific values based on the inputs for all the subclasses.

  3. The abstract class for the Cluster can not be defined with the composite object.

  4. Bool is a Cluster class of NSNumber.

  5. It uses the functionality like abstract factory.


Correct Option: C
Explanation:

The composite object must declare itself to be a subclass of the cluster's abstract superclass.

Which of the following is an incorrect statement about reference counting in Objective C memory management?

  1. Each object must have a value.

  2. Initially the count is set to 1.

  3. The objects can be accessed at zero count.

  4. When the count hits zero, the object is immediately freed from memory.

  5. The actions will increment or decrement this count.


Correct Option: C
Explanation:

The objects can not be accessed at  zero count.

Which of the following is a correct statement about 'autorelease' in Objective C?

  1. It acts as a medium between the memory system and the garbage collection.

  2. All the released objects are included in the autorelease pool.

  3. All of the objects must be passed in a method pool.

  4. Some objects can be forced to autorelease.

  5. Every program must create its own object.


Correct Option: D
Explanation:

The objects cannot be forced to autorelease.

Which of the following is an incorrect statement about Automatic Reference Counting (ARC) in Objective C?

  1. The release and retain of the methods are done automatically.

  2. The release and retain of the methods are done automatically as well as manually.

  3. There is low memory leak.

  4. Reference counting works in this approach.

  5. It uses the same reference counting system as (Manual Retain-Release) MRR.


Correct Option: B
Explanation:

This is false as the manually release and retain of the methods is not possible.

Which of the following is not a characteristic of the Objective C category?

  1. A category can be declared for any class in the source code.

  2. It cannot be declared for any class, only for the classes that have original implementation of source code.

  3. All the methods in a category should be applicable to all the instances of the class.

  4. All the methods in a category should be applicable to all subclasses of the original class.

  5. At runtime, there's no difference between a method added by a category with its implementation.


Correct Option: B
Explanation:

A category can be declared for any class even without implemented code.

Which of the following is not a characteristic of Extensions in Objective-C?

  1. An Extension can be declared for any class in the source code.

  2. It cannot be declared for any class in the source code.

  3. Extensions are also known as anonymous categories.

  4. The methods and variables declared inside the extensions are not accessible to the child classes.

  5. @interface keyword is used to declare the extension.


Correct Option: A
Explanation:

An extension cannot be declared for any class, only for the classes that have original implementation of source code.

+ View questions