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. What about the view talking to the controller?
2. Talk about BOOL variables.
UIWindow
NSData
Yes. The controller knows everything about the model.
NO is zero; YES is anything else.
3. What if I want to put a scalar into an NSArray or NSSet?
(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.
Instance method; class method.
Other MVC trios.
Wrap it in NSValue. And remember that NSValue immutable.
4. Talk about NSString
Override drawRect:
MVC - for model-view-controller
Can handle any language because it uses Unicode.
Introspection - with the class method 'class'
5. ________ implements the getter and setter. But we can always__________
internal origin and size. Use this inside a view
Controls how the model is presented onscreen.
@synthesize; write our own getter and/or setter.
'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.'
6. How to access the controller's top view?
self.view
Outlet; Action
NSDictionary; no - it's immutable.
zero/nil
7. Use ______ to send debugging messages to the console. Use _____ for any object - which should return an string. Can also use ______.
A collection of collections in graph form. Can include NSArray - NSDictionary - NSNumber - NSString - NSData - and NSData.
Can handle any language because it uses Unicode.
NSLog; %@; %d and other formatters
Argument validation.
8. What is used in lieu of pixels? And why?
Properties; instance variables
No. Use NSMutableArray - which is a subclass of NSArray.
Points - to achieve device-independence
Action
9. You can send a message to a...
Instance variable (ivar) or 'backing variable'
constant NSString
[Object isMemberOfClass:[Classname class]]
NSDictionary; no - it's immutable.
10. All classes should have a __________________ to be called by subclasses.
NSNumber. For example numberWithDouble: and doubleValue:
self
Designated initializer.
Instance variable (ivar) or 'backing variable'
11. Where do I initialize properties?
In the getter! This is called lazy instantiation.
The document; possibly a database.
No. Use NSMutableArray - which is a subclass of NSArray.
Immutable. But there are many methods that take an NSString and returned a modified one. This is fast and preferable to using NSMutableString.
12. The basic steps in custom drawing.
Class XX = [Object class]
Two CGFloats for x and y
1) Create a context 2) Create paths 3) Set colors - fonts - widths 4) Stroke or fill the above-created paths.
Never!
13. Why are properties good?
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.
(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.
constant NSString
id; an object pointer
14. Does a view 'own' the data it displays?
No - it gets the data from the controller.
Creating objects - or finding information relative to the class. The name of the class is the first thing in the square brackets.
line up the colons!
Class XX = [Object class]
15. How is ARC done?
create a model
The document; possibly a database.
Designated initializer.
The compiler adds code to count references.
16. What to do in Xcode for short documentation? For full documentation?
An outlet.
option-click; option-double-click
Controls how the model is presented onscreen.
Properties; instance variables
17. A _______ is how a view notifies the controller of something - for example - a button press.
1) Create a context 2) Create paths 3) Set colors - fonts - widths 4) Stroke or fill the above-created paths.
Getter and setter methods.
Dash - Plus sign.
Action
18. What is the makeup of a CGPoint?
Right-click on view - or even a subview like a button.
Controls how the model is presented onscreen.
'Keep this in the heap until I don't point to anymore.' I won't point to it anymore if I set my pointer to nil - or if I am removed from the heap because no one points strongly to me.
Two CGFloats for x and y
19. How to force a redraw of a custom area?
Creating objects - or finding information relative to the class. The name of the class is the first thing in the square brackets.
Call setNeedsDisplay:
@interface JGEmailLoginEmailViewController(){ NSMutableData _receivedData; }@property (weak -nonatomic) JGAppDelegate appDelegate;@property (weak - nonatomic) IBOutlet UITextField *txtfldEmailAddress;@end
Override drawRect:
20. What is a reason to write our own setter?
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.
create a model
id
Argument validation.
21. Some controllers have ____________ as their views.
Can handle any language because it uses Unicode.
Other MVC trios.
A framework.
Lazy instantiation.
22. What about the model and the view talking to one another?
[Object isKindOfClass:[Classname class]]
MVC - for model-view-controller
Strong. Object memory is freed at the end of the routine.
Never!
23. Show a private interface section.
No...but it has 'a way' to notify the controller to come ask for fresh data.
@interface JGEmailLoginEmailViewController(){ NSMutableData _receivedData; }@property (weak -nonatomic) JGAppDelegate appDelegate;@property (weak - nonatomic) IBOutlet UITextField *txtfldEmailAddress;@end
UIWindow
'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.'
24. Instead of 'include' statements - in Objective-C we use _______ which does ________
No...but it has 'a way' to notify the controller to come ask for fresh data.
NSData
Nothing happens - and nil is returned.
Import / handle multiple inclusion.
25. How to tell whether an object implements a particular method? (A line of code)
for...in; don't change things inside the loop.
NSObject
@interface JGEmailLoginEmailViewController(){ NSMutableData _receivedData; }@property (weak -nonatomic) JGAppDelegate appDelegate;@property (weak - nonatomic) IBOutlet UITextField *txtfldEmailAddress;@end
[Class respondsToSelector:@selector(aMethod)]
26. ________ is the .h file and __________ is the .m file.
Interface; Implementation
A collection of collections in graph form. Can include NSArray - NSDictionary - NSNumber - NSString - NSData - and NSData.
Never!
NSSet; no - it's immutable
27. What do I use for an ordered collection of objects? And is it mutable?
28. How to create a UIView in code?
[[UIView alloc] initWithFrame]
The compiler adds code to count references.
UIWindow
Nothing happens - and nil is returned.
29. Can the controller talking to the view?
Instance variable (ivar) or 'backing variable'
Two CGFloats for x and y
No...but it has 'a way' to notify the controller to come ask for fresh data.
Yes. As much as it wants.
30. ______ is a pointer to any object.
addSubview; removeFromSubview
id
[[UIView alloc] initWithFrame]
A CGPoint and and a CGSize
31. When is it OK to call drawRect: directly?
The document; possibly a database.
Nothing happens - and nil is returned.
The compiler adds code to count references.
Never!
32. How to instantiate an object?
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.
Never!
1.) Ask another object to do it - e.g. with mutableCopy. 2.) Call a class method - 3.) [[Classname alloc] init];
The compiler adds code to count references.
33. If a method starts with a dash - it's a ___________. If it starts with a plus sign - it's a ______________.
(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.
UIWindow
UIViewController.
Instance method; class method.
34. A property is just the combination of _______.
Getter and setter methods.
Controls how the model is presented onscreen.
Can handle any language because it uses Unicode.
1) Create a context 2) Create paths 3) Set colors - fonts - widths 4) Stroke or fill the above-created paths.
35. Is it always bad to send messages to id?
36. How to add subviews in code? How to remove them?
@interface JGEmailLoginEmailViewController(){ NSMutableData _receivedData; }@property (weak -nonatomic) JGAppDelegate appDelegate;@property (weak - nonatomic) IBOutlet UITextField *txtfldEmailAddress;@end
addSubview; removeFromSubview
Right-click on view - or even a subview like a button.
A framework.
37. Is NSArray mutable?
Strong. Object memory is freed at the end of the routine.
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.
No. Use NSMutableArray - which is a subclass of NSArray.
Sort of - in ways that it doesn't need to know much about the controller. For example: delegation.
38. How to do enumeration with NSArray - NSDictionary - etc?
39. How can I save user information between launches of my app?
In the getter! This is called lazy instantiation.
NSUserDefaults - which stores a property list.
No. Use NSMutableArray - which is a subclass of NSArray.
[Object isMemberOfClass:[Classname class]]
40. How to tell if an object is of a particular class? (Write a line of code)
Outlet; Action
line up the colons!
[Object isMemberOfClass:[Classname class]]
Dash - Plus sign.
41. What is the name of a property in the controller that it uses to talk to views?
An outlet.
A rectangular area
(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.
'Keep this in the heap until I don't point to anymore.' I won't point to it anymore if I set my pointer to nil - or if I am removed from the heap because no one points strongly to me.
42. The view is...
43. When happens when you send a message to nil?
Strong. Object memory is freed at the end of the routine.
@synthesize; write our own getter and/or setter.
Nothing happens - and nil is returned.
Right-click on view - or even a subview like a button.
44. What is an example of a reason to write a getter?
(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.
Interface; Implementation
Lazy instantiation.
create a model
45. Instance methods start with a ______ and class methods start with a ______.
Instance method; class method.
Class XX = [Object class]
Dash - Plus sign.
constant NSString
46. How many superviews does a view have? How many subviews?
A collection of collections in graph form. Can include NSArray - NSDictionary - NSNumber - NSString - NSData - and NSData.
Argument validation.
Wrap it in NSValue. And remember that NSValue immutable.
One; zero to many
47. The controller is always a subclass of...?
iOS; when the view is loaded.
UIViewController.
zero/nil
'Keep this in the heap until I don't point to anymore.' I won't point to it anymore if I set my pointer to nil - or if I am removed from the heap because no one points strongly to me.
48. There is no difference between _____ and _______ at runtime.
id
@interface JGEmailLoginEmailViewController(){ NSMutableData _receivedData; }@property (weak -nonatomic) JGAppDelegate appDelegate;@property (weak - nonatomic) IBOutlet UITextField *txtfldEmailAddress;@end
id; an object pointer
Center of the frame - which is in the superview's coordinate system
49. Objects in an array: are the pointed to strongly or weakly?
Strongly.
Dash - Plus sign.
Creating objects - or finding information relative to the class. The name of the class is the first thing in the square brackets.
Yes. As much as it wants.
50. In a nutshell: how to do custom drawing?
The compiler adds code to count references.
Override drawRect:
Wrap it in NSValue. And remember that NSValue immutable.
Immutable. But there are many methods that take an NSString and returned a modified one. This is fast and preferable to using NSMutableString.