Pre-qualification self-test for

CSCI S-65: Advanced Mobile Application Development using Swift and iOS

Harvard Extension School Summer 2018

Released: 15 May 2018 v0.4 Author: Daniel Bromberg bromberg@fas.harvard.edu

The following should be answered without consulting any references. You should be able get most correct. You may self-grade by looking up information afterwards. If you need your test “graded” feel free to e-mail it to: bromberg@fas.harvard.edu and I will be happy to take a look.

  1. Type inference is a major distinguishing feature of Swift. Give a simple example. Does type inference happen at compile time or run time?

  2. Swift doesn’t use pointers in the sense of integers that directly represent offsets in the process’ memory space. Instead it uses “reference” types, but reference types aren’t allowed to refer to “nothing”. Instead a Swift-specific mechanism is used. What is that mechanism? [Advanced: For backward compatibility only, Swift actually does have a pointer wrapper type. What is it?]

  3. What are the defining characteristics of Object-Oriented Programming?

  4. Give one example of a strongly typed language and one example of a weakly typed language.

  5. Which is faster in runtime when passing a 1,000 element array from a calling function to a called function: by value or by reference? Why?

  6. What is the maximum value that can be stored in an eight bit unsigned integer?

  7. Assume a variable is of type unsigned integer and holds the maximum positive value possible. What happens when 1 is added (using +) to the variable and the result stored back into the variable? [Advanced: there are actually two answers depending on the language; Swift differs from C in this regard. Explain.]

  8. The following program is intenrded to print the numbers from 0 through 10, inclusive. Fix the bug:

    for ( x = 0; x < 10; x++ ) { println(x); }

    Why is this question no longer relevant to Swift 3? [Advanced: there is a way to “implement this bug” in Swift 3. How?]

  9. The following should be answered in terms of proportion to the number of elements stored in the specified data structure, in big-O notation:

    • How long does it take to find an element in a Hash table, given its key?

    • How long does it take to find an element in a Hash table, given its value?

    • How long does it take to find an element in an unsorted Array, given its value?

    • How long does it take to find an element in an unsorted Array, given its index?

    • How long does it take to find an element in a sorted Array, given its value?

  10. Implement the Fibonacci function in your favorite language:
    – Recursively, using the natural approach given the definition:
    f(n) = f(n -1) + f(n – 2) for all n >= 0
    – Iteratively, using a loop and no recursive function call.

  11. Name 3 real-world constraints that make App development for any mobile device more challenging than for a desktop. This should be based on your own observations, not iOS particulars. There is no right set of answers, rather an appeal to your experience as an advanced user, and using your common sense. It should not involve getting “deep in the weeds” regarding programming or iOS.

  12. Name 3 advantages that make App development for an iPhone or iPad richer and more interesting than for a desktop. Again, base your answer on your existing observation & experience.

  13. Name at least one graphical IDE you’ve used in the past and discuss an advantage of using it versus using a plain text editor to develop software, and a disadvantage or annoyance.

  14. What’s your favorite no frills code editor outside of any IDE?