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 if I want to put a scalar into an NSArray or NSSet?
The document; possibly a database.
[Object isKindOfClass:[Classname class]]
create a model
Wrap it in NSValue. And remember that NSValue immutable.
2. Does a view 'own' the data it displays?
Two floats - for width and height
No - it gets the data from the controller.
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.
Sort of - in ways that it doesn't need to know much about the controller. For example: delegation.
3. What is an example of a reason to write a getter?
'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.'
Lazy instantiation.
for...in; don't change things inside the loop.
NSDictionary; no - it's immutable.
4. What is the center property of a UIView?
Warning
: Invalid argument supplied for foreach() in
/var/www/html/basicversity.com/show_quiz.php
on line
183
5. What about controller talking to the model?
The compiler adds code to count references.
NO is zero; YES is anything else.
Yes. The controller knows everything about the model.
Other MVC trios.
6. Show a private interface section.
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.
NSSet; no - it's immutable
@interface JGEmailLoginEmailViewController(){ NSMutableData _receivedData; }@property (weak -nonatomic) JGAppDelegate appDelegate;@property (weak - nonatomic) IBOutlet UITextField *txtfldEmailAddress;@end
Import / handle multiple inclusion.
7. Classes cannot have _________ or ___________.
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.
Yes. As much as it wants.
self.view
Properties; instance variables
8. How to force a redraw of a custom area?
Two CGFloats for x and y
Cocoa Touch - Media - Core Services - Core OS
Call setNeedsDisplay:
No. It's fine.
9. What is the name of a property in the controller that it uses to talk to views?
No. It's fine.
No...but it has 'a way' to notify the controller to come ask for fresh data.
Import / handle multiple inclusion.
An outlet.
10. How is ARC done?
Class XX = [Object class]
NSDictionary; no - it's immutable.
self.view
The compiler adds code to count references.
11. How many superviews does a view have? How many subviews?
Strong. Object memory is freed at the end of the routine.
[Class respondsToSelector:@selector(aMethod)]
One; zero to many
(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.
12. Is it always bad to send messages to id?
Warning
: Invalid argument supplied for foreach() in
/var/www/html/basicversity.com/show_quiz.php
on line
183
13. If I need to convert a number to an object - use __________
Class XX = [Object class]
Interface; Implementation
NSArray; no - it's immutable.
NSNumber. For example numberWithDouble: and doubleValue:
14. What about the view talking to the controller?
Warning
: Invalid argument supplied for foreach() in
/var/www/html/basicversity.com/show_quiz.php
on line
183
15. How to tell whether an object is of a class or class that inherits from that class? (Write a line of code)
[Object isKindOfClass:[Classname class]]
@synthesize; write our own getter and/or setter.
1.) Ask another object to do it - e.g. with mutableCopy. 2.) Call a class method - 3.) [[Classname alloc] init];
A framework.
16. If a method starts with a dash - it's a ___________. If it starts with a plus sign - it's a ______________.
Call setNeedsDisplay:
addSubview; removeFromSubview
On left side - is calling the setter - and on the right side - is calling the getter.
Instance method; class method.
17. In the initializer methods of objects I create - add what line of code? Why?
addSubview; removeFromSubview
Nothing happens - and nil is returned.
An outlet.
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.
18. Where do I initialize properties?
A CGPoint and and a CGSize
UIWindow
UIViewController.
In the getter! This is called lazy instantiation.
19. How to add subviews in code? How to remove them?
addSubview; removeFromSubview
Strong. Object memory is freed at the end of the routine.
Center of the frame - which is in the superview's coordinate system
self
20. What is the makeup of a CGRect?
Two CGFloats for x and y
self.view
A CGPoint and and a CGSize
The runtime system asks the object what its class is.
21. What do I use for an unordered collection - e.g. test for membership? And is it mutable?
Warning
: Invalid argument supplied for foreach() in
/var/www/html/basicversity.com/show_quiz.php
on line
183
22. ______ is a pointer
NSData
Override drawRect:
self
1) Create a context 2) Create paths 3) Set colors - fonts - widths 4) Stroke or fill the above-created paths.
23. How are local variables initialized in iOS 5?
To zero; so pointers are nil.
constant NSString
iOS; when the view is loaded.
A collection of collections in graph form. Can include NSArray - NSDictionary - NSNumber - NSString - NSData - and NSData.
24. How to do enumeration with NSArray - NSDictionary - etc?
Warning
: Invalid argument supplied for foreach() in
/var/www/html/basicversity.com/show_quiz.php
on line
183
25. All classes should have a __________________ to be called by subclasses.
A CGPoint and and a CGSize
Argument validation.
Designated initializer.
Override drawRect:
26. Some controllers have ____________ as their views.
Lazy instantiation.
Other MVC trios.
One; zero to many
iOS; when the view is loaded.
27. What does 'strong' mean?
Warning
: Invalid argument supplied for foreach() in
/var/www/html/basicversity.com/show_quiz.php
on line
183
28. Calling a method on id works just fine because....?
iOS; when the view is loaded.
The runtime system asks the object what its class is.
A collection of collections in graph form. Can include NSArray - NSDictionary - NSNumber - NSString - NSData - and NSData.
NO is zero; YES is anything else.
29. What is used in lieu of pixels? And why?
Points - to achieve device-independence
[[UIView alloc] initWithFrame]
Override drawRect:
Never!
30. What is a reason to write our own setter?
@interface JGEmailLoginEmailViewController(){ NSMutableData _receivedData; }@property (weak -nonatomic) JGAppDelegate appDelegate;@property (weak - nonatomic) IBOutlet UITextField *txtfldEmailAddress;@end
NSNumber. For example numberWithDouble: and doubleValue:
Never!
Argument validation.
31. ________ implements the getter and setter. But we can always__________
Instance variable (ivar) or 'backing variable'
@synthesize; write our own getter and/or setter.
the controller's minions. Gets things to the screen.
line up the colons!
32. A property is just the combination of _______.
The runtime system asks the object what its class is.
[[UIView alloc] initWithFrame]
id; an object pointer
Getter and setter methods.
33. What is the frame property of a UIView?
Warning
: Invalid argument supplied for foreach() in
/var/www/html/basicversity.com/show_quiz.php
on line
183
34. The controller is always a subclass of...?
NO is zero; YES is anything else.
UIViewController.
@interface JGEmailLoginEmailViewController(){ NSMutableData _receivedData; }@property (weak -nonatomic) JGAppDelegate appDelegate;@property (weak - nonatomic) IBOutlet UITextField *txtfldEmailAddress;@end
1.) Ask another object to do it - e.g. with mutableCopy. 2.) Call a class method - 3.) [[Classname alloc] init];
35. All properties are initialized to _____
Override drawRect:
No. It's fine.
The compiler adds code to count references.
zero/nil
36. You can send a message to a...
Controls how the model is presented onscreen.
MVC - for model-view-controller
constant NSString
Never!
37. What to do in Xcode for short documentation? For full documentation?
No...but it has 'a way' to notify the controller to come ask for fresh data.
NO is zero; YES is anything else.
option-click; option-double-click
Yes. The controller knows everything about the model.
38. What do I use for an ordered collection of objects? And is it mutable?
Warning
: Invalid argument supplied for foreach() in
/var/www/html/basicversity.com/show_quiz.php
on line
183
39. What is the iOS term for a library?
A framework.
1.) Ask another object to do it - e.g. with mutableCopy. 2.) Call a class method - 3.) [[Classname alloc] init];
constant NSString
create a model
40. Instance methods start with a ______ and class methods start with a ______.
Strongly.
Dash - Plus sign.
UIViewController.
An outlet.
41. What is the fundamental design pattern of iOS development?
id
self.view
MVC - for model-view-controller
[Object isKindOfClass:[Classname class]]
42. Use ______ to send debugging messages to the console. Use _____ for any object - which should return an string. Can also use ______.
NSLog; %@; %d and other formatters
At runtime.
1) Create a context 2) Create paths 3) Set colors - fonts - widths 4) Stroke or fill the above-created paths.
Call setNeedsDisplay:
43. Dot notation does what?
The compiler adds code to count references.
The document; possibly a database.
zero/nil
On left side - is calling the setter - and on the right side - is calling the getter.
44. The decision on what method to call is made when?
One; zero to many
Immutable. But there are many methods that take an NSString and returned a modified one. This is fast and preferable to using NSMutableString.
Yes. As much as it wants.
At runtime.
45. Class methods are used for ___________ and the call starts with ____________.
Yes. As much as it wants.
At runtime.
Argument validation.
Creating objects - or finding information relative to the class. The name of the class is the first thing in the square brackets.
46. What is the base class for most objects in the iOS SDK?
Immutable. But there are many methods that take an NSString and returned a modified one. This is fast and preferable to using NSMutableString.
UIViewController.
NSObject
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.
47. Is NSArray mutable?
No. Use NSMutableArray - which is a subclass of NSArray.
The document; possibly a database.
Right-click on view - or even a subview like a button.
Sort of - in ways that it doesn't need to know much about the controller. For example: delegation.
48. Remember that it's cool to...
Creating objects - or finding information relative to the class. The name of the class is the first thing in the square brackets.
Interface; Implementation
line up the colons!
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.
49. How to create a UIView in code?
NSLog; %@; %d and other formatters
[[UIView alloc] initWithFrame]
My rectangle in my superview's coordinate space
Argument validation.
50. The basic steps in custom drawing.
Sort of - in ways that it doesn't need to know much about the controller. For example: delegation.
1) Create a context 2) Create paths 3) Set colors - fonts - widths 4) Stroke or fill the above-created paths.
Dash - Plus sign.
Yes. The controller knows everything about the model.