100 TOP Real Time Objective C Multiple choice Questions and Answers pdf download

Read the most frequently asked 100 top Objective C multiple choice questions and answers PDF for freshers and experienced

Objective C Objective type Questions and Answers List

 

Objective C MCQs
Objective C Multiple choice Questions

What is a pointer?
A. A variable
B. A memory address that points to a specific object
C. An object that calls other objects
D. A class
Ans: B

If you do not declare a return type for a method definition, what is the default return type?
A. *NSString
B. id
C. No return type
Ans: B

What is the Allocations instrument used for?
A. Allows you to view your variable values
B. A debugging tool that frees up memory
C. Recording information from a single process about memory allocation
Ans: C

what does this code produce? [NSString] *myString = @”Hello World”;
A. An Error during compile
B. makes the pointer to myString equal to the pointer of the new created object with @”hello world”
C. gets SIGABRT while executing the application
D. it put the value Hello World into a string named myString
E. none of the above
Ans: A

How do you get the Unicode character set of a Core Text font?
A. CTFontCopyDisplayName
B. CTFontCopyCharacterSet
C. CTFontCopyFamilyName
Ans: B

True or False? A UIButton inherits from UIView.
A. True
B. False
Ans: A

Developers are allowed to call [super dealloc] in ARC.
A. TRUE
B. FALSE
Ans: B

What is the difference between methods that begin with + and -?
A. Instance methods begin with – class level methods begin with +
B. + methods are inheritable, – methods are not
C. + methods are public, – methods are private
Ans: A

How can you declare a method, that can be set as the action to be performed on various events?
A. (IBAction) action:(id) sender;
B. -(SEL) action:(id) event;
C. -(selector) action:(id) sender;
Ans: A

What is KVO?
A. Key Variable Obfuscation
B. Key Value Operations
C. Key Value Observing
Ans: C

What is a Category?
A. A category is a way to extend a class by adding functions to it
B. A category is adding methods to a class where pointers in the memory no longer exist for an instance of a class to execute it.
C. A category defines a set of functions which a class implements
D. One way to alter the destination of a message at runtime by switching the implementations.
Ans: A

True or False? You can compare two strings by (string1 == string2)
A. True
B. False
Ans: B

To have an IOS app Screen Design we used which of the following tool?
A. None of above
B. Interface Xcode
C. Interface builder
D. Interface Designer
E. Instruments
Ans: C

What does the “id” type mean?
A. This is the general type for any kind of object regardless of class
B. This is a type for a specific object of class id
C. This is a type for strings
Ans: A

What is the method for adding KVO to your app?
A. addKVO:forKey:
B. addListener:withContext:andObject:
C. addObserver:forKeyPath:options:context
Ans: C

How do you concatenate two NSStrings *foo and NSString *bar to form a new NSString *baz?
A. baz = foo + bar;
B. baz = [foo stringByAppendingString: bar];
C. baz = foo & bar;
D. baz = [foo appendString: bar];
E. baz = [foo concat: bar];
Ans: B

What framework does the class UIButton come from?
A. CoreGraphics
B. Foundation
C. EventKit
D. UIKit
E. OpenGLES
Ans: D

If you define a new class called Foo which inherits from NSObject, how do you create a new instance of it?
A. Foo *temp = new Foo();
B. Foo *temp = Make Instance of Foo;
C. Foo *temp = [[Foo alloc] init];
D. Foo *temp = System.Create(Foo);
E. Foo *temp = [Foo init];
Ans: C

What does an Objective-C string literal look like?
A. “foo”
B. #”foo”
C. @”foo”
D. $”foo”
E. NSString(“foo”)
Ans: C

ARC means?
A. Automatic Reference Counting
B. Angular Reference Courting
C. Access Reference Collation
D. Artificial Reference Counting
E. Application Reference Collection
Ans: A

Where is a MKAnnotationView used?
A. On a cell
B. In a button
C. On a Map View
D. On a table view
Ans: C

What is a delegate?
A. A delegate is a UIView
B. A delegate holds the type of data a variable stores
C. A delegate allows one NSObject to send messages to another NSObject, and listen to those messages
D. A delegate is a variable
Ans: C

Which of the following is a Singleton?
A. [NSArray array]
B. [NSFileManager defaultManager]
Ans: B

Which of the following is an object?
A. double
B. NSNumber
C. int
D. float
Ans: B

What is the name of the type of SQL Database that iOS Supports?
A. SQL
B. NoSql
C. SQLite
D. MySql
Ans: C

What type of object is this under XCode 4.5: @[rabbit, chicken, owl]
A. SQLite schema
B. NSArray
C. NSString
D. NSDictionary
Ans: B

What does a CAEmitterCell do?
A. Nothing, it is not a valid class
B. It defines the properties and direction of emitted particles from a CAEmitterLayer object.
C. It intercepts touch events
D. It is used by the GPS to track user coordinates and returns to values as coordinates
Ans: B

What happens when you call retain on an object?
A. It is permanently stored in memory
B. It will stay in memory until the app closes
C. You increase its retain count by 1
D. It is released from memory
Ans: C

How do you free an object?
A. [obj release]
B. None of the above
C. free(obj)
D. [obj dealloc]
E. [obj free]
Ans: A

How does KVO respond to change notifications?
A. respondToValueChange:forKey:
B. listenToChange:forObject:andContext:
C. observeValueForKeyPath:ofObject:change:context
Ans: C

What is a dependency in NSOperationQueue?
A. A dependency is a way to have an operation wait to be performed until the dependencies have been fulfilled/executed
B. A dependency sets the variables of the NSOperationQueue
C. A dependency is the alloc/init method of the NSOperationQueue
Ans: A

True or False? Sending a command asynchronously will lock the main thread and then wait until the command is finished before moving on to the next part of your code.
A. False
B. True
Ans: A

Which of the following accesses a variable in structure b?
A. b.var;
B. b-var;
C. b>var;
D. b->var;
E. b
Ans: A

If a class conforms to a protocol what must it do?
A. Implement all methods in the protocol, except for optional ones
B. Implement all methods in the protocol without exception
C. Implement all or some methods and leave the rest to be implemented by subclasses
D. Implement all methods which do not have a default implementation in the protocol
Ans: A

True or False? For an object to use constraints, it must have at least 3 constraint values.
A. False
B. True
Ans: A

What is used to sort Core Data results?
A. NSSort
B. NSCoreDataSort
C. [self sort]
D. NSSortDescriptor
Ans: D

True or False? A method and a variable can have the same name in Objective-C.
A. False
B. True
Ans: B

What is a design pattern?
A. A methodology for approching database design.
B. Coding standards used by an organization.
C. A template for a solution to a common problem faced by programmers.
Ans: C

How can you add a new method foo to an existing class Bar?
A. Both “extend” options are correct.
B. It’s not possible.
C. Send Bar the “extend:” message, e.g. [Bar extend: foo].
D. Define a C function foo and then send Bar the extend:withSelector: message, e.g. [Bar extend: foo withSelector: @selector(foo:)].
E. Make a category, e.g. @interface Bar(Foo).
Ans: E

Can you call C++ code from objective C environment?
A. Yes, from any .mm file
B. Yes, from any .m file
C. No, it is not possible
Ans: A

What framework is KVO (key value observing) a part of?
A. Foundation
B. UIKit
C. CoreData
Ans: A

Assume ARC is enabled… What would be another way to write this: NSArray *array = [NSArray arrayWithObjects:@”One”, @”Two”, @”Three”,nil];
A. NSArray *array = [@”One”, @”Two”,@”Three”];
B. NSArray *array = @[@”One”, @”Two”, @”Three”];
C. NSArray *array = {@”One”, @”Two”,@”Three”};
D. NSArray *array = @{@”One”, @”Two”, @”Three”};
Ans: B

let a:int=5 a=10 this code is true of false?
A. false
B. true
Ans: A

Does Objective-C have constructors and destructors?
A. Yes
B. It depends on the object
C. No, you use init and dealloc on Objective-C
D. Only NSStrings do
Ans: C

What is the type of @selector(foo)?
A. id
B. selector
C. None, that is not a valid Objective-C expression.
D. SEL
Ans: D

What class supports the sharing of small amounts of data such as strings or dates to iCloud?
A. NSUrlConnection
B. NSOperation
C. NSUbiquitousKeyValueStore
Ans: C

Are integers full-fledged objects in Objective-C?
A. Yes, but only if you first cast them as id’s, e.g. (id) 123.
B. No, they are not objects at all.
C. Integers are only partial objects in Objective-C (e.g. do not support any user defined methods).
D. Yes.
Ans: B

Using UIViewController containment, which one of the following statements is true:
A. The root viewcontroller handles loading and unloading its child viewcontrollers.
B. Every viewcontroller can handle the loading and unloading of other viewcontroller.
Ans: A

What is the difference between [Foo new] and [[Foo alloc] init]?
A. New will not always initialize the object.
B. New is significantly faster than alloc + init.
C. None, they perform the same actions.
D. New does not exist in Objective-C.
Ans: C

What is one source of particles that are emitted by a CAEmitterLayer object?
A. A UIEmitterView
B. A NSEmitter
C. A CAEmitterCell
Ans: C

What is the ‘print object’ command in the debugger window?
A. print
B. p
C. -l
D. po
Ans: D

What happens at runtime with the following: NSObject* object = nil; NSObject* object2 = [object copy]; NSLog(@”%@”, object2);
A. Application crashes with “SIGABRT: object has been derferenced” error
B. Application continues, but issues “cannot access nil object reference” warning
C. object2 is instantiated as an NSObject with nil values
D. Log prints “(null)” and continues as usual.
Ans: D

What is @dynamic directive meaning in iOS?
A. The @dynamic directive generates the accessor methods for you at compile time.
B. The @dynamic directive tells the compiler that you will provide accessor methods dynamically at runtime.
C. The @dynamic directive generates getter method for your property at compile time.
D. The @dynamic directive generates setter method for your property at compile time.
Ans: B

What class will allow you to use one or more blocks concurrently?
A. NSBlockOperation
B. NSConcurrentBlock
C. NSConcurrency
D. NSBlock
Ans: A

In Core Data, what is the name of an object representation of a record?
A. NSManagedObjectModel
B. NSManageObjectContext
C. NSManagedObject
D. NSEntityDescription
Ans: C

What is Objective-C’s language design based on?
A. C and C++.
B. C and Cocoa.
C. C and Smalltalk.
D. C and BCPL.
E. C and Objectivity.
Ans: C

True or False? You should use NSHost when connecting to a specific host.
A. True
B. False (You should use CFHost)
Ans: B

What is the difference between #import and #include ?
A. #import ensures that a file is only ever included once, and #include allows the same file to be inlcuded many times.
B. None, they do the same thing.
C. #include is not valid syntax
D. #include ensures that a file is only ever included once and #import permits the file to be included many times.
Ans: A

True or False? Strings are one of the most common sources of buffer overflow attacks.
A. True
B. False
Ans: A

True or False? You can use %@ to specify a dynamic property.
A. True
B. False
Ans: B

What is a proper format for calling an asynchronous function?
A. [dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), // code ];
B. [NSOperationDispatchAsync dispatch_asyncWithBlock: ^{ // code }];
C. [dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{ // code })];
D. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{ // code });
Ans: D

True or False? You can perform operator overloading in Objective-C.
A. False
B. True
Ans: A

What are the two types of predicates?
A. Expression and Operator
B. Comparison and Compound
C. Filter and Exclusion
Ans: B

What is a persistent object store?
A. It represents an external file of persisted data
B. It is the relationships between tables in your data
C. It is the schema for your object
D. It is retained database objects
Ans: A

The proper typedef syntax for an Objective-C block that takes an NSArray and returns an NSString is
A. typedef aBlock^ = (NSString *)(NSArray *);
B. typedef NSArray *(^aBlock)(NSString *);
C. typedef void(^aBlock)(void);
D. typedef NSString *(^aBlock)(NSArray *);
Ans: D

How do you convert a Core Image color to a UIColor?
A. UIColorWithCIColor:
B. UIColorValue:
C. CIColorValue:
D. colorWithCIColor:
Ans: D

How can you temporarily disable layer actions in a Core Animation?
A. Using the CATransaction class
B. Using the CAStopAnimation class
C. Using the CAExit class
D. Using the CAStop class
Ans: A

What can happen if you use self inside a block?
A. None of the above
B. self can become a dangling pointer
C. You can create a retain cycle
D. By the time the block executes, self can be pointing to a different object
Ans: C

True or False? The format for a NSPredicate is the same as a Regular Expression.
A. False
B. True
Ans: A

Objective-C methods with certain names (“init”, “alloc”, etc.) always return objects that are an instance of the receiving class’s type; such methods are said to have a “related result type”. A method with a related result type can be declared by using:
A. returntype
B. id
C. resultType
D. instancetype
E. NSRelatedType
Ans: D

In Core Data, what is the name of the object representation for the database schema?
A. NSManageObjectContext
B. NSManagedObjectModel
C. NSEntityDescription
D. NSManagedObject
Ans: B

Which framework lets you determine the current location or heading associated with a device?
A. CFLocation
B. MapKit
C. LocationKit
D. CoreLocation
E. NSLocation
Ans: D

What is (void*)0 ?
A. Representation of void pointer
B. None of above
C. Representation of NULL pointer
D. Error
Ans: C

What protocol is used to create an action object?
A. CoreAnimation
B. CAAction
C. NSAction
D. None of These
Ans: B

Which of these classes is NOT a root class?
A. NSString
B. NSMessageBuilder
C. NSObject
D. NSProxy
E. NSZombie
Ans: A

True or False? Key value coding is used to indirectly access an object’s attributes using indexes.
A. True
B. False
Ans: B

What is the object.toString equivalent in objective-c?
A. [NSObject toString]
B. [NSObject description]
C. [NSObject stringWithFormat]
D. [NSObject getDescription]
E. [NSObject getDetails]
Ans: B

What does the following code do, assume ARC is enabled? NSArray *myArray; for (int i = 0; i < 10; i++){ @autoreleasepool { myArray = [[NSArray alloc]init]; } }
A. For each iteration of the loop a new array is allocated and released.
B. For each iteration of the loop a new array is allocated and will be released at the end of the loop.
C. For each iteration of the loop a new array is allocated only.
D. For each iteration of the loop a new array is allocated and will leak memory.
Ans: A
What happens if you use fgets and do not give it a size smaller than the buffer?
A. It will use the size of the object as its size
B. It will overwrite the data past the size
C. It will clip its size automatically
D. None of these
Ans: B
how can we return multiple values from function?
A. not possible
B. void*
C. tuple
Ans: C
If you wanted to override the default alloc method in a class Foo, what would be the appropriate way to declare it?
A. (Foo *) alloc;
B. + (Foo *) alloc;
C. + (id) alloc;
D. It’s not possible to override alloc.
E. (id) alloc;
Ans: C
What is not supported in Objective-C
A. Recursive method call
B. Method argument default value
C. Variable argument count to method
D. Byte manipulation
Ans: B
What class method is used to make an NSArray from NSData class?
A. NSArray arrayWithObject:
B. NSFileManager defaultManager
C. NSData dataWithContentsOfFile:
D. NSKeyedUnarchiver unarchiveObjectWithData:
Ans: D
What do you use for an outgoing TCP connection?
A. NSStream
B. NSTCPProtocol
C. (none of these)
D. NSUrlStream
Ans: A
Which method, if defined, is guaranteed to be called once — and only once — when a class is first referenced?
A. + (id) alloc;
B. + (void) init;
C. + (id) init;
D. + (Class) alloc;
E. + (void) initialize;
Ans: E
Which of these property declaration attributes does not specify setter semantics?
A. strong
B. assign
C. nonatomic
D. weak
E. copy
Ans: C
What can you say about the code: NSString * str = [NSString stringWithFormat:@””]; [str release];
A. it will cause a SIGABRT when the enclosing method ends
B. It will cause the string to be released twice with undefined consequences when the surrounding autorelease pool is emptied
C. It will cause a SIGSEGV at [str release];
D. None of these
E. It is correct, everything will work fine
Ans: B
How do you add a brightening effect on a CoreImage?
A. Set the alpha
B. CIBrighten
C. CIAdditionCompositing
Ans: C
Which of these methods is NOT invoked by the runtime itself?
A. -forwardInvocation:
B. +load
C. +initialize
D. -dealloc
E. -doesNotRecognizeSelector:
Ans: D
What is the last chance for an object to handle a message?
A. -forwardInvocation:
B. -forwardingTargetForSelector:
C. -respondsToSelector:
D. +resolveInstanceMethod:
E. +instancesRespondToSelector:
Ans: A

A UITableViewController’s tableview must have its delegate explicitly set by the developer.
A. TRUE
B. FALSE
Ans: B

What’s the difference between nil and NULL?
A. nil is literal null value for Objective-C instances. NULL is object used to represent null
B. nil is literal null value for Objective-C instances. NULL is literal null value for Objective-C classes
C. nil is literal null value for Objective-C instances. NULL is literal null value for C pointers
D. NULL is literal null value for Objective-C instances. nil is literal null value for C pointers
E. they are the same thing
Ans: C
How is a selector typically represented in memory?
A. As a pointer to a C struct.
B. As a unique 32-bit number.
C. As a null terminated C string.
D. As an Objective-C object.
Ans: C
A UIView is a superclass of:
A. UIViewController
B. UIWindow
C. UIImage
D. UILabel
E. UIScreen
Ans: D
What are @try and @catch?
A. Exception keywords
B. All of these
C. Exception handlers
D. Exceptions
Ans: A
How to restore Consumable In-App Purchases?
A. Use Store Kit’s finishTransaction: method
B. Consumable In-App Purchases are not to be restored
C. Use Store Kit’s addPayment: method
D. Use Store Kit’s initWithProductIdentifiers: method
E. Use Store Kit’s restoreCompletedTransactions method
Ans: B
What happens at runtime with the following: NSMutableString *tempString = [NSMutableString stringWithString:@”1″]; dispatch_sync(dispatch_get_main_queue(), ^{ [tempString appendString:@”2″]; NSLog(@”%@”, tempString); }); [tempString appendString:@”3″];
A. Log prints “132” and continues as usual.
B. Log prints “12” and then we will have a deadlock here because the main queue will block
C. Log prints “123” and continues as usual.
D. Log doesn’t print anything. It’s a deadlock here because the main queue will block on the call to dispatch_sync
Ans: D
What ?an you use to avoid msgSend function overhead?
A. None of these
B. IMP
C. SEL
D. You can’t use anything
Ans: B
Which of the following statements is correct?
A. @property(readwrite,retain,atomic)NSInteger value;
B. @property(readwrite,copy,atomic)NSInteger value;
C. @property(readwrite,retain,atomic,copy)NSInteger value;
D. @property(readwrite,assign,copy,atomic)NSInteger value;
E. none of the above
Ans: A
What happens at runtime with the following:
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_apply(10, queue, ^(size_t index) { NSLog(@”%zu”, index); });
A. Log prints “0123456789”
B. We won’t have persistent result
C. Log prints “12345678910”
D. Log prints “9876543210”
Ans: B

5 thoughts on “100 TOP Real Time Objective C Multiple choice Questions and Answers pdf download

  1. I know this web site presents quality depending articles and extra material, is there any other website which presents such things in quality…..

Leave a Reply

Your email address will not be published. Required fields are marked *