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?
To zero; so pointers are nil.
No - it gets the data from the controller.
NSNumber. For example numberWithDouble: and doubleValue:
Outlet; Action
2. What is a reason to write our own setter?
A rectangular area
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.
NO is zero; YES is anything else.
Argument validation.
3. The view is...
Warning
: Invalid argument supplied for foreach() in
/var/www/html/basicversity.com/show_quiz.php
on line
183
4. 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
5. What do I use for a bag of bits?
NSData
NO is zero; YES is anything else.
The document; possibly a database.
Instance method; class method.
6. List the iOS hierarchy from top to bottom.
Action
Cocoa Touch - Media - Core Services - Core OS
No. Use NSMutableArray - which is a subclass of NSArray.
self
7. What about the model and the view talking to one another?
Never!
[[UIView alloc] initWithFrame]
Two floats - for width and height
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.
8. How to tell whether an object implements a particular method? (A line of code)
iOS; when the view is loaded.
self
Dash - Plus sign.
[Class respondsToSelector:@selector(aMethod)]
9. Are local pointers to objects strong or weak? So what happens at the end of the routine?
The document; possibly a database.
Instance method; class method.
Strong. Object memory is freed at the end of the routine.
NSUserDefaults - which stores a property list.
10. When is it OK to call drawRect: directly?
for...in; don't change things inside the loop.
MVC - for model-view-controller
Never!
No. It's fine.
11. What about controller talking to the model?
Can handle any language because it uses Unicode.
'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.'
[Object isMemberOfClass:[Classname class]]
Yes. The controller knows everything about the model.
12. The setters for outlets are called by _______ at this point ______________.
iOS; when the view is loaded.
Strongly.
Sort of - in ways that it doesn't need to know much about the controller. For example: delegation.
@interface JGEmailLoginEmailViewController(){ NSMutableData _receivedData; }@property (weak -nonatomic) JGAppDelegate appDelegate;@property (weak - nonatomic) IBOutlet UITextField *txtfldEmailAddress;@end
13. You can send a message to a...
Argument validation.
line up the colons!
constant NSString
Two floats - for width and height
14. Instance methods start with a ______ and class methods start with a ______.
Dash - Plus sign.
addSubview; removeFromSubview
Strong. Object memory is freed at the end of the routine.
Override drawRect:
15. How to access the controller's top view?
Properties; instance variables
NSObject
self
self.view
16. ________ is the .h file and __________ is the .m file.
Call setNeedsDisplay:
Interface; Implementation
[Object isKindOfClass:[Classname class]]
Never!
17. 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
18. How are local variables initialized in iOS 5?
MVC - for model-view-controller
An outlet.
'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.'
To zero; so pointers are nil.
19. How to tell whether an object is of a class or class that inherits from that class? (Write a line of code)
In the getter! This is called lazy instantiation.
[Object isKindOfClass:[Classname class]]
Action
My rectangle in my superview's coordinate space
20. What does 'weak' mean?
Warning
: Invalid argument supplied for foreach() in
/var/www/html/basicversity.com/show_quiz.php
on line
183
21. How can I find out the class of any object? Give a line of code.
Cocoa Touch - Media - Core Services - Core OS
UIViewController.
Class XX = [Object class]
create a model
22. The single-view template in Xcode does not...
create a model
On left side - is calling the setter - and on the right side - is calling the getter.
Cocoa Touch - Media - Core Services - Core OS
'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.'
23. What is an example of a reason to write a getter?
[Object isMemberOfClass:[Classname class]]
Lazy instantiation.
The compiler adds code to count references.
Instance variable (ivar) or 'backing variable'
24. All properties are initialized to _____
zero/nil
The compiler adds code to count references.
Yes. The controller knows everything about the model.
iOS; when the view is loaded.
25. Is NSArray mutable?
No. Use NSMutableArray - which is a subclass of NSArray.
An outlet.
A CGPoint and and a CGSize
Import / handle multiple inclusion.
26. Instead of 'include' statements - in Objective-C we use _______ which does ________
Import / handle multiple inclusion.
Designated initializer.
Other MVC trios.
Dash - Plus sign.
27. Calling a method on id works just fine because....?
The runtime system asks the object what its class is.
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.
An outlet.
Import / handle multiple inclusion.
28. How many superviews does a view have? How many subviews?
Cocoa Touch - Media - Core Services - Core OS
One; zero to many
[[UIView alloc] initWithFrame]
A collection of collections in graph form. Can include NSArray - NSDictionary - NSNumber - NSString - NSData - and NSData.
29. Remember that it's cool to...
(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.
No - it gets the data from the controller.
line up the colons!
self
30. ______ is a pointer
Center of the frame - which is in the superview's coordinate system
for...in; don't change things inside the loop.
self
Cocoa Touch - Media - Core Services - Core OS
31. What does a view (UIView) represent?
@interface JGEmailLoginEmailViewController(){ NSMutableData _receivedData; }@property (weak -nonatomic) JGAppDelegate appDelegate;@property (weak - nonatomic) IBOutlet UITextField *txtfldEmailAddress;@end
Strongly.
'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.'
A rectangular area
32. What to do in Xcode for short documentation? For full documentation?
line up the colons!
UIViewController.
option-click; option-double-click
NSObject
33. Can the controller talking to the view?
NSNumber. For example numberWithDouble: and doubleValue:
Two CGFloats for x and y
create a model
Yes. As much as it wants.
34. Why are properties good?
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
Creating objects - or finding information relative to the class. The name of the class is the first thing in the square brackets.
(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.
35. What is the iOS term for a library?
A framework.
for...in; don't change things inside the loop.
To zero; so pointers are nil.
Cocoa Touch - Media - Core Services - Core OS
36. Classes cannot have _________ or ___________.
Introspection - with the class method 'class'
id
Properties; instance variables
Center of the frame - which is in the superview's coordinate system
37. Talk about NSString
A rectangular area
Can handle any language because it uses Unicode.
NSObject
Class XX = [Object class]
38. 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
39. How to instantiate an object?
NSSet; no - it's immutable
addSubview; removeFromSubview
1.) Ask another object to do it - e.g. with mutableCopy. 2.) Call a class method - 3.) [[Classname alloc] init];
self.view
40. What is static typing? Why is it good?
Warning
: Invalid argument supplied for foreach() in
/var/www/html/basicversity.com/show_quiz.php
on line
183
41. When happens when you send a message to nil?
Properties; instance variables
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.'
A rectangular area
42. If a method starts with a dash - it's a ___________. If it starts with a plus sign - it's a ______________.
A CGPoint and and a CGSize
Designated initializer.
MVC - for model-view-controller
Instance method; class method.
43. ________ implements the getter and setter. But we can always__________
The runtime system asks the object what its class is.
Import / handle multiple inclusion.
Creating objects - or finding information relative to the class. The name of the class is the first thing in the square brackets.
@synthesize; write our own getter and/or setter.
44. Dot notation does what?
1.) Ask another object to do it - e.g. with mutableCopy. 2.) Call a class method - 3.) [[Classname alloc] init];
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.
Cocoa Touch - Media - Core Services - Core OS
On left side - is calling the setter - and on the right side - is calling the getter.
45. 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
46. What do I use for a hash table/associative array? And is it mutable?
Warning
: Invalid argument supplied for foreach() in
/var/www/html/basicversity.com/show_quiz.php
on line
183
47. What is the bounds property of a UIView?
Getter and setter methods.
'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.'
[Object isMemberOfClass:[Classname class]]
internal origin and size. Use this inside a view
48. In the initializer methods of objects I create - add what line of code? Why?
The document; possibly a database.
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.
Import / handle multiple inclusion.
At runtime.
49. What does the controller do?
'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.'
No...but it has 'a way' to notify the controller to come ask for fresh data.
A rectangular area
Controls how the model is presented onscreen.
50. If I need to convert a number to an object - use __________
No. Use NSMutableArray - which is a subclass of NSArray.
No...but it has 'a way' to notify the controller to come ask for fresh data.
NSNumber. For example numberWithDouble: and doubleValue:
constant NSString