swift-Self-Test questions

Source: Internet
Author: User
Array


1. Define a floating-point array in three different ways


What is the role of 2.+= in arrays


3. Array subscript method to annotate the use of single, multiple elements


4. Change of the log group and delete


5. Traversal of the array (for: In and enumerate)


6. Definition of an empty array


7. Create a specific size, each value is the default array of type double, and if you omit the double explicitly defined, how to write.


8. Combination of two arrays


9. Common methods in arrays



Answer


Dictionary
1. Dictionary definition, create a dictionary with a key value of Int,value value for string

2. Dictionary size with what attributes can be obtained

3. How the dictionary adds elements and how they differ (2 types)

4. How the dictionary deletes elements and how they differ (2 types)

5. How to traverse a dictionary

6. Separate access to the key, value in the dictionary

7. Use keys or values in the dictionary to construct an array

8. How to create an empty dictionary and how to empty a non-empty dictionary

Answer


Control Statements
1.for looping through arrays, dictionaries, strings, ranges

2.while cyclic use

3.do.. While loop

4. Conditional statements if (not stated) and switch (new feature of Switch 2)

5.switch A case can contain multiple case, how to write code.

6.case How to include scopes, tuples

7. What does the value binding on the switch represent.

What is the role of adding where in 8.switch

9. Control transfer Statements in addition to our well-known continue, break, and return add one, what is. Have any effect. How to use it.

10. As mentioned earlier, switch does not need a break, if you add a break is what role

11. How to attach a label to the while, switch, for, if

Answer



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.