Do you know that? Learn to �productively procrastinate�; which means you work on what is most important first. next

Contact Email:

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

Test answers for iPhone Programming OS 2.1 Test 2016

(88 / 1, CL) Last updated: September 8
Upwork (oDesk) • General 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

88 Answered Test Questions:

1. Which of the following languages can be used to write the code for Xcode projects?


• C

• C++

• Objective-C

• Objective-C++

• Java

2. Which of the following need to be modified while localizing an application?


• Nib files (windows, views, menus).

• Static text.

• Icons and graphics.

• Dynamic text generated by your program.

3. Which of the following directives are used to declare and define classes, categories, and protocols?


• @interface

• @implementation

• @protocol

• @class

• @end

4. Which of the following statements regarding Objective-C are correct?


• In Objective-C, the keyword for NULL is nil.

• In Objective-C, #import and #include compiler directives carry out the same operations.

• In Objective-C, for the object-oriented constructs (such as method return values), id is the default data type.

• The keyword nil has an id with a value of 0.

5. Which of the following are valid touch attributes in a UITouch class object?


• locationInView

• timestamp

• phase

• tapCount

6. Which of the following statements comply with the fundamental rules of Memory Management in Objective-C?


• The ownership of the object is taken when it is created using a method the name of which begins with alloc or new or contains copy.

• The ownership of the objects is relinquished by using release or autorelease

• All other objects can also be released from memory using the release function.

• autorelease just means - send a release message later

7. The genstrings tool can parse _____.


• C files with .c filename extension.

• Objective-C files with .m filename extension.

• Java code files with .java filename extension.

• Nib files with any file name extension.

8. Which of the following are the Derivative types defined in Objective-C?


• short

• long

• long long

• int

9. Which of the following options regarding UIWindow and UIView classes are correct?


• A UIWindow class object holds the contents of a UIView class object.

• A UIWindow class object can hold multiple sub-objects whereas a UIView class object can hold only one sub-object.

• Both UIWindow and UIView classes are required to display anything on the iPhone.

• UIWindow is the iPhone's base window class and the UIView class is primarily an abstract super-class.

10. Which of the following statements regarding Memory Management are correct?


• The alloc method creates a new object and returns it with a reference count of 1

• retain does not change the receiver's reference count

• release decreases the receiver's reference count by 1

• autorelease decreases the receiver's reference count by 1 at some point in the future

• copy makes a copy of an object and increases the reference count by 1

11. Which of the following events occur when the retain count of the object drops to 0?


• The release method is fired to relinquish the ownership of the object.

• The object is deallocated.

• The dealloc method is invoked automatically

• The resources associated with it are disposed

12. Which of the following SDK classes can be used to get the location of the movement of a finger on the iPhone screen?


• UINavigationController

• UIEvent

• UITouch

• UIView

13. You have added the following code lines in your @implementation block in your ControllerView file:

        @synthesize textField;
        @synthesize label;
        @synthesize string;

And in your dealloc method, you have added the following code lines:

        - (void)dealloc {
            [textField release];
            [label release];
            [string release];
            [super dealloc];

What is the purpose of adding the above lines in your dealloc method?


• To release the instance variables

• To conform to the rules of memory management

• To make the variables available for reuse in application

• To terminate the program

14. Which of the following terms are related to Memory Management in Objective-C?


• alloc

• mutableCopy

• delete

• release

15. In your iPhone application, you want to apply an action sheet style that will display white text with transparent black background whenever a confirmation is required from the user. You have a UIActionSheet class object named "actionuser". Which of the following code snippets is the right one for applying this style?


• [ actionuser setActionSheetStyle: 0 ];

• [ actionuser setActionSheetStyle: 1 ];

• [ actionuser setActionSheetStyle: 2 ];

• [ actionuser setActionSheetStyle: 3 ];

16. Is NSMutableArray thread safe?


• Yes

• No

17. What is the purpose of active executable in an Xcode project?


• To specify which program is launched and how, when you run or debug from within Xcode.

• To select the appropriate configuration of the active target and each target it depends upon while building.

• To define different build configurations for different circumstances such as development or release.

• To build products for Multiple Platforms.

18. Which of the following samples returns the first name of a person listed under p in the address book?


• ABPersonGetValue(p, kABFirstNameProperty);

• ABPersonCopyValue(p, kABFirstNameProperty);

• ABRecordGetValue(p, kABPersonFirstNameProperty);

• ABRecordCopyValue(p, kABPersonFirstNameProperty);

• [p firstName];

19. In which file is the following function called in your application?
        int retVal = UIApplicationMain(argc, argv, nil, nil);


• info.plist

• Any file with .m extension

• main.m only

• Any file with .h extension

• ControllerView file

• Nib file

20. State whether the following statement is true or false:

Interface Builder doesn't generate source code


• True

• False

21. Can you place calls using the iPhone SDK?


• Yes

• No

22. Can you use POSIX threads on the iPhone?


• Yes

• No

23. Which of the following is the correct syntax for declaring a class in Objective-C?


• @interface ClassName : ItsSuperclass { instance variable declarations } method declarations @end

• @implementation ClassName : ItsSuperclass { instance variable declarations } method declarations @end

• @class ClassName : ItsSuperclass { instance variable declarations } method declarations @end

• All are correct

24. Locking all connections before editing the Nib files can be achieved by using:


• An option in the Start Menu.

• An option in the Preferences panel of Interface Builder.

• An option in the Preferences panel of Language Directory.

• Any of the above.

25. What is the endianness of the network for IP communications?


• Big endian

• Little endian

• Mixed endian

• Swapped endian

• Single endian

26. What is the screen resolution of the iPhone 3G?


• 720x540

• 480x320

• 320x240

• 540x280

• 540x480

27. Which of the following methods does the UIKit provide in order to draw a string at a specific point.


• NSString

• drawAtPoint:

• drawAsPatternInRect

• All of the above

28. From which of the following classes does a UITextView class object inherit its features?


• UIScroller

• UIView

• UIControl

• UITextField

29. Which of the following can be used to draw a tiled image?


• Quartz 2D function CGContextDrawTiledImage

• UIViews

• Either a or b

• Neither a not b

30. In your iPhone application, you want that the user should be able to select the date in Month, Day and Year mode. You have a UIDatePicker class object named dateModePicker. Which of the following code snippets is correct in order to apply this mode?


• [ dateModePicker setDatePickerMode: 0 ];

• [ dateModePicker setDatePickerMode: 1 ];

• [ dateModePicker setDatePickerMode: 2 ];

• [ dateModePicker setDatePickerMode: 3 ];

31. Which of the following is the base class for all iPhone applications?


• UIActionSheet

• UIApplication

• UIControl

• UIApplicationDelegate

32. In the CALayer class, the property contentsGravity allows you to position and scale the layer's contents image within the layer bounds. What is the role of the kCAGravityLeft positioning constant in contentsGravity?


• It positions the content image in the top left corner of the layer.

• It positions the content image vertically centered on the left edge of the layer.

• It positions the content image in the bottom left corner of the layer.

• It positions the content image at the center of the layer.

33. Before editing the Nibs, one should:


• Unlock all connections.

• Lock all connections.

• Break all connections.

• None of the above

34. Given the string "", how can you get an integer address (to fill a sockaddr_in structure)?


• With inet_ntoa

• With inet_aton

• With NSString

• All addresses are in ASCII format

• None of the above

35. Can you use POSIX sockets on the iPhone?


• Yes

• No

36. If you want to know if a host is reachable via the network, what would you use in your application?


• ping

• NSURL isReachable: method

• NSNetwork discover: method

• SCNetworkReachabilityCreateWithName

• None of the above

37. What happens if Xcode is not able to find a file or folder at the path defined for it in the project?


• Xcode skips the file or the folder and continues execution.

• Xcode gives an alert with a description of the missing file.

• Xcode displays the item in red in the project window.

38. In which language is the address book framework written?


• Objective-C

• C

• C++

• Ruby

• Java

39. When the genstrings tool discovers a key string used more than once in a single strings file, it:


• deletes the comments from the individual entries and leaves one comment string without generating a warning.

• merges the comments from the individual entries into one comment string and generates a warning.

• differentiates the comments from the individual entries into various strings and generates a warning.

• None of the above

40. Which of the following classes is used to internalize an XML into a logical tree structure?


• NSData class

• NSXMLDocument class

• NSXMLNode class

• NSPropertyListSerialization class

41. What is the CompressResources build step in an iPhone Xcode project?


• It resizes all the files in the project for displaying them in the iPhone.

• It resizes the png files in the project for displaying them in the iPhone.

• It compresses the files with the extensions .m and .h.

• It changes the extension of the files and compresses them.

42. Can CGGradientRef be used on the iPhone to draw gradients?


• Yes

• No

43. While using an iPhone, a user switches from one application to another application or service on the device. What is the most important factor to be kept in mind to ensure that your application reflects the most recent changes made by the user the next time it starts?


• The user should be asked to click save and close from the start menu

• The user should be asked to close your application

• The application should be programmed to save any user changes as they are made as quickly as possible.

• No specific consideration in this regard is necessary

44. Which of the following debugging environments are provided by Xcode to find and squash bugs in your code?


• Debugging from the text editor

• Mini Debugger

• Debugger window

• GDB debugger console

• All of the above

45. On the iPhone, what are the types of Person entries and Group entries?


• ABPersonRef and ABGroupRef

• ABPerson and ABGroup

• ABRecordRef and ABRecordRef

• ABRecord and ABRecord

• None of the above

46. How do you play a short sound on the iPhone?


• With the NSSound class

• With the UISound class

• With AudioServicesPlaySystemSound function

• With NSSystemSound function

• None of the above

47. What is the function of the Code Sense feature in Xcode?


• Code Sense helps in switching between different circumstances such as development or release.

• Code Sense maintains an index that contains important information for your project.

• Code Sense creates a cache for the files which are being used frequently.

• Code Sense maintains an index of files used in a project.

48. Whenever the iPhone users switch to another application like answering the phone, or checking their email, the application they were previously using _____.


• quits

• keeps running

• resumes as soon as the other application is terminated

• may or may not resume depending on the application

49. Does ABPersonCreate function add the newly created record into the address book?


• Yes

• No

50. How can you prevent a view from receiving touch events?


• By overriding UIResponder relevant methods

• By setting userInteractionEnabled to false

• By setting shouldDeliverEvent to false

• You can't

• None of the above

51. Which of the following is true?


• An application thread can have only one NSAutoreleasePool

• NSAutoreleasePool is thread safe

• NSAutoreleasePool should not be used outside the main thread

• Each thread maintains its own stack of NSAutoreleasePool objects

• None is true

52. Refer to the given image:

Which of the above window panes will display Build system output when Xcode builds your target and shows the corresponding warnings and errors?


• A

• B

• C

• None of the above

53. Which of the following classes automatically manages transition
animation between Views?


• UIAnimationController

• UIViewAnimation

• CGViewAnimation

• UIApplicationDelegate

• UINavigationController

54. Which of the following is not a touch event method?


• - (void)touchesDragged:(NSSet *)touches withEvent:(UIEvent *)event;

• - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;

• - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;

• - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;

• - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event

55. How many windows does an iPhone application typically have?


• 0

• 1

• 2

• 10

• None of the above

56. Which of the following shapes is generated by Views in an iPhone?


• Rectangular

• Square

• Rhombus

• All of the above

57. How can you restrict the delivery of multi-touch events to their subviews


• You can't

• By manually redirecting events from the event handlers

• By overriding hitTest:withEvent:

• By registering the subview in the notification center

• None of the above

58. Using the following function, what will you get from the default database?

NSUserDefaults* defs = [NSUserDefaults standardUserDefaults];
NSArray* languages = [defs objectForKey:@"AppleLanguages"];
NSString* preferredLang = [languages objectAtIndex:0];


• The list of preferred languages.

• The user's preferred language.

• The user's default language.

• The list of languages supported by the application.

59. Which of the following should be used to draw 3D content?


• OpenGL

• OpenGL ES

• Direct 3D

• None of the above

60. Which of the following is a feature of CAPropertyAnimation class in Core Animation?


• It is an abstract subclass that provides support for animating a layer property specified by a key path

• It allows an array of animation objects to be grouped together and run concurrently

• It provides simple interpolation for a layer property

• It provides a transition effect that affects the entire layer's content. It fades, pushes, or reveals layer content when animating

61. While recording a sound, how can you know if the source of the sound is from the built-in microphone or headphone microphone?


• With the NSSound class method named audioSource

• With the AudioQueueGetParameters function

• By querying the registry

• By polling for audio events

• iPhone OS 2.1 version does not support sound recording.

62. Can non-main threads poll for events?


• Yes

• No

63. What can trigger a call to touchesCancelled:withEvent: ?


• The user lifting all fingers from the phone

• A system event, such as a phone call

• The user lifting one or more fingers from the phone

• This method doesn't exist

• None of the above

64. In which of the following classes are the addChild, insertChild, and removeChildAtIndex methods defined?


• NSXMLElement Class

• NSXMLNode Class

• NSXMLDocument class

• NSPropertyListSerialization class

65. While opening Nib files, which of the following should not be ignored?


• Objects in a Nib file typically have connections between them that should not be broken.

• If Objects in a Nib file have broken connections, they should not be restored.

• The size of the files.

• None of the above

66. What does CFSocketGetNative return?


• A CF opaque type

• A POSIX socket handle

• A native Cocoa object

• A binary representation of the socket incoming data in machine native endian

• None of the above

67. Are instances of ABAddressBookRef thread safe?


• Yes

• No

68. Which of the following best describes View Controllers?


• View Controllers provide access to data.

• View Controllers implement Views' inner logic.

• View Controllers regulate Views' animations.

• View Controllers provide the basic user interface logic for presenting numerous application views to the user.

• None of the above

69. Is NSRunLoop thread safe?


• Yes

• No

70. What is the default value for the anchorPoint property in Layer Geometry?


• (0.0,0.0)

• (0.0,0.5)

• (0.5,0.0)

• (0.5,0.5)

• (1.0,1.0)

71. Can the iPhone use Bonjour messaging?


• Yes

• No

72. Which of the following debugging tasks are provided by Xcode to find and squash bugs in your code?


• Add and set breakpoints.

• View your call stack per thread.

• View the value of variables by hovering the mouse pointer over them.

• Execute a single line of code.

• All of the above

73. If the code is written using the Core Foundation and Foundation macros, the simplest way to create strings files is:


• Using an option in the Preferences panel of Interface Builder.

• By merging the comments from the individual entries into one comment string.

• By unlocking all connections.

• By using the genstrings command-line tool.

74. Which type of data is returned by the following function?

   CFDataRef CreateDataFromImage(UIImage *image)

    return CGDataProviderCopyData(CGImageGetDataProvider(image.CGImage));


• Binary image data.

• Raw pixel data.

• Compressed image data.

• ASCII image data.

75. How can you play video on the iPhone from your application?


• With QuickTime

• With OpenGL ES

• With the MediaPlayer framework

• With VideoCodecServices

76. If you try to run an application in the iPhone Simulator without having created the ControllerView Nib file, what will happen?


• The application will crash

• The application will run smoothly

• If you set the Nib file name to nil using initWithNibName:nil, the application will run

• The application will take time to load

77. Which design pattern for your application periodically sends messages to another object to ask for input or to notify that an event is occurring?


• Model-View-Controller

• Delegation

• Target-action

78. Choose the correct statement:
To "flip" your user interface:


• use the standardViewTransition:forInterface:Cache: method of the UIView class, and provide the appropriate constant to specify the flip direction.

• use the setAnimationTransition:forView:Cache: method of the UIView class, and provide the appropriate constant to specify the flip direction.

• use the setUICatalog:forView:Cache: method of the UIView class reference, and provide the appropriate constant to specify the flip direction.

• The user interface can not be flipped

79. What is the default setting to refer to file locations in your Xcode project?


• Relative to Build Product

• Relative to Project

• Relative to Enclosing Group

• Relative to <source path>

• Absolute Path

80. How can you create an OpenGL ES texture with a .png image?


• Using UIImage glTexture property

• Using UIImageBitmapRep

• Using CGContextDrawImage in a CGBitmapContext

• You can't

• None of the above

81. By which of the following methods can an NSAutoreleasePool object be created?


• autorelease

• alloc

• copy

• retain

82. Is OpenAL available on the iPhone?


• Yes

• No

83. What are universal binaries in Xcode?


• These are executable files that can contain code and data for more than one architecture.

• These are file references which are generated by the target, such as an application.

• These are indexes that contain symbolic information for your project.

• These are used to specify build location settings.

84. The most effective way to ensure that users have a positive application-switching experience is to _______.


• enhance the launch time of the application to the maximum

• reduce the memory space allocated to all applications

• pare the launch time of the application to the minimum

• disable any unused applications

85. Which of the following classes will be used to embbed web content in an iPhone application?


• UIWebView

• UIViewController

• UINavigationController

• UITabBarController

86. Are multiple touches enabled by default?


• Yes

• No

87. Can your application change the global sound volume?


• Yes

• No

88. Which of the following statement is incorrect with regard to Object Ownership in Memory Management?


• An object may have one or more owners

• An object is owned by the user if it is created using alloc

• If an object is copied, the retain count is returned as 0

• If an object has no owners, its retain count drops to 0

1 NOT Answered Yet Test Questions:

(hold on, will be updated soon)
89. The UIView class provides a function called setAlpha which adjusts the transparency of a view. Which of the following are valid code snippets with regard to setting transparency of a view? It is provided that appView is an object of UIView class.


• [ appView setAlpha: 0.5 ];

• [ appView setAlpha: 0.6 ];

• [ appView setAlpha: 1.5 ];

• [ appView setAlpha: 1 ];