Upwork Test Answers: Get all the correct answers of most recent and possible Upwork Tests A to Z (Updated on Jan, 2016)
Cover Letter Templates: These cover letter samples are not only for Upwork job, but also you will have some idea about your real life job
Freelance Profile Overviews: Different Profile samples and overviews of experts, advanced and intermediate level freelancers
For Newbie of Upwork: Upwork Help - How to apply for a job in Upwork with 10 most important articles about Upwork

A to Z View - All Upwork Test Answers

Cocoa programming for Mac OS X 10.5 Test Answers (new)

This is a General Programming category test of Upwork. In this post you will find all most recent Upwork test questions with correct answers of Cocoa programming for Mac OS X 10.5 Test.

You can search your desired answers of the Upwork Cocoa programming for Mac OS X 10.5 Test by pressing Ctrl + F button.
1. What is true regarding notifications?
 Answers: • They can be dispatched to only one object or • The object posting the notification does not even have to know whether the observer exists

 2. Which of the following retrieves the application main bundle?
 Answers: • [NSBundle mainBundle]

 3. Can you use NSLock on a POSIX mutex?
 Answers: • Yes

 4. If you spawn a thread with POSIX thread api, will Cocoa be notified?
 Answers: • No

 5. What method should be called before you are able to draw in the drawRect: method of a view?
 Answers: • None

 6. Which of the following creates an autoreleased array?
 Answers: • [NSMutableArray new];

 7. What class should be used to load resources?
 Answers: • NSBundle

 8. Can an object marked for autorelease be retained?
 Answers: • Yes

 9. What is a notification?
 Answers: • A special message type used within the kernel

 10. Fill the blank.

 NSView : <> : NSObject
 Answers: • NSResponder

 11. If you call interpretKeyEvents:, which of the following method is likely to be called?
 Answers: • insertText:

 12. Where is the (0,0) coordinate located on the screen?
 Answers: • bottom-left

 13. What method should be called before you are able to draw outside the drawRect: method of a view?
 Answers: • lockFocus

 14. What will be the output of the following code?

 NSRect rect = NSMakeRect(0, 0, 10, 10);
 NSRect *rect2 = malloc(sizeof(*rect2));
 if(!rect2) {
 NSLog(@"Not enough memory.");

 *rect2 = rect;

 printf("%d\n", rect.size.width);
 Answers: • None of the above

 15. Can NSBundle be used to load Java code?
 Answers: • No

 16. Under Mac OS X 10.5, CGRect, CGSize and CGPoint have the same structure as NSRect, NSSize and NSPoint respectively. Is it true?
 Answers: • Yes

 17. What is an observer?
 Answers: • An object registered with the notification center

 18. Does Cocoa support 64bits?
 Answers: • Yes

 19. Why is CGFloat recommenced to be used instead of float?
 Answers: • For 64bit compatibility.

 20. Can resources be localized?
 Answers: • Yes

 21. Fill the blank.

 NSMutableArray : <> : NSObject
 Answers: • NSArray

 22. What is NSRect?
 Answers: • A structure

 23. Fill the blank.

 NSCountedSet : <> : NSObject
 Answers: • NSMutableSet : NSSet

 24. Can NSDistributedNotificationCenter be used to communicate between multiple machines?
 Answers: • No

 25. Is the following code correct?

 NSMutableArray *a = [NSMutableArray new];

 // do something with a

 [a release];
 Answers: • Yes

 26. What threading API should be used in Cocoa?
 Answers: • NSThread

 27. Is the following code correct?

 NSMutableArray *a = [NSMutableArray array];

 // do something with a

 [a release];
 Answers: • No

 28. How can you move a view?
 Answers: • By changing the frame with setFrame:

 29. Fill the blank.
 NSButton : <> : NSObject
 Answers: • NSControl : NSView : NSResponder

 30. How is a GUI usually created in Cocoa?
 Answers: • With interface builder

 31. Is it possible to create events and dispatch them to the application?
 Answers: • No

 32. Can POSIX thread be used in Cocoa?
 Answers: • Yes

 33. Is it correct to have sibling views overlapping?
 Answers: • No

 34. Is the following code valid?

 NSSize s = NSMakeSize(10, 10);

 int values[20];

 values[s.height] = 5;
 Answers: • Compile error

 35. In a typical Cocoa application, do you have to manage your runloop yourself?
 Answers: • No

 36. Is NSString mutable?
 Answers: • No

 37. Can you use malloc/free in a Cocoa application?
 Answers: • Yes, but only in a separate C library

 38. What is NSViewHeightSizable constant used for?
 Answers: • Autoresizing

 39. Can poll() be used to fetch Cocoa events?
 Answers: • Yes

 40. What is a toll-free bridged class?
 Answers: • A class that can be interchanged with another class by casting

 41. What is Cocoa?
 Answers: • A framework

 42. Is NSRunLoop thread safe?
 Answers: • No

 43. Which of the following platforms supports Cocoa?
 Answers: • Mac OSX

 44. In which language is Cocoa written?
 Answers: • Objective-C

 45. Where should application resources be usually put?
 Answers: • Within the application's bundle

 46. Is there a double click event?
 Answers: • Yes

 47. Can an object be the delegate of multiple objects?
 Answers: • No

 48. Is it mandatory to create an NSAutoreleasePool in a Cocoa application?
 Answers: • No

 49. What is the normal way of handling Cocoa events?
 Answers: • By implementing NSResponder methods in subclasses

 50. Which of the following classes manages the computer's global notifications?
 Answers: • NSDistributedNotificationCenter

 51. Can a notified object find out from where the notification is coming? (Sending object)
 Answers: • Yes

 52. How wide is unichar on a 32bit machine?
 Answers: • 8bit

 53. Is the following code correct?

 NSRect a = NSMakeRect(0, 1, 2, 3) + NSMakeRect(0, 1, 2, 3);
 Answers: • No

 54. Fill the blank.

 NSNotification : <> : NSObject
 Answers: • Nothing is required to fill the blank

 55. Is the following code valid?

 NSRect r;

 r.size = NSMakeSize(10, 10);
 r.origin = NSMakePoint(-5, -5);
 Answers: • Yes

 56. Is the following code correct?

 NSMutableArray *a = [[NSMutableArray new] autorelease];

 // do something with a

 [a release];
 Answers: • No

 57. What kind of memory management mechanisms can Cocoa uses?
 Answers: • Reference counting

 58. Can you detach threads in Cocoa?
 Answers: • Yes

 59. Which of the following is a valid Uniform Type Identifier?
 Answers: • public.jpeg

 60. Is the following code correct?

 - (void)myMethod:(NSString **)s {
 *s = [[NSString alloc] init]:
 Answers: • No