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 controller talking to the model?
NSData
Yes. The controller knows everything about the model.
Interface; Implementation
self.view
2. 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
3. Is NSArray mutable?
constant NSString
In the getter! This is called lazy instantiation.
Never!
No. Use NSMutableArray - which is a subclass of NSArray.
4. What is the fundamental design pattern of iOS development?
[Object isKindOfClass:[Classname class]]
NSNumber. For example numberWithDouble: and doubleValue:
MVC - for model-view-controller
(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.
5. What is the base class for most objects in the iOS SDK?
'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
Can handle any language because it uses Unicode.
Two floats - for width and height
6. Classes cannot have _________ or ___________.
Introspection - with the class method 'class'
Properties; instance variables
One; zero to many
Points - to achieve device-independence
7. The setters for outlets are called by _______ at this point ______________.
Two CGFloats for x and y
Yes. The controller knows everything about the model.
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.
iOS; when the view is loaded.
8. ______ is a pointer
UIWindow
self
(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.
zero/nil
9. What does 'strong' mean?
Warning
: Invalid argument supplied for foreach() in
/var/www/html/basicversity.com/show_quiz.php
on line
183
10. You can send a message to a...
constant NSString
self
[Object isMemberOfClass:[Classname class]]
iOS; when the view is loaded.
11. ________ implements the getter and setter. But we can always__________
(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.
self.view
@synthesize; write our own getter and/or setter.
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.
12. In the initializer methods of objects I create - add what line of code? Why?
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.
NSData
1.) Ask another object to do it - e.g. with mutableCopy. 2.) Call a class method - 3.) [[Classname alloc] init];
@synthesize; write our own getter and/or setter.
13. What about public/private in Objective-C?
Warning
: Invalid argument supplied for foreach() in
/var/www/html/basicversity.com/show_quiz.php
on line
183
14. How is ARC done?
The compiler adds code to count references.
The runtime system asks the object what its class is.
Sort of - in ways that it doesn't need to know much about the controller. For example: delegation.
Points - to achieve device-independence
15. A _______ goes from the Controller to the View. A ________ goes from the view to the controller.
Outlet; Action
Points - to achieve device-independence
The document; possibly a database.
[[UIView alloc] initWithFrame]
16. How about the model talking to the controller?
Warning
: Invalid argument supplied for foreach() in
/var/www/html/basicversity.com/show_quiz.php
on line
183
17. How to create a UIView in code?
No. It's fine.
line up the colons!
[[UIView alloc] initWithFrame]
Outlet; Action
18. What is the word for checking/verifying the type of an object?
Warning
: Invalid argument supplied for foreach() in
/var/www/html/basicversity.com/show_quiz.php
on line
183
19. How to access the controller's top view?
Instance method; class method.
self.view
Points - to achieve device-independence
[Object isMemberOfClass:[Classname class]]
20. 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.
option-click; option-double-click
No...but it has 'a way' to notify the controller to come ask for fresh data.
21. 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
22. Objects in an array: are the pointed to strongly or weakly?
Call setNeedsDisplay:
Strongly.
constant NSString
At runtime.
23. All properties are initialized to _____
zero/nil
Can handle any language because it uses Unicode.
NSDictionary; no - it's immutable.
iOS; when the view is loaded.
24. How to tell if an object is of a particular class? (Write a line of code)
Getter and setter methods.
In the getter! This is called lazy instantiation.
NSNumber. For example numberWithDouble: and doubleValue:
[Object isMemberOfClass:[Classname class]]
25. What is the makeup of a CGSize?
Right-click on view - or even a subview like a button.
Two floats - for width and height
Properties; instance variables
My rectangle in my superview's coordinate space
26. 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
27. Show a private interface section.
[Object isKindOfClass:[Classname class]]
Other MVC trios.
@interface JGEmailLoginEmailViewController(){ NSMutableData _receivedData; }@property (weak -nonatomic) JGAppDelegate appDelegate;@property (weak - nonatomic) IBOutlet UITextField *txtfldEmailAddress;@end
A CGPoint and and a CGSize
28. Dot notation does what?
self.view
Strongly.
On left side - is calling the setter - and on the right side - is calling the getter.
[Object isKindOfClass:[Classname class]]
29. ______ is a pointer to any object.
Yes. As much as it wants.
NSData
No - it gets the data from the controller.
id
30. When is it OK to call drawRect: directly?
To zero; so pointers are nil.
self.view
Wrap it in NSValue. And remember that NSValue immutable.
Never!
31. How can I save user information between launches of my app?
No. It's fine.
NSUserDefaults - which stores a property list.
Outlet; Action
No. Use NSMutableArray - which is a subclass of NSArray.
32. What is the makeup of a CGRect?
Lazy instantiation.
NSDictionary; no - it's immutable.
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.
33. Class methods are used for ___________ and the call starts with ____________.
Getter and setter methods.
Creating objects - or finding information relative to the class. The name of the class is the first thing in the square brackets.
My rectangle in my superview's coordinate space
On left side - is calling the setter - and on the right side - is calling the getter.
34. Does a view 'own' the data it displays?
Controls how the model is presented onscreen.
No - it gets the data from the controller.
The compiler adds code to count references.
Wrap it in NSValue. And remember that NSValue immutable.
35. What if I want to put a scalar into an NSArray or NSSet?
Other MVC trios.
Wrap it in NSValue. And remember that NSValue immutable.
@synthesize; write our own getter and/or setter.
NSLog; %@; %d and other formatters
36. When happens when you send a message to nil?
NSSet; no - it's immutable
NSNumber. For example numberWithDouble: and doubleValue:
Nothing happens - and nil is returned.
'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.'
37. In a nutshell: how to do custom drawing?
create a model
zero/nil
Override drawRect:
@interface JGEmailLoginEmailViewController(){ NSMutableData _receivedData; }@property (weak -nonatomic) JGAppDelegate appDelegate;@property (weak - nonatomic) IBOutlet UITextField *txtfldEmailAddress;@end
38. A property is just the combination of _______.
Getter and setter methods.
One; zero to many
Outlet; Action
Points - to achieve device-independence
39. How many superviews does a view have? How many subviews?
Call setNeedsDisplay:
NSSet; no - it's immutable
One; zero to many
Yes. As much as it wants.
40. How to see all actions - outlets - incoming/outgoing segues on a view?
Right-click on view - or even a subview like a button.
Override drawRect:
UIViewController.
Wrap it in NSValue. And remember that NSValue immutable.
41. List the iOS hierarchy from top to bottom.
Cocoa Touch - Media - Core Services - Core OS
[Object isMemberOfClass:[Classname class]]
Class XX = [Object class]
Introspection - with the class method 'class'
42. How to tell whether an object is of a class or class that inherits from that class? (Write a line of code)
iOS; when the view is loaded.
Properties; instance variables
MVC - for model-view-controller
[Object isKindOfClass:[Classname class]]
43. The basic steps in custom drawing.
Yes. The controller knows everything about the model.
1) Create a context 2) Create paths 3) Set colors - fonts - widths 4) Stroke or fill the above-created paths.
Dash - Plus sign.
A CGPoint and and a CGSize
44. How to tell whether an object implements a particular method? (A line of code)
'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.'
Immutable. But there are many methods that take an NSString and returned a modified one. This is fast and preferable to using NSMutableString.
[Class respondsToSelector:@selector(aMethod)]
iOS; when the view is loaded.
45. Are local pointers to objects strong or weak? So what happens at the end of the routine?
Strong. Object memory is freed at the end of the routine.
'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.'
NSNumber. For example numberWithDouble: and doubleValue:
Designated initializer.
46. What is a property list?
Two floats - for width and height
A collection of collections in graph form. Can include NSArray - NSDictionary - NSNumber - NSString - NSData - and NSData.
Controls how the model is presented onscreen.
One; zero to many
47. How to force a redraw of a custom area?
NSLog; %@; %d and other formatters
NSData
Call setNeedsDisplay:
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.
48. What is in the model?
iOS; when the view is loaded.
On left side - is calling the setter - and on the right side - is calling the getter.
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.
49. The controller is always a subclass of...?
addSubview; removeFromSubview
The document; possibly a database.
iOS; when the view is loaded.
UIViewController.
50. 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