Swift MCQ Test: Swift MCQs - Practice Questions
1. Explain Swift's 'map', 'filter', and 'reduce' functions.
2. Which Swift keyword is used to check multiple conditions in an 'if' statement?
3. What is the 'escaping' keyword used for in Swift?
4. What is the purpose of the 'if' statement in Swift?
5. How can you achieve thread safety in Swift?
6. Explain the concept of protocol-oriented programming in Swift.
7. How does Swift handle multiple return values from a function?
8. What is the correct way to check if two strings are not equal in Swift?
9. What is the correct syntax for an 'if-else' statement in Swift?
10. Which Swift keyword is used to indicate the absence of a value?
11. What are closures in Swift?
12. How is 'protocol-oriented programming' emphasized in Swift?
13. How do you declare a property as 'weak' in Swift?
14. In Swift, what is the purpose of the 'guard' statement?
15. What is the purpose of the 'enum' keyword in Swift?
16. In Swift, what is the purpose of the 'subscript' keyword?
17. How does Swift handle memory management for reference types?
18. In Swift, what is the purpose of the 'while' loop?
19. What is the correct way to concatenate two strings in Swift?
20. In Swift, how do you create an empty array of integers?
21. What is the purpose of the Swift 'enum' type?
22. In Swift, how do you use a closure to sort an array of integers in ascending order?
23. What is the purpose of the 'guard' statement in Swift?
24. What is the purpose of the 'associatedtype' keyword in Swift protocols?
25. Which Swift data type is used to store decimal numbers?
26. How can you handle errors in Swift?
27. How does Swift handle optionals and unwrapping?
28. Explain Swift's 'associatedtype' in protocols.
29. What is the purpose of an optional in Swift?
30. What is the purpose of the 'extension' keyword in Swift?