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. Does a view 'own' the data it displays?
NSDictionary; no - it's immutable.
option-click; option-double-click
No - it gets the data from the controller.
@interface JGEmailLoginEmailViewController(){ NSMutableData _receivedData; }@property (weak -nonatomic) JGAppDelegate appDelegate;@property (weak - nonatomic) IBOutlet UITextField *txtfldEmailAddress;@end
2. What is the center property of a UIView?
3. Talk about BOOL variables.
Yes. As much as it wants.
Outlet; Action
NSData
NO is zero; YES is anything else.
4. Classes cannot have _________ or ___________.
A collection of collections in graph form. Can include NSArray - NSDictionary - NSNumber - NSString - NSData - and NSData.
Nothing happens - and nil is returned.
Instance variable (ivar) or 'backing variable'
Properties; instance variables
5. What is at the top of the view hierarchy?
No. Use NSMutableArray - which is a subclass of NSArray.
Lazy instantiation.
zero/nil
UIWindow
6. What is the fundamental design pattern of iOS development?
MVC - for model-view-controller
A rectangular area
NSData
Yes. The controller knows everything about the model.
7. How to do enumeration with NSArray - NSDictionary - etc?
8. If I need to convert a number to an object - use __________
constant NSString
NSNumber. For example numberWithDouble: and doubleValue:
NSLog; %@; %d and other formatters
option-click; option-double-click
9. How to tell whether an object is of a class or class that inherits from that class? (Write a line of code)
1) Create a context 2) Create paths 3) Set colors - fonts - widths 4) Stroke or fill the above-created paths.
The compiler adds code to count references.
[Object isKindOfClass:[Classname class]]
Right-click on view - or even a subview like a button.
10. What is an example of a reason to write a getter?
zero/nil
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.
self
Lazy instantiation.
11. Is NSString mutable or not?
Center of the frame - which is in the superview's coordinate system
[[UIView alloc] initWithFrame]
A CGPoint and and a CGSize
Immutable. But there are many methods that take an NSString and returned a modified one. This is fast and preferable to using NSMutableString.
12. All properties are initialized to _____
Creating objects - or finding information relative to the class. The name of the class is the first thing in the square brackets.
id; an object pointer
zero/nil
Properties; instance variables
13. How to tell whether an object implements a particular method? (A line of code)
1.) Ask another object to do it - e.g. with mutableCopy. 2.) Call a class method - 3.) [[Classname alloc] init];
A framework.
[Class respondsToSelector:@selector(aMethod)]
'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.'
14. How can I find out the class of any object? Give a line of code.
addSubview; removeFromSubview
Class XX = [Object class]
The document; possibly a database.
Sort of - in ways that it doesn't need to know much about the controller. For example: delegation.
15. How to see all actions - outlets - incoming/outgoing segues on a view?
Right-click on view - or even a subview like a button.
Strong. Object memory is freed at the end of the routine.
The document; possibly a database.
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.
16. Why are properties good?
Strongly.
Never!
(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.
Nothing happens - and nil is returned.
17. How is ARC done?
Yes. The controller knows everything about the model.
The document; possibly a database.
Wrap it in NSValue. And remember that NSValue immutable.
The compiler adds code to count references.
18. Use ______ to send debugging messages to the console. Use _____ for any object - which should return an string. Can also use ______.
Nothing happens - and nil is returned.
addSubview; removeFromSubview
NSLog; %@; %d and other formatters
zero/nil
19. How to access the controller's top view?
self.view
No - it gets the data from the controller.
Call setNeedsDisplay:
Immutable. But there are many methods that take an NSString and returned a modified one. This is fast and preferable to using NSMutableString.
20. What is the makeup of a CGPoint?
Two CGFloats for x and y
No - it gets the data from the controller.
1.) Ask another object to do it - e.g. with mutableCopy. 2.) Call a class method - 3.) [[Classname alloc] init];
Action
21. In synthesize: @synthesize foo = _foo; The __foo_ is the ____________ or also known as the ___________________.
22. What is a property list?
No - it gets the data from the controller.
A collection of collections in graph form. Can include NSArray - NSDictionary - NSNumber - NSString - NSData - and NSData.
'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.
Strong. Object memory is freed at the end of the routine.
23. The basic steps in custom drawing.
UIWindow
1) Create a context 2) Create paths 3) Set colors - fonts - widths 4) Stroke or fill the above-created paths.
zero/nil
NSArray; no - it's immutable.
24. What does 'strong' mean?
25. What is in the model?
The document; possibly a database.
Outlet; Action
addSubview; removeFromSubview
internal origin and size. Use this inside a view
26. Class methods are used for ___________ and the call starts with ____________.
Strong. Object memory is freed at the end of the routine.
Yes. As much as it wants.
Creating objects - or finding information relative to the class. The name of the class is the first thing in the square brackets.
option-click; option-double-click
27. All classes should have a __________________ to be called by subclasses.
@synthesize; write our own getter and/or setter.
Designated initializer.
Immutable. But there are many methods that take an NSString and returned a modified one. This is fast and preferable to using NSMutableString.
The compiler adds code to count references.
28. What is a reason to write our own setter?
Argument validation.
To zero; so pointers are nil.
Center of the frame - which is in the superview's coordinate system
self
29. In the initializer methods of objects I create - add what line of code? Why?
self
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.
Instance variable (ivar) or 'backing variable'
No. Use NSMutableArray - which is a subclass of NSArray.
30. What does the controller do?
NO is zero; YES is anything else.
An outlet.
A CGPoint and and a CGSize
Controls how the model is presented onscreen.
31. Instead of 'include' statements - in Objective-C we use _______ which does ________
Import / handle multiple inclusion.
Interface; Implementation
Outlet; Action
Introspection - with the class method 'class'
32. ______ is a pointer to any object.
iOS; when the view is loaded.
id
Outlet; Action
Argument validation.
33. What is the name of a property in the controller that it uses to talk to views?
'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.'
[[UIView alloc] initWithFrame]
An outlet.
Can handle any language because it uses Unicode.
34. ________ is the .h file and __________ is the .m file.
Argument validation.
NSSet; no - it's immutable
the controller's minions. Gets things to the screen.
Interface; Implementation
35. What is used in lieu of pixels? And why?
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.
[Class respondsToSelector:@selector(aMethod)]
Points - to achieve device-independence
NSSet; no - it's immutable
36. ______ is a pointer
Introspection - with the class method 'class'
self
On left side - is calling the setter - and on the right side - is calling the getter.
Getter and setter methods.
37. If a method starts with a dash - it's a ___________. If it starts with a plus sign - it's a ______________.
@interface JGEmailLoginEmailViewController(){ NSMutableData _receivedData; }@property (weak -nonatomic) JGAppDelegate appDelegate;@property (weak - nonatomic) IBOutlet UITextField *txtfldEmailAddress;@end
Lazy instantiation.
Instance method; class method.
NSObject
38. The setters for outlets are called by _______ at this point ______________.
iOS; when the view is loaded.
the controller's minions. Gets things to the screen.
zero/nil
id
39. Are local pointers to objects strong or weak? So what happens at the end of the routine?
The document; possibly a database.
line up the colons!
(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.
Strong. Object memory is freed at the end of the routine.
40. A property is just the combination of _______.
The runtime system asks the object what its class is.
Getter and setter methods.
To zero; so pointers are nil.
Right-click on view - or even a subview like a button.
41. How to add subviews in code? How to remove them?
The document; possibly a database.
self
Sort of - in ways that it doesn't need to know much about the controller. For example: delegation.
addSubview; removeFromSubview
42. What is the base class for most objects in the iOS SDK?
Instance variable (ivar) or 'backing variable'
NSObject
To zero; so pointers are nil.
[Object isKindOfClass:[Classname class]]
43. What do I use for a hash table/associative array? And is it mutable?
44. What does a view (UIView) represent?
UIViewController.
A rectangular area
Other MVC trios.
[[UIView alloc] initWithFrame]
45. A _______ is how a view notifies the controller of something - for example - a button press.
for...in; don't change things inside the loop.
self
NSUserDefaults - which stores a property list.
Action
46. What is the frame property of a UIView?
47. What about the model and the view talking to one another?
Interface; Implementation
No. It's fine.
constant NSString
Never!
48. What is static typing? Why is it good?
49. Calling a method on id works just fine because....?
No. It's fine.
Instance variable (ivar) or 'backing variable'
The runtime system asks the object what its class is.
Other MVC trios.
50. Where do I initialize properties?
MVC - for model-view-controller
In the getter! This is called lazy instantiation.
'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.
@synthesize; write our own getter and/or setter.