iOS Question collection 1

Source: Internet
Author: User

iOS Question collection 1

1, Objective C has multiple inheritance? What's the substitute for nothing?

Protocol

2. Is there a private method in Objective C? What about private variables?

There are only static methods and instance methods in the OC class, @private can be used to modify the private variables, all instance methods are public by default, if you want to be able to achieve a private effect of the method can not put the declaration of the method @[email protected]

3, what is the meaning of the keyword const?

const int A;

int const A;

Coust int *a;

int *const A;

int const *a const;

Explanation: The first two are all shaped constants; The third pointer points to the invariant shaping constant, that is, the pointer is variable, the shaping constant is immutable, and the fourth is a constant pointer to a variable shaping variable, that is, the shape variable, the pointer does not change, and the fifth is a constant pointer to the shaping constant;

4. What is the meaning of the keyword volatile?

5, the key word static

Static in C + + and objective C

4, #import和 The difference of # include, what @class represent?

#import不会引起重复包含

5. The difference between threads and processes

Processes and threads are the basic units that the operating system realizes, and the system uses this basic unit to realize the concurrency of the system to the application. The main difference between processes and threads is that they are different ways to manage operating system resources. The process has a separate address space, and after a process crashes, it does not affect other processes in protected mode, and the thread is just a different execution path in a process. Thread has its own stack and local variables, but there is no separate address space between the threads, a thread dead is equal to the entire process dead, so the multi-process program is more robust than multithreaded programs, but in the process of switching, the cost of large resources, efficiency is worse. But for some concurrent operations that require simultaneous and shared variables, only threads can be used, and processes cannot be used

6, heap and stack of the difference

Management mode: For the stack, is automatically managed by the compiler, without our manual control, for the heap, the release of work by the programmer control, easy to produce memory leak.

Application Size: Stack: Under Windows, the stack is the data structure to the low address extension, which is a contiguous area of memory. This sentence means that the top of the stack of the address and the maximum capacity of the stack is the system pre-defined, in Windows, the size of the stack is 2M (also said 1M, in short, is a compile-time determination of the constant), if the request for more space than the stack's remaining space, will prompt overflow. Therefore, the space available from the stack is small. Heap: A heap is a data structure that extends to a high address, and is a discontinuous area of memory. This is because the system is stored with a linked list of free memory address, is naturally discontinuous, and the chain of the list of traversal direction is from the low address to high address. The size of the heap is limited by the valid virtual memory in the computer system. Thus, the space of the heap is more flexible and relatively large.

Fragmentation problem: For the heap, frequent new/delete is bound to cause memory space discontinuity, resulting in a large number of fragments, so that program efficiency is reduced. For the stack, there is no problem, because the stack is advanced out of the queue, they are so one by one correspondence, so that there will never be a memory block from the middle of the stack popped

allocation method: The heap is dynamically allocated and there are no statically allocated heaps. stacks are allocated in 2 ways: static allocation and dynamic allocation. Static allocations are done by the compiler, such as the allocation of local variables. The dynamic allocation is assigned by the ALLOCA function, but the dynamic allocation of the stack is different from the heap, and his dynamic allocation is released by the compiler without our manual implementation. Allocation efficiency: The stack is the data structure provided by the machine system, the computer will support the stack at the bottom: allocate the address of the special register storage stack, the stack stack has a special instruction execution, which determines the efficiency of the stack is high. The heap is provided by the C + + function library, and its mechanism is very complex.

7. Memory management mechanism of Objective C

8. Does iOS have garbage collection

9, the reuse mechanism of UITableView

10, when the Viewcontroller Loadview, Viewdidload, Viewdidunload, respectively, when the custom Viewcontroller in a few functions should do what work?

11, How to understand MVC, how is MVC implemented in cocoa?

12. What is the difference between delegate and notification, and how are they used in each case?

13, KVC (key-value-coding) KVO (key-value-observing) Understanding KVC and KVO (key-value-encoding and key-value-monitoring)

14. Self. What's the difference between self and self? What does ID and nil mean?

15. Category and Protocol

16. iOS program run process

1. The main function of the system call app
2. The main function calls Uiapplicationmain.
3. Uiapplicationmain Create a shared applicationinstance, uiapplication the default instance.
4. Uiapplicationmain read Info.plist Locate the main nib file, load the nib, and set the shared application instance as the owner of the nib.

iOS Question collection 1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.