aspose file tools*
The moose likes iOS and the fly likes i have an iOS exam Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » iOS
Bookmark "i have an iOS exam" Watch "i have an iOS exam" New topic
Author

i have an iOS exam

shemi barokas
Greenhorn

Joined: Feb 15, 2014
Posts: 1

! !
'Page'1
Written'by'Yonatan'Betzer,'February'2013
1:!!Which!of!the!following!is!a!correct!syntax!for!declaring!a!protocol!in!Objective=C!?! !
A.!!!
!
!!! !
!
!
!
! B.!!! !
!
!
!
!
!
C.!!! @class!MyProtocol:NSObject! ! {!
! !!!Method!declarations!
! }!
! @end!
!
!
D.!!
!
!
!
!
!
!
!
! 2:!!!Which!of!the!following!protocols!is!used!to!provide!the!row!titles!to!UIPickerView?! A.!!UIPickerView!
B.!!UIPickerViewDataSource!
C.!!UIPickerViewDelegate!
D.!!UIPickerViewControllerSource!
!
3:!!Which!of!the!following!statements!is!false!about!Objective=C!protocols?! A.!!Protocols!help!us!avoid!multiple!inheritance!between!classes.! B.!!Protocols!allow!you!to!split!a!class!definition!across!several!files! C.!!Protocols!define!a!way!to!communicate!with!classes!without!importing!them.! D.!!You!can!define!a!protocol!without!a!name!
!
!
!
@protocol!MyProtocol!<NSObject>! {!
!!!Method!declarations!
}!
@end!
@interface!MyProtocol!<NSObject>! {!
!!!Method!declarations!
}!
@end!
@protocol!MyProtocol!<NSObject>! {!
!!!Method!declarations! !!!Variable!declaration!
}! @end! !
'Page'2 Written'by'Yonatan'Betzer,'February'2013
!
! 4:!!Consider!the!following!code!in!Objective=C:! !
@interface Bla : NSObject
-(void) print;
@end
@implementation Bla -(void) print
{
NSLog(@"Test Print"); }
@end
! What!will!be!the!output!of!this!code:! int i = 3;
if(i = 2)
{
Bla *myObject;
[myObject print];
}!
!
A.!!It!will!print!“Test!Print”! B.!!There!will!be!a!compile!time!error! C.!!There!will!be!a!run!time!error! D.!!The!code!will!run,!but!there!will!be!no!output! !
5:!!Consider!the!following!code:!
#import <Foundation/Foundation.h> @interface Message: NSObject -(NSString *) getData;
@end
@implementation Message -(CGFloat) getData {
return M_PI; }
@end
! What!will!be!the!output!of!this!code!
!
A.!!It!will!print!“3.14”! B.!!There!will!be!a!compile!time!error! C.!!There!will!be!a!run!time!error!
Message *message = [[Message alloc] init];
id data = [message performSelector:@selector(getData)]; NSLog(@"%.2f", data);
'Page'3 Written'by'Yonatan'Betzer,'February'2013
D.!!The!code!will!run,!but!there!will!be!no!output! !
6:!!Consider!the!following!code:!
!
@interface A : NSObject -(void) print;
@end
@implementation A -(void) print
{
NSLog(@"A"); }
@end
@interface B : A -(void) print; @end
@implementation B -(void) print
{
NSLog(@"B"); }
@end
! What!will!be!the!output!of!this!code! !
!
A. It!will!print!“A”!
B. It!will!print!“B”!
C. There!will!be!a!compile!time!error! D. There!will!be!a!runtime!error!
!
And!what!about!!
!
A *a = [[B alloc] init];
[a print];! !
E. It!will!print!“A”!
F. It!will!print!“B”!
G. There!will!be!a!compile!time!error!
H. There!will!be!a!runtime!error!
!
! 7:!!You!need!to!create!a!tab!bar!controller!with!two!tabs.!You!write!the!following!!method!in!
B *a = [[A alloc] init]; [a print];
'Page'4 Written'by'Yonatan'Betzer,'February'2013
the!AppDelegate!class:! !
- (BOOL)applicationUIApplication *)application didFinishLaunchingWithOptionsNSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
UITabBarController *baseTabBarController = [[UITabBarController alloc] init]; baseTabBarController.delegate = self;
UIViewController *viewController1 =
[[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
UIViewController *viewController2 =
[[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
(1) ___________________________________________________________________
!!!self.window.rootViewController!=!baseTabBarController;!
!
When!you!run!the!application,!you!get!a!blank!screen.!
What!is!the!missing!code!line!in!(1)!?!
A. [self.window!addSubView:!baseTabBarController];!
B. [self.navigationController!pushViewController:baseTabBarController!animated:YES];!
C. [baseTabBarController!show];!
D. baseTabBarController.viewControllers = @[viewController1, viewController2];!
E. [baseTabBarController addViewController:viewController1];!
!
8:!!Which!of!the!following!is!one!of!the!roles!of!the!Model!in!the!MVC!(Model=View= Controller)!paradigm?!
A. Exposes!properties!that!the!view!binds!to!
B. Provides!data!validation!
C. Maintains!state!for!the!view!
D. Implements!data!change!notifications!
!
9:!!Which!of!the!following!is!not!a!valid!property!definition?!
A. @property!(atomic)!int!age;!
B. @property!(strong)!NSString!*name;!
C. @property!(nonatomic,!weak)!NSString!*name;!
D. @property!int!age;!!
! 10:!You!create!a!tab!bar!controller!that!navigates!between!four!view!controllers.!You!need!to! implement!a!button!on!the!second!view!controller!that!will!return!the!user!back!to!the!first! view!controller.!Which!of!the!following!statements!you!should!use?!
!
A. [self.tabBarController!pushViewController:!@”FirstViewController”!animated:YES];!
B. self.!tabBarController.selectedIndex!=!0;!
[self.window makeKeyAndVisible];
return YES; }
'Page'5 Written'by'Yonatan'Betzer,'February'2013
C. self.!tabBarController.selectedViewcontroller!=!self;!
D. [self.!tabBarController!popToRootViewController];!
! 11:!!Which!of!the!following!classes!is!not!used!to!consume!web!content!using!an!HTTP! connection?!
A.!!NSURLConnection! B.!!NSURLRequest! C.!!NSHttpClient! D.!!NSURL!
!
12:!!Which!of!the!following!methods!does!not!belong!to!NSArray?!
A.!!arrayWithObjects:!
B.!!objectAtIndexPath:!
C.!!addObject:!
D.!!objectsAtIndexes:!
! 13:!!Which!of!the!following!is!not!one!of!the!steps!to!develop!an!application!to!a!mobile! phone?!
A.!!Create!an!App!ID!
B.!!Create!a!Development!Provisioining!Profile!
C.!!Register!the!app!in!iTunes!Connect!
D.!!Create!a!Disitribution!Certificate!
! 14:!!You!place!a!button!on!your!view!using!Interface!Builder.!You!create!an!outlet!names! uglyButton.!You!need!to!change!that!button’s!text!from!code.!What!should!you!do?! A.!!uglyButton.text!=!@”Bla”;!
B.!![uglyButton!setTitle:@”Bla”];!
C.!!uglyButton.titleLabel.text!=!@”Bla”;! D.!![uglyButton!setTitle:@”Bla”!forControlState:UIControlStateNormal];!
!
15:!!Which!of!the!following!statements!is!true!about!Categories?! A.!!You!can!create!more!than!one!category!for!a!class! B.!!A!category!can!be!used!on!more!than!one!class! C.!!A!category!can!declare!optional!methods! D.!!You!can!declare!an!instance!variable!of!a!category!type! E.!!You!define!a!protocol!using!the!@category!keyword!
!
16:!What!is!the!difference!between!a!struct!and!a!class!in!Objective=C!?!
A. A!struct!cannot!have!methods!
B. A!struct!must!be!initialized!when!declared!
C. A!struct!must!be!defined!with!the!typedef!keyword!
D. A!struct!cannot!contain!objects!within!it!
!
17:!In!Core!Data,!which!object!is!responsible!for!selecting!objects!from!the!database?!
A. NSPersistentStoreCoordinator!
B. NSManagedObjectContext!
C. NSEntityDescription!
D. NSFetchedResultsController!
'Page'6 Written'by'Yonatan'Betzer,'February'2013
! 18:!You!create!the!following!view!controller,!which!loads!its!view!from!a!nib!file:!
@implementation MyViewController
- (id) init {
NSLog(@"init");
return self; }
- (id) initWithNibNameNSString *)nibNameOrNil bundleNSBundle *)nibBundleOrNil {
NSLog(@"initWithNibName");
return self; }
- (void)viewDidLoad {
[super viewDidLoad];
NSLog(@"viewDidLoad"); }
- (void)viewDidAppearBOOL)animated {
NSLog(@"viewDidAppear"); }
- (void)viewWillAppearBOOL)animated {
NSLog(@"viewWillAppear"); }
@end
!
When!you!run!the!application,!which!log!messages!will!you!see?!
A. init,!initWithNibName,!viewWillAppear,!viewDidLoad,!viewDidAppear! B. init,!viewWillAppear,!viewDidLoad,!viewDidAppear!
C. initWithNibName,!viewDidLoad,!viewWillAppear,!viewDidAppear!
D. initWithNibName,!viewWillAppear,!viewDidAppear,!viewDidLoad!
!
!
19:!!You!write!the!following!class!in!Objective=C:!
! Its!implementation!file!is:!
#import <Foundation/Foundation.h>
@interface MyClass : NSObject +(int) getCount;
@end
#import "MyClass.h" static int count = 0;
@implementation MyClass
'Page'7 Written'by'Yonatan'Betzer,'February'2013
-(id) init {
self = [super init]; if (self)
{
count++; }
return self; }
+(int) getCount {
return count; }
@end
And!the!main!function!is:!
#import <Foundation/Foundation.h> #import "MyClass.h"
int main(int argc, const char * argv[]) {
@autoreleasepool {
MyClass *obj1 = [[MyClass alloc] init]; MyClass *obj2 = [[MyClass alloc] init];
NSLog(@"Count: %d", [MyClass getCount]); }
return 0; }
What!will!be!the!output?! A.!!Count:!0!
B.!!Count:!1!
C.!!Count:!2!
D.!!Count:!3! E.!!There!will!be!a!runtime!error!
!
!
!! !
can some help me to answers/?

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42608
    
  65
Welcome to JavaRanch. Please QuoteYourSources. You may also want to edit you post, as it is rather illegible - I doubt many people will try to make sense of it.


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: i have an iOS exam