黑马程序员------英语面试问题整理
2015-02-10 20:30
309 查看
------Java培训、Android培训、iOS培训、.Net培训、期待与您交流! -------
Q: Is the delegate for a CAAnimation retained? A: Yes it is!! This is one of the rare exceptions to memory management rules.
Q: What happens when the following code executes?
Ball *ball = [[[[Ball alloc] init] autorelease] autorelease];
A: It will crash because it’s added twice to the autorelease pool and when it dequeued the autorelease pool calls release more than once.
Q: Outline the class hierarchy for a UIButton until NSObject.
A: UIButton inherits from UIControl, UIControl inherits from UIView, UIView inherits from UIResponder, UIResponder inherits from the root class NSObject
Q: Explain the difference between NSOperationQueue concurrent and non-concurrent. A: In the context of an NSOperation object, which runs in an NSOperationQueue, the terms concurrent and non-concurrent do not necessarily refer to the side-by-side execution
of threads. Instead, a non-concurrent operation is one that executes using the environment that is provided for it while a concurrent operation is responsible for setting up its own execution environment.
Q: Implement your own synthesized methods for the property NSString *title. A: Well you would want to implement the getter and setter for the title object. Something like this:
-(NSString *)title{
return title;
}
- (void) setTitle:(NSString*) newTitle{
if (newTitle !=title) {
[title release];
title = [newTitle retain]; / or copy, depending on your needs
}
}
Q: Implement the following methods: retain, release, autorelease.
A:
-(id)retain{
NSIncrementExtraRefCount(self);
retain self;
}
-(void) release {
if (NSDecremetExtraRefCountWasZero(self)) {
NSDeallocateObject(self);
}
}
-(id)auotrelease {
// add the object to the autorelease pool
[NSAutoreleasePool addObject:self];
return self;
}
Q: Is the delegate for a CAAnimation retained? A: Yes it is!! This is one of the rare exceptions to memory management rules.
Q: What happens when the following code executes?
Ball *ball = [[[[Ball alloc] init] autorelease] autorelease];
A: It will crash because it’s added twice to the autorelease pool and when it dequeued the autorelease pool calls release more than once.
Q: Outline the class hierarchy for a UIButton until NSObject.
A: UIButton inherits from UIControl, UIControl inherits from UIView, UIView inherits from UIResponder, UIResponder inherits from the root class NSObject
Q: Explain the difference between NSOperationQueue concurrent and non-concurrent. A: In the context of an NSOperation object, which runs in an NSOperationQueue, the terms concurrent and non-concurrent do not necessarily refer to the side-by-side execution
of threads. Instead, a non-concurrent operation is one that executes using the environment that is provided for it while a concurrent operation is responsible for setting up its own execution environment.
Q: Implement your own synthesized methods for the property NSString *title. A: Well you would want to implement the getter and setter for the title object. Something like this:
-(NSString *)title{
return title;
}
- (void) setTitle:(NSString*) newTitle{
if (newTitle !=title) {
[title release];
title = [newTitle retain]; / or copy, depending on your needs
}
}
Q: Implement the following methods: retain, release, autorelease.
A:
-(id)retain{
NSIncrementExtraRefCount(self);
retain self;
}
-(void) release {
if (NSDecremetExtraRefCountWasZero(self)) {
NSDeallocateObject(self);
}
}
-(id)auotrelease {
// add the object to the autorelease pool
[NSAutoreleasePool addObject:self];
return self;
}
相关文章推荐
- 面试英语常见问题
- [面试英语]1,常见的面试问题,2,如何说明离职原因
- .net面试基本问题二 ASP.Net修饰符 (网络整理)
- 六个经典的英语面试问题
- 【英语面试】询问问题篇
- 英语面试常见问题集锦
- 面试英语常见问题,你知怎样回答吗
- 英语面试中五大典型问题及其回答技巧
- 六个经典的英语面试问题
- 六个经典的英语面试问题
- 英语面试常问题库
- [导入]发布本人整理的面试问题大全,为准备找工作的同行们尽一份力!希望大家多补充或回答!
- 发布本人整理的面试问题大全,为准备找工作的同行们尽一份力!希望大家多补充或回答!
- .net面试基本问题一 ASP.Net七大内置对象 (网络整理)
- 英语面试中五大典型问题及其回答技巧
- [面试英语]1,常见的面试问题,2,如何说明离职原因
- 六个经典的英语面试问题
- [导入]发布本人整理的面试问题大全,为准备找工作的同行们尽一份力!希望大家多补充或回答!
- .net面试基本问题四 ASP.Net页面事件执行顺序 (网络整理)
- 面试中出现频率较高的英语问题及精彩回答