Wednesday, August 10, 2011

Functional programming trivia from Scalathon

By popular request, here are the questions and answers from the quizzo at Scalathon. I've formatted them so you can try the questions for yourself! The questions were written by Ben Karel, Randall Schulz, and yours truly. I put the final wording on all the questions, so any mess-ups are my fault alone.

Round 1
  1. What language is most closely associated with the actors model of concurrency?
  2. Who wrote "Purely Functional Data Structures"?
  3. Place the following languages in chronological order, from oldest to newest: Lisp, Fortran, Cobol.
  4. Two of the three primary techniques of giving formal semantics to a programming language are operational and denotational semantics. What is the third of the trio?
  5. What term am I defining? "A tractable syntactic method for proving the absence of certain program behaviors by classifying phrases according to the kinds of values they compute."
Round 2
  1. Can you have functional programming without static typing?
  2. Who invented LISP?
  3. What is the name of the type inference algorithm used by Haskell and ML?
  4. What is the more common name for Schönfinkelization?
  5. What language is CompCert, the formally verified C-compiler written in?
Round 3
  1. Analogy: Types are to values, as kinds are to what?
  2. Some type systems have the feature that a type can depend upon a value. What is that feature called?
  3. Name the co-author of most of the original Lambda papers (his name is the longer one).
  4. According to Tony Hoare, this was "a language so far ahead of its time that it was not only an improvement on its predecessors but also on nearly all its successors." Name the language, which was (almost) based on the fully-typed call-by-value lambda calculus.
  5. Peter J. Landin described the SECD machine in 1963; what language was he defining?
Round 4
  1. What is the difference between a total function and a partial function?
  2. Name the titles of two of the three original "lambda papers"?
  3. Which of these languages is Turing-complete: SQL, The Coq Specification Language, XSLT, XML, JSON, Prolog, Ant.
  4. What common higher-order function implements a catamorphism?
  5. Who quipped that "Syntactic sugar causes cancer of the semicolon."?
Tie-break Round
  1. The quirky bird, thrush, and mockingbird are all names of closed lambda terms, also known as what?
  2. A paper called "Macaroni is better than spaghetti" was published in 1977 on efficient implementation of call stacks. Name the author, who also gave an OOPSLA speech starting only with words of one syllable, and is known for his work on Scheme and Common Lisp, among many other languages.
  3. Peter Landin defined an operator to capture continuations; it shares a name with an array-based functional programming language derived from APL. What was the name of Landin's operator?
  4. Compositional type inference is assured by the property of what?














Round 1 Answers
A1: Erlang, A2: A: Chris Okasaki, A3: Fortran (1956), Lisp (1958), Cobol (1959), A4: axiomatic semantics, A5: "type system"

Round 2 Answers
A1: Yes; A2: John McCarthy; A3: Hindley-Milner [Hindley-Dumas was also accepted. Daniel Spiewak registered his strong protest that the question as worded does not make sense. It confuses type systems and type inference algorithms.]; A4: Currying; A5: Coq

Round 3
Answers
A1: Types; A2: Dependent typing; A3: Gerald Jay Sussman; A4: Algol 60; A5: ISWIM

Round 4
Answers
A1: Partial functions are undefined for some argument values. [Many other answers were accepted since the term "function" is used in many contexts.]; A2: [This question should have been worded differently. We only wanted papers with the words "Lambda the Ultimate" in the title, so any three of these four counted: "Lambda The Ultimate Imperative", "Lambda The Ultimate Declarative", "... Lambda The Ultimate GOTO", "... LAMBDA the Ultimate Opcode"] A3: XSLT, Prolog, Ant; A4: Fold/reduce; A5: Alan Perlis

Tie-break Round
Answers
A1: combinators; A2: Guy Steele; A3: J; A4: principal typings

No comments:

Post a Comment