UpWork (oDesk) & Elance iPhone Programming OS 2.1 Test Question & Answers

UpWork (oDesk) & Elance iPhone Programming OS 2.1 Test Question & Answers are really very important to pass UpWork & Elance test. You will get top score at this skill test exam. If you found any problem or wrong answer please inform me via contact or comments. We will try to solve it in short. This test is extremely valuable to acquire knowledge of iPhone Programming OS 2.1. Lets Start test.

Ques : Which of the following languages can be used to write the code for Xcode projects?
Ans  : C + C++ Objective-C+ Objective-C++

Ques : Which of the following need to be modified while localizing an application?
Ans  :
 Nib files (windows, views, menus).
 Static text.
 Icons and graphics.
 Dynamic text generated by your program.

Ques : Which of the following statements regarding Objective-C are correct?
Ans  : In Objective-C, the keyword for NULL is nil.
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.

Ques : Which of the following directives are used to declare and define classes, categories, and protocols?
Ans  : @interface + @protocol + @end

Ques : Which of the following are valid touch attributes in a UITouch class object?
Ans  : timestamp + phase+tapCount

Ques : Which of the following statements comply with the fundamental rules of Memory Management in Objective-C?
Ans  : 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 +  autorelease just means - send a release message later

Ques : The genstrings tool can parse _____.
Ans  :
 C files with .c filename extension.

 Objective-C files with .m filename extension.

 Java code files with .java filename extension.

Ques : Which of the following are the Derivative types defined in Objective-C?
Ans  :


 long long

Ques : Which of the following options regarding UIWindow and UIView classes are correct?
Ans  :  A UIWindow class object holds the contents of a UIView class 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.

Ques : Which of the following statements regarding Memory Management are correct?
Ans  : The alloc method creates a new object and returns it with a reference count of 1

 release decreases the receiver's reference count by 1

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

Ques : Which of the following events occur when the retain count of the object drops to 0?
Ans  : The object is deallocated

      The dealloc method is invoked automatically

Ques : Which of the following SDK classes can be used to get the location of the movement of a finger on the iPhone screen?
Ans  :  UIEvent
Ques : 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?
Ans  : To release the instance variables

       To conform to the rules of memory management

Ques : Which of the following terms are related to Memory Management in Objective-C?
Ans  :  alloc

Ques : Is NSMutableArray thread safe?
Ans  : No

Ques :  What is the purpose of active executable in an Xcode project?
Ans  : To specify which program is launched and how, when you run or debug from within Xcode.

Ques : State whether the following statement is true or false:

Interface Builder doesn't generate source code
Ans  : False

Ques : Locking all connections before editing the Nib files can be achieved by using:
Ans  : An option in the Preferences panel of Interface Builder.

Ques : What is the endianness of the network for IP communications?
Ans  : Big endian

Ques : 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?
Ans  : [ dateModePicker setDatePickerMode: 1 ];

Ques : Which of the following is the base class for all iPhone applications?
Ans  : UIApplication

Ques : Given the string "", how can you get an integer address (to fill a sockaddr_in structure)?
Ans  : With inet_aton

Ques : Can you use POSIX sockets on the iPhone?
Ans  : Yes

Ques : If you want to know if a host is reachable via the network, what would you use in your application?
Ans  : SCNetworkReachabilityCreateWithName

Ques : What happens if Xcode is not able to find a file or folder at the path defined for it in the project?
Ans  :  Xcode displays the item in red in the project window.When the genstrings tool discovers a key string used more than once in a single strings file, it:

Ques : When the genstrings tool discovers a key string used more than once in a single strings file, it:
Ans  : merges the comments from the individual entries into one comment string and generates a warning.

Ques :  Which of the following classes is used to internalize an XML into a logical tree structure?
Ans  : NSPropertyListSerialization class

Ques : What is the CompressResources build step in an iPhone Xcode project?
Ans  : It resizes the png files in the project for displaying them in the iPhone.

Ques : Does ABPersonCreate function add the newly created record into the address book?
Ans  : No

Ques : How can you restrict the delivery of multi-touch events to their subviews
Ans  : By overriding hitTest:withEvent:

Ques :  Which of the following should be used to draw 3D content?
Ans  : OpenGL ES

Ques :  Which of the following is a feature of CAPropertyAnimation class in Core Animation?
Ans  :   It is an abstract subclass that provides support for animating a layer property specified by a key path

Ques : Is NSRunLoop thread safe?
Ans  : No

Ques : Which type of data is returned by the following function?

   CFDataRef CreateDataFromImage(UIImage *image)

    return CGDataProviderCopyData(CGImageGetDataProvider(image.CGImage));
Ans  : Raw pixel data.

Ques : How can you play video on the iPhone from your application?
Ans  : With the MediaPlayer framework

Ques : What is the default setting to refer to file locations in your Xcode project?
Ans  : Relative to Enclosing Group

Ques : How can you create an OpenGL ES texture with a .png image?
Ans  : Using CGContextDrawImage in a CGBitmapContext

Ques : Which of the following classes will be used to embbed web content in an iPhone application?
Ans  : UIWebView

Ques : 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?
Ans  :  [ actionuser setActionSheetStyle: 2 ];

Ques : Which of the following samples returns the first name of a person listed under p in the address book?
Ans  :  ABRecordCopyValue(p, kABPersonFirstNameProperty);

Ques : In which file is the following function called in your application?
        int retVal = UIApplicationMain(argc, argv, nil, nil);
Ans  : main.m only

Ques : Can you place calls using the iPhone SDK?
Ans  : Yes

Ques : Can you use POSIX threads on the iPhone?
Ans  : Yes

Ques : Which of the following is the correct syntax for declaring a class in Objective-C?
Ans  : @interface ClassName : ItsSuperclass { instance variable declarations } method declarations @end

Ques : What is the screen resolution of the iPhone 3G?
Ans  : 480x320

Ques :Which of the following methods does the UIKit provide in order to draw a string at a specific point.
Ans  : drawAtPoint:

Ques : From which of the following classes does a UITextView class object inherit its features?
Ans  : UIView

Ques : Which of the following can be used to draw a tiled image?
Ans  : Quartz 2D function CGContextDrawTiledImage

Ques :  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?
Ans  : It positions the content image vertically centered on the left edge of the layer.

Ques : Before editing the Nibs, one should:
Ans  : Lock all connections.

Ques : In which language is the address book framework written?
Ans  : c

Ques : Can CGGradientRef be used on the iPhone to draw gradients?
Ans  : Yes

Ques : 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?
Ans  : The application should be programmed to save any user changes as they are made as quickly as possible.

Ques : Which of the following debugging environments are provided by Xcode to find and squash bugs in your code?
Ans  : All of the above

Ques : On the iPhone, what are the types of Person entries and Group entries?
Ans  : ABRecordRef and ABRecordRef

Ques : How do you play a short sound on the iPhone?
Ans  :  With AudioServicesPlaySystemSound function

Ques : What is the function of the Code Sense feature in Xcode?
Ans  : Code Sense maintains an index that contains important information for your project.

Ques : Whenever the iPhone users switch to another application like answering the phone, or checking their email, the application they were previously using _____.
Ans  : resumes as soon as the other application is terminated

Ques : How can you prevent a view from receiving touch events?
Ans  : By setting userInteractionEnabled to false

Ques : Which of the following is true?
Ans  : Each thread maintains its own stack of NSAutoreleasePool objects

Ques : 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?
Ans  : A

Ques : Which of the following classes automatically manages transition
animation between Views?
Ans  : UINavigationController

Ques : Which of the following is not a touch event method?
Ans  :  - (void)touchesDragged:(NSSet *)touches withEvent:(UIEvent *)event;

Ques : How many windows does an iPhone application typically have?
Ans  : 1

Ques : Which of the following shapes is generated by Views in an iPhone?
Ans  : Rectangular

Ques : 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];
Ans  : The user's preferred language.

Ques : While recording a sound, how can you know if the source of the sound is from the built-in microphone or headphone microphone?
Ans  : Phone OS 2.1 version does not support sound recording.

Ques : Can non-main threads poll for events?
Ans  : Yes

Ques : What can trigger a call to touchesCancelled:withEvent: ?
Ans  : A system event, such as a phone call

Ques :  In which of the following classes are the addChild, insertChild, and removeChildAtIndex methods defined?
Ans  : NSXMLElement Class

Ques : While opening Nib files, which of the following should not be ignored?
Ans  : If Objects in a Nib file have broken connections, they should not be restored.

Ques :  What does CFSocketGetNative return?
Ans  :  A POSIX socket handle

Ques : Are instances of ABAddressBookRef thread safe?
Ans  : Yes

Ques : Which of the following best describes View Controllers?
Ans  : View Controllers provide the basic user interface logic for presenting numerous application views to the user.

Ques : What is the default value for the anchorPoint property in Layer Geometry?
Ans  :  (0.5,0.5)

Ques : Can the iPhone use Bonjour messaging?
Ans  : Yes

Ques : Which of the following debugging tasks are provided by Xcode to find and squash bugs in your code?
Ans  : All of the above

Ques : If the code is written using the Core Foundation and Foundation macros, the simplest way to create strings files is:
Ans  : By using the genstrings command-line tool.

Ques : If you try to run an application in the iPhone Simulator without having created the ControllerView Nib file, what will happen?
Ans  : If you set the Nib file name to nil using initWithNibName:nil, the application will run

Ques : Which design pattern for your application periodically sends messages to another object to ask for input or to notify that an event is occurring?
Ans  : Delegation

Ques : Choose the correct statement:
To "flip" your user interface:
Ans  : use the setAnimationTransition:forView:Cache: method of the UIView class, and provide the appropriate constant to specify the flip direction.

Ques : By which of the following methods can an NSAutoreleasePool object be created?
Ans  :  autorelease

Ques : Is OpenAL available on the iPhone?
Ans  : Yes

Ques : What are universal binaries in Xcode?
Ans  : These are executable files that can contain code and data for more than one architecture.

Ques : The most effective way to ensure that users have a positive application-switching experience is to _______.
Ans  : pare the launch time of the application to the minimum

Ques : Are multiple touches enabled by default?
Ans  : No

Ques : Can your application change the global sound volume?
Ans  : No

Ques : Which of the following statement is incorrect with regard to Object Ownership in Memory Management?
Ans  : If an object is copied, the retain count is returned as 0

Thanks for watching this test Question & Answers. Please don't forget to leave a comment about this post. You can also find some more effective test question & answers, information, techniques, technology news, tutorials, online earning information, recent news, results, job news, job exam results, admission details & another related services on the following sites below. Happy Working!
News For Todays ARSBD UpWorkElanceTests ARSBD-JOBS DesignerTab UpLance

Share this

Related Posts

Next Post »

We recommend you to subscribe us to get update from your email. EmoticonEmoticon