Do you know that? Find a project management application you like and stick to it. next

Contact Email:

<< All Upwork (oDesk) and Elance Tests << Elance test answers << IT & Programming category

Test answers for Objective C 2020

(83) Last updated: January 27
Elance • IT & Programming
Questions and answers are regularly updated. Answered and not answered tests questions.

This helps getting job: Hundreds of (cover letter examples , interview questions , profile samples ) • Earn on Upwork (oDesk)
Job assistance: jobs popularityfreelance rates

Popular test answers: HTML, .Net, CSS, English, SEO, Photoshop, iOS, Java, Android, Ruby, Python, JavaScript

See all 6 tests answers updated

Find Upwork (oDesk) and Elance test answers on this website:

Collapse | Expand

83 Answered Test Questions:

1. What is a pointer?


• An object that calls other objects

• A memory address that points to a specific object

• A variable

• A class

2. What is the difference between #import and #include ?


• #import ensures that a file is only ever included once, and #include allows the same file to be inlcuded many times.

• #include is not valid syntax

• None, they do the same thing.

• #include ensures that a file is only ever included once and #import permits the file to be included many times.

3. How do you get the Unicode character set of a Core Text font?


• CTFontCopyDisplayName

• CTFontCopyFamilyName

• CTFontCopyCharacterSet

4. What is the method for adding KVO to your app?


• addObserver:forKeyPath:options:context

• addKVO:forKey:

• addListener:withContext:andObject:

5. 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;

6. What is a design pattern?


• A template for a solution to a common problem faced by programmers.

• A methodology for approching database design.

• Coding standards used by an organization.

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


• True

• False

8. Does Objective-C have constructors and destructors?


• It depends on the object

• Only NSStrings do

• No, you use init and dealloc on Objective-C

• Yes

9. What framework is KVO (key value observing) a part of?


• CoreData

• Foundation

• UIKit

10. If you do not declare a return type for a method definition, what is the default return type?


• id

• No return type

• *NSString

11. What class supports the sharing of small amounts of data such as strings or dates to iCloud?


• NSUbiquitousKeyValueStore

• NSUrlConnection

• NSOperation

12. Assume ARC is enabled... What would be another way to write this: NSArray *array  = [NSArray arrayWithObjects:@"One", @"Two", @"Three",nil];


• NSArray *array = {@"One", @"Two",@"Three"};

• NSArray *array = @[@"One", @"Two", @"Three"];

• NSArray *array = [@"One", @"Two",@"Three"];

• NSArray *array = @{@"One", @"Two", @"Three"};

13. What is the type of @selector(foo)?



• selector

• id

• None, that is not a valid Objective-C expression.

14. Using UIViewController containment, which one of the following statements is true:


• Every viewcontroller can handle the loading and unloading of other viewcontroller.

• The root viewcontroller handles loading and unloading its child viewcontrollers.

15. what does this code produce?   [NSString] *myString = @"Hello World";


• An Error during compile

• it put the value Hello World into a string named myString

• gets SIGABRT while executing the application

• none of the above

• makes the pointer to myString equal to the pointer of the new created object with @"hello world"

16. Can you call C++ code from objective C environment?


• Yes, from any .m file

• No, it is not possible

• Yes, from any .mm file

17. What is a dependency in NSOperationQueue?


• A dependency sets the variables of the NSOperationQueue

• A dependency is a way to have an operation wait to be performed until the dependencies have been fulfilled/executed

• A dependency is the alloc/init method of the NSOperationQueue

18. 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 in the protocol without exception

• Implement all methods in the protocol, except for optional ones

• Implement all methods which do not have a default implementation in the protocol

19. Which of the following accesses a variable in structure b?


• b->var;

• b>var;

• b-var;

• b.var;

• b

20. How can you add a new method foo to an existing class Bar?


• Define a C function foo and then send Bar the extend:withSelector: message, e.g. [Bar extend: foo withSelector: @selector(foo:)].

• Make a category, e.g. @interface Bar(Foo).

• Send Bar the "extend:" message, e.g. [Bar extend: foo].

• It's not possible.

• Both "extend" options are correct.

21. 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.


• True

• False

22. What is KVO?


• Key Variable Obfuscation

• Key Value Operations

• Key Value Observing

23. What is  a Category?


• 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.

• A category is a way to extend a class by adding functions to it

• One way to alter the destination of a message at runtime by switching the implementations.

• A category defines a set of functions which a class implements

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


• True

• False

25. How does KVO respond to change notifications?


• respondToValueChange:forKey:

• observeValueForKeyPath:ofObject:change:context

• listenToChange:forObject:andContext:

26. What is the Allocations instrument used for?


• Recording information from a single process about memory allocation

• Allows you to view your variable values

• A debugging tool that frees up memory

27. What is used to sort Core Data results?


• NSCoreDataSort

• NSSort

• NSSortDescriptor

• [self sort]

28. True or False? You can compare two strings by (string1 == string2)


• True

• False

29. What is the difference between methods that begin with + and -?


• + methods are inheritable, - methods are not

• + methods are public, - methods are private

• Instance methods begin with - class level methods begin with +

30. What does a CAEmitterCell do?


• Nothing, it is not a valid class

• It intercepts touch events

• It defines the properties and direction of emitted particles from a CAEmitterLayer object.

• It is used by the GPS to track user coordinates and returns to values as coordinates

31. What happens when you call retain on an object?


• You increase its retain count by 1

• It is permanently stored in memory

• It is released from memory

• It will stay in memory until the app closes

32. What type of object is this under XCode 4.5: @[rabbit, chicken, owl]


• NSString

• NSDictionary

• NSArray

• SQLite schema

33. How do you free an object?


• [obj release]

• None of the above

• free(obj)

• [obj free]

• [obj dealloc]

34. True or False? A UIButton inherits from UIView.


• False

• True

35. What does the "id" type mean?


• This is a type for strings

• This is the general type for any kind of object regardless of class

• This is a type for a specific object of class id

36. Which of the following is a Singleton?


• [NSFileManager defaultManager]

• [NSArray array]

37. How do you concatenate two NSStrings *foo and NSString *bar to form a new NSString *baz?


• baz = foo & bar;

• baz = [foo appendString: bar];

• baz = [foo stringByAppendingString: bar];

• baz = [foo concat: bar];

• baz = foo + bar;

38. What framework does the class UIButton come from?


• UIKit

• CoreGraphics

• EventKit

• OpenGLES

• Foundation

39. Are integers full-fledged objects in Objective-C?


• Integers are only partial objects in Objective-C (e.g. do not support any user defined methods).

• Yes, but only if you first cast them as id's, e.g. (id) 123.

• No, they are not objects at all.

• Yes.

40. What does an Objective-C string literal look like?


• @"foo"

• #"foo"

• $"foo"

• "foo"

• NSString("foo")

41. If you define a new class called Foo which inherits from NSObject, how do you create a new instance of it?


• Foo *temp = Make Instance of Foo;

• Foo *temp = new Foo();

• Foo *temp = System.Create(Foo);

• Foo *temp = [Foo init];

• Foo *temp = [[Foo alloc] init];

42. ARC means?


• Artificial Reference Counting

• Application Reference Collection

• Angular Reference Courting

• Access Reference Collation

• Automatic Reference Counting

43. Where is a MKAnnotationView used?


• On a cell

• In a button

• On a table view

• On a Map View

44. What is a delegate?


• Time's Up!

• A delegate is a UIView

• A delegate is a variable

• A delegate allows one NSObject to send messages to another NSObject, and listen to those messages

• A delegate holds the type of data a variable stores

45. What is the name of the type of SQL Database that iOS Supports?


• MySql


• SQLite

• NoSql

46. What is one source of particles that are emitted by a CAEmitterLayer object?


• A CAEmitterCell

• A UIEmitterView

• A NSEmitter

47. In Core Data, what is the name of an object representation of a record?


• NSManageObjectContext

• NSEntityDescription

• NSManagedObjectModel

• NSManagedObject

48. True or False? You should use NSHost when connecting to a specific host.


• False (You should use CFHost)

• True

49. What happens at runtime with the following:  NSObject* object = nil; NSObject* object2 = [object copy]; NSLog(@"%@", object2);


• object2 is instantiated as an NSObject with nil values

• Application crashes with "SIGABRT: object has been derferenced" error

• Application continues, but issues "cannot access nil object reference" warning

• Log prints "(null)" and continues as usual.

50. True or False? You can perform operator overloading in Objective-C.


• True

• False

51. True or False? Strings are one of the most common sources of buffer overflow attacks.


• True

• False

52. What class will allow you to use one or more blocks concurrently?


• NSBlock

• NSConcurrency

• NSBlockOperation

• NSConcurrentBlock

53. What is the 'print object' command in the debugger window?


• po

• -l

• p

• print

54. The proper typedef syntax for an Objective-C block that takes an NSArray and returns an NSString is


• typedef NSString *(^aBlock)(NSArray *);

• typedef void(^aBlock)(void);

• typedef NSArray *(^aBlock)(NSString *);

• typedef aBlock^ = (NSString *)(NSArray *);

55. What is a persistent object store?


• It is the schema for your object

• It is the relationships between tables in your data

• It represents an external file of persisted data

• It is retained database objects

56. What is the difference between [Foo new] and [[Foo alloc] init]?


• New will not always initialize the object.

• New does not exist in Objective-C.

• None, they perform the same actions.

• New is significantly faster than alloc + init.

57. What is a proper format for calling an asynchronous function?


• [NSOperationDispatchAsync dispatch_asyncWithBlock: ^{ // code }];

• dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{ // code });

• [dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), // code ];

• [dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{ // code })];

58. What are the two types of predicates?


• Expression and Operator

• Filter and Exclusion

• Comparison and Compound

59. What is Objective-C's language design based on?


• C and BCPL.

• C and C++.

• C and Objectivity.

• C and Smalltalk.

• C and Cocoa.

60. True or False? You can use %@ to specify a dynamic property.


• True

• False

61. How do you convert a Core Image color to a UIColor?


• UIColorValue:

• UIColorWithCIColor:

• colorWithCIColor:

• CIColorValue:

62. In Core Data, what is the name of the object representation for the database schema?


• NSManageObjectContext

• NSManagedObjectModel

• NSEntityDescription

• NSManagedObject

63. What can happen if you use self inside a block?


• You can create a retain cycle

• None of the above

• self can become a dangling pointer

• By the time the block executes, self can be pointing to a different object

64. 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:


• instancetype

• returntype

• resultType

• NSRelatedType

• id

65. True or False? The format for a NSPredicate is the same as a Regular Expression.


• True

• False

66. What protocol is used to create an action object?


• None of These

• CoreAnimation

• NSAction

• CAAction

67. What is the object.toString equivalent in objective-c?


• [NSObject getDetails]

• [NSObject description]

• [NSObject toString]

• [NSObject stringWithFormat]

• [NSObject getDescription]

68. How can you temporarily disable layer actions in a Core Animation?


• Using the CATransaction class

• Using the CAExit class

• Using the CAStopAnimation class

• Using the CAStop class

69. What class method is used to make an NSArray from NSData class?


• NSFileManager defaultManager

• NSArray arrayWithObject:

• NSKeyedUnarchiver unarchiveObjectWithData:

• NSData dataWithContentsOfFile:

70. What is (void*)0 ?


• Error

• Representation of void pointer

• Representation of NULL pointer

• None of above

71. Which of these property declaration attributes does not specify setter semantics?


• copy

• strong

• weak

• nonatomic

• assign

72. Which of these classes is NOT a root class?


• NSString

• NSZombie

• NSProxy

• NSMessageBuilder

• NSObject

73. What does the following code do, assume ARC is enabled?      NSArray *myArray;     for (int i = 0; i < 10; i++){         @autoreleasepool {             myArray = [[NSArray alloc]init];         }     }


• For each iteration of the loop a new array is allocated and will leak memory.

• For each iteration of the loop a new array is allocated and released.

• For each iteration of the loop a new array is allocated and will be released at the end of the loop.

• For each iteration of the loop a new array is allocated only.

74. True or False? Key value coding is used to indirectly access an object's attributes using indexes.


• True

• False

75. If you wanted to override the default alloc method in a class Foo, what would be the appropriate way to declare it?


• - (Foo *) alloc;

• - (id) alloc;

• It's not possible to override alloc.

• + (Foo *) alloc;

• + (id) alloc;

76. What do you use for an outgoing TCP connection?


• NSStream

• NSTCPProtocol

• (none of these)

• NSUrlStream

77. What happens if you use fgets and do not give it a size smaller than the buffer?


• It will clip its size automatically

• It will use the size of the object as its size

• None of these

• It will overwrite the data past the size

78. What can you say about the code:  NSString * str = [NSString stringWithFormat:@""]; [str release];


• It will cause the string to be released twice with undefined consequences when the surrounding autorelease pool is emptied

• None of these

• it will cause a SIGABRT when the enclosing method ends

• It is correct, everything will work fine

• It will cause a SIGSEGV at [str release];

79. How do you add a brightening effect on a CoreImage?


• CIBrighten

• Set the alpha

• CIAdditionCompositing

80. Which method, if defined, is guaranteed to be called once -- and only once -- when a class is first referenced?


• + (id) init;

• + (Class) alloc;

• + (void) initialize;

• + (id) alloc;

• + (void) init;

81. Which of these methods is NOT invoked by the runtime itself?


• -dealloc

• -forwardInvocation:

• +load

• -doesNotRecognizeSelector:

• +initialize

82. What is the last chance for an object to handle a message?


• -respondsToSelector:

• +instancesRespondToSelector:

• +resolveInstanceMethod:

• -forwardInvocation:

• -forwardingTargetForSelector:

83. How is a selector typically represented in memory?


• As a null terminated C string.

• As a unique 32-bit number.

• As an Objective-C object.

• As a pointer to a C struct.