SUBJECTS
|
BROWSE
|
CAREER CENTER
|
POPULAR
|
JOIN
|
LOGIN
Business Skills
|
Soft Skills
|
Basic Literacy
|
Certifications
About
|
Help
|
Privacy
|
Terms
|
Email
Search
Test your basic knowledge |
iOS 5 App Development 2
Start Test
Study First
Subjects
:
it-skills
,
apple
Instructions:
Answer 50 questions in 15 minutes.
If you are not ready to take this test, you can
study here
.
Match each statement with the correct term.
Don't refresh. All questions and answers are randomly picked and ordered every time you load a test.
This is a study tool. The 3 wrong answers for each question are randomly chosen from answers to other questions. So, you might find at times the answers obvious, but you will see it re-enforces your understanding as you take the test each time.
1. How to create a UIView in code?
At runtime.
[[UIView alloc] initWithFrame]
Argument validation.
Two floats - for width and height
2. ______ is a pointer
NSNumber. For example numberWithDouble: and doubleValue:
self = [super init] {if init is the designated initializer of the superclass}. If the superclass init routine fails - I will know to return nil from my init routine.
the controller's minions. Gets things to the screen.
self
3. What is in the model?
The document; possibly a database.
One; zero to many
Interface; Implementation
[Object isKindOfClass:[Classname class]]
4. How to tell whether an object implements a particular method? (A line of code)
id
[Class respondsToSelector:@selector(aMethod)]
Argument validation.
Right-click on view - or even a subview like a button.
5. What is the makeup of a CGPoint?
@interface JGEmailLoginEmailViewController(){ NSMutableData _receivedData; }@property (weak -nonatomic) JGAppDelegate appDelegate;@property (weak - nonatomic) IBOutlet UITextField *txtfldEmailAddress;@end
Two CGFloats for x and y
for...in; don't change things inside the loop.
[Object isKindOfClass:[Classname class]]
6. What does a view (UIView) represent?
Import / handle multiple inclusion.
NSSet; no - it's immutable
No...but it has 'a way' to notify the controller to come ask for fresh data.
A rectangular area
7. Why are properties good?
NSDictionary; no - it's immutable.
'Keep this in the heap as long as someone else points to it strongly. If it gets thrown out of the heap - set my pointer to it to nil.'
An outlet.
(1) We can validate (e.g. bounds-check) any sets done by a subclass. (2) We can lazily instantiate - so things only get created if and when they are needed.
8. What is the base class for most objects in the iOS SDK?
[Class respondsToSelector:@selector(aMethod)]
@interface JGEmailLoginEmailViewController(){ NSMutableData _receivedData; }@property (weak -nonatomic) JGAppDelegate appDelegate;@property (weak - nonatomic) IBOutlet UITextField *txtfldEmailAddress;@end
NSObject
Points - to achieve device-independence
9. When is it OK to call drawRect: directly?
Never!
Can handle any language because it uses Unicode.
[Class respondsToSelector:@selector(aMethod)]
Immutable. But there are many methods that take an NSString and returned a modified one. This is fast and preferable to using NSMutableString.
10. If I need to convert a number to an object - use __________
id
One; zero to many
My rectangle in my superview's coordinate space
NSNumber. For example numberWithDouble: and doubleValue:
11. How to do enumeration with NSArray - NSDictionary - etc?
12. When happens when you send a message to nil?
Nothing happens - and nil is returned.
Right-click on view - or even a subview like a button.
@synthesize; write our own getter and/or setter.
Action
13. If a method starts with a dash - it's a ___________. If it starts with a plus sign - it's a ______________.
Wrap it in NSValue. And remember that NSValue immutable.
Introspection - with the class method 'class'
Instance method; class method.
Points - to achieve device-independence
14. What is the iOS term for a library?
Center of the frame - which is in the superview's coordinate system
the controller's minions. Gets things to the screen.
NSDictionary; no - it's immutable.
A framework.
15. Talk about NSString
'Keep this in the heap as long as someone else points to it strongly. If it gets thrown out of the heap - set my pointer to it to nil.'
NSObject
1.) Ask another object to do it - e.g. with mutableCopy. 2.) Call a class method - 3.) [[Classname alloc] init];
Can handle any language because it uses Unicode.
16. How to add subviews in code? How to remove them?
addSubview; removeFromSubview
Don't use id for a pointer. Use the actual type pointed to. It allows the compiler (but not the runtime!) to help find bugs.
The runtime system asks the object what its class is.
UIWindow
17. Where do I initialize properties?
Dash - Plus sign.
UIViewController.
The runtime system asks the object what its class is.
In the getter! This is called lazy instantiation.
18. Talk about BOOL variables.
NSArray; no - it's immutable.
zero/nil
iOS; when the view is loaded.
NO is zero; YES is anything else.
19. What is at the top of the view hierarchy?
[Object isMemberOfClass:[Classname class]]
Interface; Implementation
UIWindow
The document; possibly a database.
20. What if I want to put a scalar into an NSArray or NSSet?
No...but it has 'a way' to notify the controller to come ask for fresh data.
UIViewController.
Creating objects - or finding information relative to the class. The name of the class is the first thing in the square brackets.
Wrap it in NSValue. And remember that NSValue immutable.
21. What is the makeup of a CGRect?
internal origin and size. Use this inside a view
for...in; don't change things inside the loop.
A CGPoint and and a CGSize
self.view
22. What does 'weak' mean?
23. A _______ is how a view notifies the controller of something - for example - a button press.
zero/nil
create a model
NSData
Action
24. Instance methods start with a ______ and class methods start with a ______.
self.view
Dash - Plus sign.
Wrap it in NSValue. And remember that NSValue immutable.
[Class respondsToSelector:@selector(aMethod)]
25. There is no difference between _____ and _______ at runtime.
The document; possibly a database.
id; an object pointer
At runtime.
NSArray; no - it's immutable.
26. What about the model and the view talking to one another?
[Object isMemberOfClass:[Classname class]]
No. Use NSMutableArray - which is a subclass of NSArray.
Action
Never!
27. How to tell whether an object is of a class or class that inherits from that class? (Write a line of code)
A collection of collections in graph form. Can include NSArray - NSDictionary - NSNumber - NSString - NSData - and NSData.
[Object isKindOfClass:[Classname class]]
No - it gets the data from the controller.
Can handle any language because it uses Unicode.
28. What is a property list?
If it's in the header file - it's public. To make some private variables - you can put a private interface section at the top of an implementation file.
A CGPoint and and a CGSize
A collection of collections in graph form. Can include NSArray - NSDictionary - NSNumber - NSString - NSData - and NSData.
Creating objects - or finding information relative to the class. The name of the class is the first thing in the square brackets.
29. The view is...
30. What about controller talking to the model?
Instance variable (ivar) or 'backing variable'
Getter and setter methods.
Points - to achieve device-independence
Yes. The controller knows everything about the model.
31. What is the fundamental design pattern of iOS development?
MVC - for model-view-controller
1.) Ask another object to do it - e.g. with mutableCopy. 2.) Call a class method - 3.) [[Classname alloc] init];
The document; possibly a database.
Never!
32. Does a view 'own' the data it displays?
To zero; so pointers are nil.
No - it gets the data from the controller.
Lazy instantiation.
Designated initializer.
33. Is NSArray mutable?
Creating objects - or finding information relative to the class. The name of the class is the first thing in the square brackets.
No. Use NSMutableArray - which is a subclass of NSArray.
for...in; don't change things inside the loop.
The document; possibly a database.
34. Some controllers have ____________ as their views.
UIViewController.
Other MVC trios.
Outlet; Action
self = [super init] {if init is the designated initializer of the superclass}. If the superclass init routine fails - I will know to return nil from my init routine.
35. How to instantiate an object?
Never!
1.) Ask another object to do it - e.g. with mutableCopy. 2.) Call a class method - 3.) [[Classname alloc] init];
Nothing happens - and nil is returned.
Don't use id for a pointer. Use the actual type pointed to. It allows the compiler (but not the runtime!) to help find bugs.
36. What about the view talking to the controller?
37. How can I find out the class of any object? Give a line of code.
Class XX = [Object class]
Lazy instantiation.
Center of the frame - which is in the superview's coordinate system
id
38. The controller is always a subclass of...?
Lazy instantiation.
Call setNeedsDisplay:
Right-click on view - or even a subview like a button.
UIViewController.
39. What is the center property of a UIView?
40. What is used in lieu of pixels? And why?
NSData
My rectangle in my superview's coordinate space
id; an object pointer
Points - to achieve device-independence
41. How about the model talking to the controller?
42. Remember that it's cool to...
Two floats - for width and height
Interface; Implementation
line up the colons!
Strong. Object memory is freed at the end of the routine.
43. Are local pointers to objects strong or weak? So what happens at the end of the routine?
Class XX = [Object class]
Strong. Object memory is freed at the end of the routine.
Override drawRect:
Yes. As much as it wants.
44. Is NSString mutable or not?
NSDictionary; no - it's immutable.
self
Immutable. But there are many methods that take an NSString and returned a modified one. This is fast and preferable to using NSMutableString.
NSLog; %@; %d and other formatters
45. How to see all actions - outlets - incoming/outgoing segues on a view?
Right-click on view - or even a subview like a button.
Two CGFloats for x and y
self
Instance method; class method.
46. In a nutshell: how to do custom drawing?
Override drawRect:
An outlet.
constant NSString
The document; possibly a database.
47. Class methods are used for ___________ and the call starts with ____________.
self
Creating objects - or finding information relative to the class. The name of the class is the first thing in the square brackets.
A rectangular area
create a model
48. How can I save user information between launches of my app?
option-click; option-double-click
1.) Ask another object to do it - e.g. with mutableCopy. 2.) Call a class method - 3.) [[Classname alloc] init];
Lazy instantiation.
NSUserDefaults - which stores a property list.
49. Calling a method on id works just fine because....?
Creating objects - or finding information relative to the class. The name of the class is the first thing in the square brackets.
NO is zero; YES is anything else.
[Object isMemberOfClass:[Classname class]]
The runtime system asks the object what its class is.
50. The single-view template in Xcode does not...
create a model
Sort of - in ways that it doesn't need to know much about the controller. For example: delegation.
Center of the frame - which is in the superview's coordinate system
NO is zero; YES is anything else.