Question:* Consider the following code: (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Set Background Color/Pattern self.window.backgroundColor = [UIColor blackColor]; self.tabBarController.tabBar.backgroundColor = [UIColor clearColor]; //self.window.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"testbg.png"]]; // Set StatusBar Color [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent]; // Add the tab bar controller's current view as a subview of the window self.window.rootViewController = self.tabBarController; [self.window makeKeyAndVisible]; return YES; } How can the error be corrected that gets thrown in the console, "Applications are expected to have a root view controller at the end of application launch"?
Answer: • MenuViewController *menuViewController = [[MenuViewController alloc]init]; self.window.rootViewController = menuViewController;
Question:* Which of the following allows it to determine if an application is running on iPhone, or if it's running on an iPod Touch?
Answer: • NSString *deviceType = [UIDevice currentDevice].model; if([deviceType isEqualToString:@"iPhone"])
Question:* What is true about ARC and manual memory management?
Answer: • nil out properties in dealloc under manual memory management but not in ARC.
Question:* What does the "strong" property attribute do?
Answer: • It makes the object alive, as long as there is a strong pointer to it.
Question:* Which of the following is the best practice to find an active internet connection?
Answer: • - (BOOL) connectedToInternet { Reachability *reachability = [Reachability reachabilityForInternetConnection]; NetworkStatus networkStatus = [reachability currentReachabilityStatus]; return !(networkStatus == NotReachable); }
Question:* What gets returned if XIB is not properly connected to a parent controller?
Answer: • EXEC_BAD_ACCESS
Question:* What is the use of performSelector in iOS?
Answer: • To call a method of a class
Question:* Which of the following is the correct way to get the value of the first object of a NsMutableArray stored in another NsMutableArray?
Answer: • [[myArray objectAtIndex:0] objectAtIndex:0];
Question:* What is the maximum size of an iOS application?
Answer: • 2 GB
Question:* Which of the following is the correct way to set the font size of UIButton title label?
Answer: • someButton.titleLabel.font = [UIFont systemFontOfSize: 15];
Question:* Which of the following frameworks is needed to apply a border to an object?
Answer: • QuartzCore
Question:* How can it be detected if the app is running on an iPhone 5?
Answer: • if([[UIScreen mainScreen] bounds].size.height == 568)
Question:* Which of the following is not a valid Touch method with respect to Cocoa Touch programming?
Answer: • None of above
Question:* Which of the following will return the device's current location?
Answer: • CLLocationManager locationManager = [[CLLocationManager alloc] init]; [locationManager startUpdatingLocation];
Question:* Which of the following is the correct way to print out stack/trace to the console/log in Cocoa application?
Answer: • NSLog(@”%@”,[NSThread callStackSymbols]);
Question:* Which of the following is not a valid UIGestureRecognizer?
Answer: • UIZoomGestureRecognizer
Question:* Which of the following will change the placeholder text color in UITextField?
Answer: • None of the above.
Question:* Which of the following framework is needed to round corners of UILabel?
Answer: • QuartzCore
Question:* Which of the following is not a valid icon size for any iOS device (iPhone, iPod, iPad)?
Answer: • 64 x 64
Question:* Which of the following is not a valid UIGestureRecognizer?
Answer: • UIZoomGestureRecognizer
Question:* Which of the following will set an image on UIButton?
Answer: • [button setImage:[UIImage imageNamed:@"btn_img.png"] forState:UIControlStateNormal];
Question:* Select all incorrect bundle ID(s):
Answer: • com.appName
Question:* Which of the following will set the font of UISegmentedControl?
Answer: • UIFont *font = [UIFont boldSystemFontOfSize:12.0f]; NSDictionary *attributes = [NSDictionary dictionaryWithObject:font forKey:UITextAttributeFont]; [segmentedControl setTitleTextAttributes:attributes forState:UIControlStateNormal];
Question:* Which of the following correctly sets an image on UIButton?
Answer: • [button setImage:[UIImage imageNamed:@"button_img.png"] forState:UIControlStateNormal];
Question:* Which of the following font packages are supported by Cocoa-Touch?
Answer: • .ttf (True Type Font)
Question:* Which of the following is not an Open Source Framework/Library?
Answer: • StoreKit
Question:* Which of the following is the best way to add a UIToolbar above keyboard?
Answer: • -(void)textFieldDidBeginEditing:(UITextField *)textField { [self.view addSubview:toolbar]; }
Question:* Select which of the following is not UITableViewCellSelectionStyle values?
Answer: • UITableViewCellSelectionStyleLightGray
Question:* What is the correct method to define a delegate object in an ARC Environment?
Answer: • @property (nonatomic, weak) id <MyClassDelegate> delegate;
Question:* Which of the following is the best practice to find active internet connection?
Answer: • - (BOOL) connectedToInternet { Reachability *reachability = [Reachability reachabilityForInternetConnection]; NetworkStatus networkStatus = [reachability currentReachabilityStatus]; return !(networkStatus == NotReachable); }
Question:* What will be output of following code? NSLog(@"%.2f",[[UIDevice currentDevice].systemVersion floatValue]);
Answer: • 6.10
Question:* What is the difference between new and [[alloc]init] in iOS?
Answer: • No difference. Both [[alloc]init] and new are used to create an object.
Question:* How can the application name of an iOS project be changed?
Answer: • Change Bundle Display Name from info.plist
Question:* What could be the probable result if selector is unknown or undefined?
Answer: • Causes application to terminate with error
Question:* Is it possible to deploy beta build on any device?
Answer: • Beta build can be deployed only on devices that are included in Mobile Provision certificate while compiling build.
Question:* Which one is true regarding integrating and using custom fonts in an iOS application?
Answer: • Adding fonts to your app plist allows usage directly in the app.
Question:* Which of the following is the correct way to set UIButton's Highlight Tint color programmatically?
Answer: • [button setTintColor:[UIColor grayColor]];
Question:* Which of the following properties would be used to draw a shadow under UIView?
Answer: • CGContextSetShadow();
Question:* Which of the following is the correct way to check whether the view controller view is loaded or visible?
Answer: • if (viewController.isViewLoaded && viewController.view.window) { // viewController is visible }
Question:* Which of the following is the correct way to transfer data from one view controller to another?
Answer: • Both 1 and 2 methods are correct.
Question:* Which of the following UILabel properties help adjust text within a UILabel?
Answer: • adjustsFontSizeToFitWidth
Question:* Which of the following is the correct way to set the Navigation Bar Color of the Tab Bar Configure Menu?
Answer: • "UINavigationController *navigationController; ... navigationController.navigationBar.tintColor = [UIColor blackColor];"
Question:* What does EXC_BAD_ACCESS signal received mean in Xcode?
Answer: • "Owning" the memory but forgetting to release
Question:* Which of the following is best JSON library to be used in iOS applications?
Answer: • JSON kit
Question:* How can an SMS be sent programmatically from the iPhone (iOS 4.0 or later)?
Answer: • Both A &B are correct answers
Question:* What is the difference between assign and retain in Objective-C?
Answer: • assign - Specifies that the setter uses simple assignment. This is the default. retain - Specifies that retain should be invoked on the object upon assignment. The previous value is sent a release message.
Question:* Which property would be used to get the UDID of UIDevice on iOS?
Answer: • [UIDevice uniqueIdentifier]
Question:* When does this behavior usually happen? "Xcode Message: finished running <my app>" on targeted device shows, but nothing happens
Answer: • If the app was ran on earlier devices (3G or 3GS) and arm6 was not added in Require Device Capabilities.
Question:* Is it possible to set multiple architecture from Build Settings tab in Xcode for a project?
Answer: • Yes
Question:* Which framework can be used to call SOAP web services in iOS applications?
Answer: • wsdl2objc framework
Question:* What property in info.plist handles the association of file types in an iPhone application?
Answer: • LSItemContentTypes
Question:* Which method of Objective-C handles detecting the shake gesture on an iOS device?
Answer: • - (void) accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration
Question:* Which one is the best resolution for the following error? "A valid signing identity matching this profile could not be found in your keychain"
Answer: • Renewing your provisioning profile
Question:* What is the best way to show multiple lines text in the UILabel?
Answer: • myLabel.numberOfLines = 0; CGRect currentFrame = myLabel.frame; CGSize max = CGSizeMake(myLabel.frame.size.width, 500); CGSize expected = [myString sizeWithFont:myLabel.font constrainedToSize:max lineBreakMode:myLabel.lineBreakMode]; currentFrame.size.height = expected.height; myLabel.frame = currentFrame;
Question:* Which of the following correctly describes when the - (void)viewDidUnload method is called?
Answer: • When a view is released.
Question:* Which of the following is not a valid MKAnnotationView property?
Answer: • None of these.
Question:* What does a "__block" type specifier mean?
Answer: • Modifications done with the variable marked with __block inside the block are also visible outside of it.
Question:* Which of the following is not a valid MPVolumeView method?
Answer: • - (CGRect)routeButtonRectForBounds:(CGRect)bounds
Question:* Which of the following code samples will declare a variable inside a block in Objective-C?
Answer: • [participants enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { Person *participant = (Person*)obj; Person *aPerson = nil; if ([participant.gender isEqualToString:@"M"]) { aPerson = participant; *stop = YES; } }]; return aPerson;
No comments:
Post a Comment