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. How to do enumeration with NSArray - NSDictionary - etc?
2. Calling a method on id works just fine because....?
The runtime system asks the object what its class is.
Points - to achieve device-independence
NSObject
On left side - is calling the setter - and on the right side - is calling the getter.
3. ______ is a pointer
self
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.
the controller's minions. Gets things to the screen.
Cocoa Touch - Media - Core Services - Core OS
4. All properties are initialized to _____
option-click; option-double-click
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.
'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.
zero/nil
5. Why are properties good?
UIViewController.
(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.
Properties; instance variables
Instance method; class method.
6. The single-view template in Xcode does not...
[Object isKindOfClass:[Classname class]]
A rectangular area
create a model
id; an object pointer
7. How is ARC done?
Introspection - with the class method 'class'
The compiler adds code to count references.
The runtime system asks the object what its class is.
Nothing happens - and nil is returned.
8. In a nutshell: how to do custom drawing?
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.
Override drawRect:
A rectangular area
Lazy instantiation.
9. Classes cannot have _________ or ___________.
'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.'
create a model
Properties; instance variables
Introspection - with the class method 'class'
10. You can send a message to a...
id; an object pointer
constant NSString
Sort of - in ways that it doesn't need to know much about the controller. For example: delegation.
addSubview; removeFromSubview
11. What is the makeup of a CGPoint?
Two CGFloats for x and y
line up the colons!
'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.
self.view
12. Is it always bad to send messages to id?
13. What about the model and the view talking to one another?
Cocoa Touch - Media - Core Services - Core OS
Nothing happens - and nil is returned.
Never!
Call setNeedsDisplay:
14. In synthesize: @synthesize foo = _foo; The __foo_ is the ____________ or also known as the ___________________.
15. The basic steps in custom drawing.
Getter and setter methods.
An outlet.
NSData
1) Create a context 2) Create paths 3) Set colors - fonts - widths 4) Stroke or fill the above-created paths.
16. What is a property list?
Action
A collection of collections in graph form. Can include NSArray - NSDictionary - NSNumber - NSString - NSData - and NSData.
Class XX = [Object class]
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.
17. Instance methods start with a ______ and class methods start with a ______.
Call setNeedsDisplay:
Dash - Plus sign.
Import / handle multiple inclusion.
Two CGFloats for x and y
18. All classes should have a __________________ to be called by subclasses.
Designated initializer.
The compiler adds code to count references.
A framework.
Center of the frame - which is in the superview's coordinate system
19. What is the bounds property of a UIView?
Designated initializer.
NSUserDefaults - which stores a property list.
internal origin and size. Use this inside a view
Creating objects - or finding information relative to the class. The name of the class is the first thing in the square brackets.
20. What is the base class for most objects in the iOS SDK?
The document; possibly a database.
NSNumber. For example numberWithDouble: and doubleValue:
NSObject
Class XX = [Object class]
21. What is the iOS term for a library?
NSObject
A framework.
zero/nil
Can handle any language because it uses Unicode.
22. Where do I initialize properties?
In the getter! This is called lazy instantiation.
NSNumber. For example numberWithDouble: and doubleValue:
NSLog; %@; %d and other formatters
1.) Ask another object to do it - e.g. with mutableCopy. 2.) Call a class method - 3.) [[Classname alloc] init];
23. Is NSString mutable or not?
Immutable. But there are many methods that take an NSString and returned a modified one. This is fast and preferable to using NSMutableString.
Creating objects - or finding information relative to the class. The name of the class is the first thing in the square brackets.
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.
id
24. How to add subviews in code? How to remove them?
addSubview; removeFromSubview
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.
id; an object pointer
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.
25. What is the name of a property in the controller that it uses to talk to views?
An outlet.
Introspection - with the class method 'class'
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.
At runtime.
26. What is the fundamental design pattern of iOS development?
MVC - for model-view-controller
internal origin and size. Use this inside a view
Sort of - in ways that it doesn't need to know much about the controller. For example: delegation.
A collection of collections in graph form. Can include NSArray - NSDictionary - NSNumber - NSString - NSData - and NSData.
27. Class methods are used for ___________ and the call starts with ____________.
Creating objects - or finding information relative to the class. The name of the class is the first thing in the square brackets.
1.) Ask another object to do it - e.g. with mutableCopy. 2.) Call a class method - 3.) [[Classname alloc] init];
Wrap it in NSValue. And remember that NSValue immutable.
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.
28. How many superviews does a view have? How many subviews?
One; zero to many
Designated initializer.
Cocoa Touch - Media - Core Services - Core OS
line up the colons!
29. Does a view 'own' the data it displays?
Getter and setter methods.
At runtime.
Can handle any language because it uses Unicode.
No - it gets the data from the controller.
30. How are local variables initialized in iOS 5?
To zero; so pointers are nil.
for...in; don't change things inside the loop.
addSubview; removeFromSubview
Cocoa Touch - Media - Core Services - Core OS
31. What is the center property of a UIView?
32. Use ______ to send debugging messages to the console. Use _____ for any object - which should return an string. Can also use ______.
No...but it has 'a way' to notify the controller to come ask for fresh data.
[Class respondsToSelector:@selector(aMethod)]
Strong. Object memory is freed at the end of the routine.
NSLog; %@; %d and other formatters
33. What do I use for a bag of bits?
NSData
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.
MVC - for model-view-controller
34. If I need to convert a number to an object - use __________
NSNumber. For example numberWithDouble: and doubleValue:
1.) Ask another object to do it - e.g. with mutableCopy. 2.) Call a class method - 3.) [[Classname alloc] init];
Interface; Implementation
[[UIView alloc] initWithFrame]
35. Instead of 'include' statements - in Objective-C we use _______ which does ________
option-click; option-double-click
self
Argument validation.
Import / handle multiple inclusion.
36. Can the controller talking to the view?
The document; possibly a database.
NSDictionary; no - it's immutable.
Override drawRect:
Yes. As much as it wants.
37. The decision on what method to call is made when?
At runtime.
NSArray; no - it's immutable.
Properties; instance variables
Strongly.
38. What do I use for an ordered collection of objects? And is it mutable?
39. ________ is the .h file and __________ is the .m file.
My rectangle in my superview's coordinate space
Class XX = [Object class]
Interface; Implementation
[Object isMemberOfClass:[Classname class]]
40. A _______ goes from the Controller to the View. A ________ goes from the view to the controller.
Outlet; Action
Center of the frame - which is in the superview's coordinate system
Lazy instantiation.
constant NSString
41. ________ implements the getter and setter. But we can always__________
Lazy instantiation.
@synthesize; write our own getter and/or setter.
Getter and setter methods.
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.
42. Talk about BOOL variables.
id; an object pointer
Import / handle multiple inclusion.
Action
NO is zero; YES is anything else.
43. Remember that it's cool to...
'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.
Immutable. But there are many methods that take an NSString and returned a modified one. This is fast and preferable to using NSMutableString.
Lazy instantiation.
line up the colons!
44. What if I want to put a scalar into an NSArray or NSSet?
constant NSString
Import / handle multiple inclusion.
Wrap it in NSValue. And remember that NSValue immutable.
NSData
45. A property is just the combination of _______.
self
Outlet; Action
NSDictionary; no - it's immutable.
Getter and setter methods.
46. What does a view (UIView) represent?
option-click; option-double-click
The compiler adds code to count references.
No - it gets the data from the controller.
A rectangular area
47. How to tell whether an object implements a particular method? (A line of code)
Can handle any language because it uses Unicode.
A collection of collections in graph form. Can include NSArray - NSDictionary - NSNumber - NSString - NSData - and NSData.
[Class respondsToSelector:@selector(aMethod)]
Interface; Implementation
48. Is NSArray mutable?
[Object isKindOfClass:[Classname class]]
for...in; don't change things inside the loop.
NSData
No. Use NSMutableArray - which is a subclass of NSArray.
49. What is a reason to write our own setter?
Nothing happens - and nil is returned.
Argument validation.
At runtime.
iOS; when the view is loaded.
50. What about controller talking to the model?
id
addSubview; removeFromSubview
MVC - for model-view-controller
Yes. The controller knows everything about the model.