Thursday, July 30, 2015

Objective C Test Question

What is a pointer?
  • A memory address that points to a specific object
  • A variable
  • A class
  • An object that calls other objects
Answer: A memory address that points to a specific object
If you do not declare a return type for a method definition, what is the default return type?
  • id
  • No return type
  • *NSString
Answer: id
If a class conforms to a protocol what must it do?
  • Implement all or some methods and leave the rest to be implemented by subclasses
  • Implement all methods which do not have a default implementation in the protocol
  • Implement all methods in the protocol, except for optional ones
  • Implement all methods in the protocol without exception
Answer: Implement all methods in the protocol, except for optional ones
What is the difference between methods that begin with + and -?
  • Instance methods begin with - class level methods begin with +
  • + methods are public, - methods are private
  • + methods are inheritable, - methods are not
Answer: Instance methods begin with - class level methods begin with +


What does an Objective-C string literal look like?
  • $"foo"
  • #"foo"
  • @"foo"
  • "foo"
  • NSString("foo")
Answer: @"foo"
What is the name of the type of SQL Database that iOS Supports?
  • NoSql
  • MySql
  • SQLite
  • SQL
Answer: SQLite
ARC means?
  • Time's up!
  • Artificial Reference Counting
  • Access Reference Collation
  • Application Reference Collection
  • Automatic Reference Counting
  • Angular Reference Courting
Answer: Automatic Reference Counting
Where is a MKAnnotationView used?
  • In a button
  • On a cell
  • On a table view
  • On a Map View
Answer: On a Map View


Where is a MKAnnotationView used?
  • In a button
  • On a cell
  • On a table view
  • On a Map View
Answer: On a Map View
Which of the following is an object?
  • NSNumber
  • double
  • int
  • float
Answer: NSNumber
What is a delegate?
  • A delegate is a variable
  • A delegate holds the type of data a variable stores
  • A delegate is a UIView
  • A delegate allows one NSObject to send messages to another NSObject, and listen to those messages
Answer: A delegate allows one NSObject to send messages to another NSObject, and listen to those messages
If you define a new class called Foo which inherits from NSObject, how do you create a new instance of it?
  • Foo *temp = new Foo();
  • Foo *temp = [Foo init];
  • Foo *temp = System.Create(Foo);
  • Foo *temp = [[Foo alloc] init];
  • Foo *temp = Make Instance of Foo;
Answer: Foo *temp = [[Foo alloc] init];

What framework does the class UIButton come from?
  • Foundation
  • UIKit
  • CoreGraphics
  • EventKit
  • OpenGLES
Answer: UIKit
What does the "id" type mean?
  • This is a type for strings
  • This is a type for a specific object of class id
  • This is the general type for any kind of object regardless of class
Answer: This is the general type for any kind of object regardless of class
Which of the following is a Singleton?
  • [NSArray array]
  • [NSFileManager defaultManager]
Answer: [NSFileManager defaultManager]
How do you concatenate two NSStrings *foo and NSString *bar to form a new NSString *baz?
  • baz = [foo appendString: bar];
  • baz = foo & bar;
  • baz = foo + bar;
  • baz = [foo concat: bar];
  • baz = [foo stringByAppendingString: bar];
Answer: baz = [foo stringByAppendingString: bar];





To have an IOS app Screen Design we used which of the following tool?
  • Instruments
  • Interface Designer
  • None of above
  • Interface builder
  • Interface Xcode
Answer: Interface builder
How do you free an object?
  • free(obj)
  • [obj release]
  • [obj dealloc]
  • [obj free]
  • None of the above
Answer: [obj release]
True or False? A UIButton inherits from UIView.
  • True
  • False
Answer: True
How can you declare a method, that can be set as the action to be performed on various events?
  • -(SEL) action:(id) event;
  • - (IBAction) action:(id) sender;
  • -(selector) action:(id) sender;
Answer:- (IBAction) action:(id) sender;
True or False? You can compare two strings by (string1 == string2)
  • True
  • False
Answer: False
What type of object is this under XCode 4.5: @[rabbit, chicken, owl]
  • NSDictionary
  • NSString
  • NSArray
  • SQLite schema
Answer: NSArray     
Developers are allowed to call [super dealloc] in ARC.
  • FALSE
  • TRUE
Answer: FALSE







No comments:

Post a Comment