iOS face Test 8

Source: Internet
Author: User
iOS face Test 8

1. Multi-thread stack and heap, respectively, public or private (C)
A. Stack public, heap private
B. Stack public, heap public
C. Stack private, heap public
A. Stack public, heap private


Explain
Generally, stacks are private and the heap is public; but you can create a private heap for a particular thread


In a multithreaded environment, each thread has a stack and a program counter. Stack and program counters are used to hold the execution history of threads and the running state of threads, which are private resources of threads. Other resources (such as heaps, address spaces, global variables) are shared by multiple threads within the same process.


Heap: is a common space, divided into global heap and local heap.
The global heap is all space that is not allocated, and the local heap is the space that the user allocates. The heap is allocated when the operating system initializes the process, and it can be added to the system during the run, but remember to return it to the operating system or memory leak.


Stack: is unique to the thread, saving its running state and local automatic variables. When the stack is initialized at the start of the thread, the stacks are independent of each other, so the stack is thread safe. The operating system will automatically switch the stack when switching threads, which is to switch SS/ESP registers. Stack space does not need to be explicitly allocated and released within a high-level language.


2. A single case class Nsnotificationcenter provides information broadcast notification, which uses the notification mechanism of the Observer pattern (a)
A. Wrong about B.


3. The statement to determine whether the ipad device is. ()
A.If ([[Uidevice currentdevice] userinterfaceidiom] = = Uiuserinterfaceidiomphone)
{}


B.if ([[Uidevice Currentdevice] userinterfaceidiom]!= uiuserinterfaceidiomphone)
{}


C.if ([[Uidevice currentdevice] userinterfaceidiom] = = Uiuserinterfaceidiompad)
{}


4. Which of the following algorithms is not a symmetric encryption algorithm ()
A.des B.RC5 C.aes D.rsa


Symmetric encryption: (also known as private key encryption)
Secret and decryption encryption algorithm using the same secret key. Sometimes called the traditional cipher algorithm, the encryption key can be inferred from the decryption key, while the decryption key can also be inferred from the encryption key.


Des algorithm to the 64-bit plaintext input block into 64-bit ciphertext output block, it uses the key is also 64 bits, its algorithm is divided into two main steps
1) Initial permutation
Its function is to put the input of the 64-bit data block by a bit to regroup, and the output is divided into L0 and R0 two parts, each part of the length of 32, the replacement rules for the input of the 58th position to the 1th, the 50th bit to the 2nd bit ..., and so on, the last one is the original 7th bit.
The replacement rules are shown in the following table:
58,50,42,34,26,18,10,02
60,52,44,36,28,20,12,04
62,54,46,38,30,22,14,06
64,56,48,40,32,24,16,08
57,49,41,33,25,17,09,01
59,51,43,35,27,19,11,03
61,53,45,37,29,21,13,05
63,55,47,39,31,23,15,07


2) Inverse permutation


After 16 iterations, we get l0,r0, take this as the input, carry on the inverse permutation, the inverse permutation is exactly the inverse of the initial permutation, and the output of the ciphertext is obtained.
This algorithm is a representative of symmetric encryption algorithm, which is widely used in computer network system.




AES: Advanced Encryption Algorithm (Advanced encryption Standard), also known as the Rijndael encryption method in cryptography, is a block encryption standard used by the U.S. federal government. This standard, which replaces the original DES, has been analyzed and widely used worldwide.


5. Known ordered sequence b c d E F g Q R S T, then in the binary lookup keyword B, in the process of sequentially comparing the keywords are ()
A.F d b
B.f C b
C.G c b
D.G d b


Explain
A sequence that uses the binary lookup must be ordered
The focus of the binary search is the record-finding interval


The first lookup interval is [0,9]
i = 0;
last = 9;
Middle position middle= (first+last)/2 = 4 (out decimal point)
4 the corresponding element is F
We're looking for b instead of F, but we've found that B is smaller than f, and the sequence is ordered, so the b we're looking for should be on the left side of F (excluding F).


Second Lookup
Lookup interval [0 3]
Middle = 1
1 The corresponding element is C, larger than B


Third Lookup
Lookup interval [0,0]
middle=0;
Find element B
So, in turn, F-c-b.



Copyright statement: This article by http://www.bestnathan.com/Original, Welcome to reprint share. Please respect the work of the author, reprinted when the statement and the author blog link, thank you
Related Article

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.