Swift : Programming Language

Skill Test Set 1: Basic introductory questions (Playground and REPL)

  1. Choose all correct statements.
    Swift 1.0 was released in Oct 2014
    Swift 1.0 was released in June 2014 in WWDC event
    Swift 2.0 was released in Oct 2014
    Swift 2.0 was released in June 2015 in WWDC event

  2. Choose all correct statements.
    Swift was developed by Apple and IBM together as open-source project
    Swift is available on MacOS and Linux
    Swift was first available with Xcode 6.0
    Swift.org is dedicated website to download swift compiler for MacOS.

  3. a. To submit your App to the App Store you must build your app using the version of Swift that comes included within Xcode.
    b. Playgrounds are supported for downloadable Swift packages separately on Ubuntu platform.
    Both statements are right.
    Only a is right.
    Only b is right.
    Both are wrong.

  4. Choose all correct statements.
    Swift's inter-operability feature allows code written in C and Objective-C to be used in Swift code and vice versa smoothly.
    Swift's mix and match feature allows C and Objective-C source files to be used in Swift project and vice versa.
    Using inter-operability feature C++ code could be directly used in Swift code.
    Using migration tool swift file could be converted to Objective-C and vice versa.

  5. Choose all correct statements.
    Swift code file does not need separate files for declaring interface and implementation of class.
    The file extension for swift code is .swt
    Objective-C code can't be written in a swift class
    Existing C-library can't be used in swift directly but using migration tool we can convert it to swift code and use.

  6. Choose all correct statements.
    Swift is a general purpose programming language.
    Swift is a scripting language.
    We can create a complete Operating System using Swift.
    Swift can't be used to develop application's other than iOS.

  7. Choose all correct statements.
    Swift doesn't support modern feature like lambda/block as available in other programming language.
    Swift has advance error handling model which provides feature to create our own custom error types.
    Swift has automatic memory handling mechanism using ARC.
    Swift code is compiled in C code in first pass and re-compiled again to native code.
    Swift code is directly compiled into native (machine) code without any intermediate code compilation into C.

  8. Choose all correct statements.
    Swift supports playground which is an innovative feature that allows programmers to experiment with Swift code and see the results immediately, without the overhead of building and running an app.
    Playground is a feature of Xcode but not Swift.
    Swift supports REPL.
    Playground doesn't support Objective-C code separately.
    Playground can run code written in mixed languages (Swift and Objective-C) both in one program.

  9. Choose all correct statements.
    Swift REPL only runs on command line (terminal)
    Swift REPL can run on LLDB console in Xcode.
    Swift code can separately be compiled on command line using swiftc command
    Swift code can't take command line argument like other programming languages.

  10. True or false statements

    1. Playground code must be executed to see output on debugger console.
      True False

    2. Playground code's output could be seen without executing the code, on result sidebar (usually stays on right side pannel of Xcode editor).
      True False

    3. Playground files are saved with an extension of playground (e.g helloworld.playground).
      True False

    4. Playground files can be shared separately.
      True False

    5. Playground file (.playground) is actually a workspace file and it has Contents.swift file hidden inside the package.
      True False

    6. Other swift source codes and resources such as images could be added to a playground file.
      True False

    7. XCPlayground framework is required to add UIView and UIViewController in Playground code.
      True False

    8. Playground pages are similar to individual playground file but it is added to another playground file (parent).
      True False

    9. Adding the first page to a playground will show two new pages. One is the current content of the playground editor and the other is the new page.
      True False

    10. Playground pages have shared as well as separate resources.
      True False

Note: Answers are not given intentionally.