收集了一些iOS技术面试题,试试你能通过吗?

收集了一些iOS技术面试题,试试你能通过吗?

以前也看到过这个,自己还试着作答,先贴上来.

1.Difference between shallow copy and deep copy?

答:看了书的351页大概明白了,不过356页还是木有看懂

Foundation类实现了copy和mutableCopy方法,默认执行浅拷贝。

shadow copy:创建对象引用的副本。

deep copy:创建对象内容的副本

(可以写一写代码)

2.What is advantage of categories? What is differencebetween implementing a category and inheritance?

advantage:

1.    可以有很多分类

2.    与一般接口不同的是,不比实现分类中的所有方法

3.    通过分类添加新方法,不仅会影响这个类,而且会影响它的所有子类

difference:

1.    category:可以访问原始类的实例变量,但是不能添加自身的任何变量

inheritance:可以添加变量

2.    category:重载方法之后,再也不能访问原来的方法

inheritance:可以通过向super发送消息引用父类的方法

3.    通过分类添加新方法,不仅会影响这个类,而且会影响它的所有子类

 

3.Difference between categories and extensions?

4.Difference between protocol in objective c andinterfaces in java?

继承一个借口,必须实现所有的方法,但是集成一个protocol却比较灵活,可以设定@optional和@required,比较灵活

网上搜索答案:

Differencesbetween Java interfaces and Objective-C protocols?

 

http://stackoverflow.com/questions/990360/differences-between-java-interfaces-and-objective-c-protocols

5.What are KVO and KVC?

6.What is purpose of delegates?

7.What are mutable and immutable types in Objective C?

创建内容不可更改的对象。不可变对象。

http://stackoverflow.com/questions/905396/the-final-word-on-nsstrings-mutable-and-immutable?answertab=active#tab-top

 

http://stackoverflow.com/questions/5845013/mutable-vs-immutable-object-for-instance-variable-in-objective-c

immutable types也是有它自己的好处的啊:

An immutable string (or indeed, any immutable object) is one that can't bechanged at all after initialisation.

Here's the advantage of using immutable strings, in (pseudo-)pseudo-code:

// if using mutable strings
let a = "Hello World";
let b = a;
a.replace("Hello", "Goodbye");

Now what does a hold? "Hello World"? "Goodbye World"?Now what does b hold?

If strings are mutable, then it might hold "Goodbye World". Thismay be what you want. It might not be.

With immutability, it becomes very clear that b still points to theoriginal string, because the replace method can't have changed the actualstring, but rather returned a reference to a new string.

You might not see much benefit in this example. But if a and b arereferenced and used in different parts of the code, or in different threads,having immutable references removes a lot of potential errors.

 

8.When we call objective c is runtime language what doesit mean?

http://cn.bing.com/search?q=Cocoa+Samurai%3A+Understanding+the+Objective-C+Runtime&form=MOZSBR&pc=MOZI

Cocoa Samurai: Understanding theObjective-C Runtime

9.what is difference between NSNotification andprotocol?

10.What is push notification?

11.Polymorphism?

12.Singleton?

13.What is responder chain?

14.Difference between frame and bounds?

15.Difference between method and selector?

16.Is there any garbage collection mechanism inObjective C.?

17.NSOperation queue?

18.What is lazy loading?

19.Can we use two tableview controllers on oneviewcontroller?

20.Can we use one tableview with two differentdatasources? How you will achieve this?

21.What is advantage of using RESTful webservices?

22.When to use NSMutableArray and when to use NSArray?

23.What is the difference between REST and SOAP?

24.Give us example of what are delegate methods andwhat are data source methods of uitableview.

25.How many autorelease you can create in yourapplication? Is there any limit?

26.If we don’t create any autorelease pool in ourapplication then is there any autorelease pool already provided to us?

27.When you will create an autorelease pool in yourapplication?

28.When retain count increase?

29.Difference between copy and assign in objective c?

30.What are commonly used NSObject class methods?

31.What is convenience constructor?

32.How to design universal application in Xcode?

33.What is keyword atomic in Objective C?

34.What are UIView animations?

35.How can you store data in iPhone applications?

36.What is coredata?

37.What is NSManagedObject model?

38.What is NSManagedobjectContext?

39.What is predicate?

40.What kind of persistence store we can use withcoredata?

 

 

有人回复了一个答案:

1 shallow copy 拷贝了对象的基本类型,不拷贝资源和对象中指针指向的堆上内存。 2 category 可以在不获悉,不改变原来代码的情况下往里面添加新的方法,只能添加,不能删除修改。 继承可以增加,修改或者删除方法,并且可以增加属性。 3 category和extensions的不同在于 后者可以添加属性。另外后者添加的方法是必须要实现的。extensions可以认为是一个私有的Category 4 OC中的代理有2层含义,官方定义为 formal和informal protocol。前者和Java接口一样。informal protocol中的方法属于设计模式考虑范畴,不是必须实现的,但是如果有实现,就会改变类的属性。 5 key-value code , key -value observer. 6 代理的目的是改变或传递控制链。允许一个类在某些特定时刻通知到其他类,而不需要获取到那些类的指针。可以减少框架复杂度 7 可修改不可修改的集合类。 8 多态。 主要是将数据类型的确定由编译时,推迟到了运行时。 9 协议有控制链(has-a)的关系,通知没有。 10 太简单,不做回答 11 多态,子类指针可以赋值给父类。 12 单例。 13 事件响应链。包括点击事件,画面刷新事件等。在视图栈内从上至下,或者从下之上传播。 14 frame是相对于父view的,bounds是自己的。 15 selector是一个方法的名字,method是一个组合体,包含了名字和实现 16 OC2.0有Garbage collection,但是iOS平台不提供。 17 存放NSOperation的集合类。 18 懒汉模式,只在用到的时候才去初始化。 下面的问题大多数都没什么技术含量


先放着,有心情再看吧


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值