IOS Q&A -The Basics#01
IOS Interview Questions and Answers
The Basics#01
1. What are the Key Features of the Swift programming language?
- Modern: Swift is a result of the latest research on programming languages, combined with decades of experience building Apple platforms. Also, Swift is continuously evolving.
- Safe: Swift is a type-safe language which means, If we pass a String to a variable of type Int by mistake, then Swift throws a compile-time error. Also, it’s a static programming language i.e. any variable or a constant should be declared or inferred to a specific type at the compile time.
- Fast: Swift was built to be fast using the incredibly high-performance LLVM compiler technology. There are claims that Swift is 2.6x faster than Objective-C and 8.4x faster than Python.
- Expressive: Swift is called Syntactic sugar because it makes the language “Sweeter” for developer use. Swift offers a simplified syntax and grammar that is easy to read and write.
- Open source: In 2015, Swift was open-sourced to encourage community-driven development of the language itself.
2. What are types in swift?
In Swift, there are two kinds of types: Named types and Compound types.
A Named type is a type that can be given a particular name when it’s defined. Named types includes classes, structures, enumerations, protocols, arrays, dictionaries, optional values
and user-defined named types etc,.
A Compound type is a type without a name, defined in the Swift language itself. There are two compound types: function types and tuple types.
3. How Swift ensures safety?
4. What are the major differences between Swift and Objective-C?
Please check out this tutorial on Youtube.
Your comments help us a lot, Please ask if you have any questions.
3. How Swift ensures safety?
- Swift eliminates entire classes of unsafe code.
- Variables are always initialized before use.
- Integers are checked for overflow.
- Array indices are checked for out-of-bounds errors.
- By default Swift objects can never be nil. Optionals ensure that nil values are handled explicitly.
- Error handling allows controlled recovery from unexpected failures.
- Swift heavily leverages value types, especially for commonly used types like Arrays and Dictionaries. Value types are quite safe while accessing in thread & memory.
- Memory is managed automatically, and enforcement of exclusive access to memory guards against many programming mistakes.
4. What are the major differences between Swift and Objective-C?
Please check out this tutorial on Youtube.
Your comments help us a lot, Please ask if you have any questions.
Comments
Post a Comment