Lecture 24 CS 655 Jeopardy Who wants to
- Slides: 73
Lecture 24: CS 655 Jeopardy Who wants to be a quintuple-deca -billionaire? CS 655: Programming Languages David Evans University of Virginiahttp: //www. cs. virginia. edu/~evans CS 655 Computer Science
Menu n n n Course Summary u Goals from Lecture 1 Musical Interlude: Geoff Stoker Jeopardy Remember to fill out official course evaluations before Friday Tomorrow, 3: 30 – Chris Hawblitzel talk u “Adding Operating System Structure to Language-Based Protection” u Student Roundtable at 5: 00 11/25/2020 University of Virginia CS 655 2
Final Everyone should have received email with the final schedule n Final pledge: u After you take final, don’t help others who have not taken it. u Before you take final, don’t seek help from others who have taken it. n 11/25/2020 University of Virginia CS 655 3
Goal #1 When you need to invent a language (and most of you will at some point in your career) you will design it, not just make it up. 11/25/2020 University of Virginia CS 655 4
Goal #2 When you design your language, you will have sufficient knowledge of other languages not to repeat their mistakes, and solid enough theory background to describe your language well. 11/25/2020 University of Virginia CS 655 5
Languages and Tools Languages: FORTRAN, Algol 60, BLISS, C, Pascal, Algol 68, CLU, Ada, C++, Java, Eiffel, Sather, FP, FL, ML, Scheme, Linda, Java. Spaces, Aspect. J, PROLOG, GPL n Formal tools: BNF, Operational Semantics, Type Judgments, Axiomatic Semantics, Lambda Calculus, Denotational Semantics n 11/25/2020 University of Virginia CS 655 6
Goal #3 You will become better at programming and building systems. You will think more clearly and maybe even write better. 11/25/2020 University of Virginia CS 655 7
Goal #4 Some of you will do projects that lead to conference papers or thesis topics. All of you will be able to understand nearly all PLDI papers and many POPL papers. 11/25/2020 University of Virginia CS 655 8
I think that it’s extraordinarily important that we in computer science keep fun in computing. When it started out, it was an awful lot of fun. Of course, the paying customer got shafted every now and then, and after a while we began to take their complaints seriously. We began to feel as if we really were responsible for the successful, error-free perfect use of these machines. I don't think we are. I think we're responsible for stretching them, setting them off in new directions, and keeping fun in the house. I hope the field of computer science never loses its sense of fun. Above all, I hope we don't become missionaries. Don't feel as if you're Bible salesmen. The world has too many of those already. What you know about computing other people will learn. Don't feel as if the key to successful computing is only in your hands. What’s in your hands, I think and hope, is intelligence: the ability to see the machine as more than when you were first led up to it, that you can make it more. Alan Perlis (quoted in Abelson & Sussman) 11/25/2020 University of Virginia CS 655 9
Musical Interlude 11/25/2020 University of Virginia CS 655 10
Jeopardy Rules n n $1 B, $2 B, $4 B – raise hand to answer, first team spotted will be asked to answer, whoever is picked must answer right away u For questions with hints, no penalty for wrong answer before hints revealed (but can’t answer again); u For other questions (or after hint revealed), lose value for wrong answer. All teams answer $10 B questions, answer value at discretion of staff Projects category: group who did the project cannot answer, until everyone else gives up Team with the highest total, gets prizes (no cash prizes) 11/25/2020 University of Virginia CS 655 11
Jeopardy Zero, One, Infinity Call-byname, Callby-value 1 1 2 Syntax and Semantics Exception Handling 1 1 2 2 2 4 4 4 10 10 10 11/25/2020 Type Inference Projects (All point values in Billions) University of Virginia CS 655 12
Zero, One, Infinity 1 How many reserved words are there in PL/I? 0 11/25/2020 23 Choices 57 University of Virginia CS 655 178 13
Zero, One, Infinity 1 How many reserved words are there in PL/I? 0 23 Choices 57 178 Return 11/25/2020 University of Virginia CS 655 14
Buffer 11/25/2020 University of Virginia CS 655 15
Zero, One, Infinity 2 Using the numeral system we defined in class, what number does ( z. z ( xy. y) ( x. x)) represent? 0 11/25/2020 1 Choices 2 Not Number University of Virginia CS 655 16
Zero, One, Infinity 2 Using the numeral system we defined in class, what number does ( z. z ( xy. y) ( x. x)) represent? 0 1 Choices 2 Not Number Return 11/25/2020 University of Virginia CS 655 17
Buffer 11/25/2020 University of Virginia CS 655 18
Zero, One, Infinity 4 What are: “strong”, “firm”, “meek”, “weak”, and “soft”? Context strengths in. Answer Algol 68 (control which coercions are allowed) Return 11/25/2020 University of Virginia CS 655 19
Buffer 11/25/2020 University of Virginia CS 655 20
Zero, One, Infinity 10 A. B. C. D. E. F. G. Put the following in order by number of pages, from least to most: Ada Military Standard [1980] Revised Report on Algol 60 [1963] Beowulf [~750] C++ Standard [1997] Common LISP, The Language [1990] FIFA Laws of the Game [1999] US Tax Code [1999] 11/25/2020 University of Virginia CS 655 21
Zero, One, Infinity 10 Put the following in order by number of pages, from least to most: B. Algol 60 Report (16) F. FIFA Laws of the Game (29) C. Beowulf (120) A. Ada Military Standard [1980] (233) D. C++ Standard (680) E. Common LISP, The Language (1029) G. US Tax Code (6000) Return 11/25/2020 University of Virginia CS 655 22
Buffer 11/25/2020 University of Virginia CS 655 23
Call by Name, Call by Value 1 Which famous language designer has said he can be called by name or called by value? Niklaus Wirth – “Europeans Answer call him by name, but Americans call him by value. ” (Nickel’s Worth) Return 11/25/2020 University of Virginia CS 655 24
Buffer 11/25/2020 University of Virginia CS 655 25
Call by Name, Call by Value 2 Which language designers received a National Medal of Technology last year? Picture Return 11/25/2020 University of Virginia CS 655 26
Call by Name, Call by Value 2 Ken Thompson (left) and Dennis Ritchie Answer (for C and UNIX) Return 11/25/2020 University of Virginia CS 655 27
Buffer 11/25/2020 University of Virginia CS 655 28
Call by Name, Call by Value 4 What does ECOOP stand for? European Conference for Object-Oriented Programming Answer Return 11/25/2020 University of Virginia CS 655 29
Buffer 11/25/2020 University of Virginia CS 655 30
Call by Name, Call by Value 10 Describe or make up a naming myth for each of the following languages: APL BLISS Forth JOVIAL Scheme SNOBOL (Note: an amusing creative answer is sometimes better than a dull correct one!) 11/25/2020 University of Virginia CS 655 31
Call by Name, Call by Value 10 APL “A Programming Language” BLISS Basic Language for Implementation of System Software (or allegedly, “System Software Implementation Language, Backwards”) Forth “Fourth” for fourth-generation language; implemented on second-generation computer with 5 -letter limit. 11/25/2020 University of Virginia CS 655 32
Call by Name, Call by Value 10 JOVIAL Jule’s Own Version of IAL Scheme Successor to “Planner” and “Conniver”, originally “Schemer”, but limited to 6 letters. SNOBOL “Stri. Ng Oriented sym. BOlic Language” Return 11/25/2020 University of Virginia CS 655 33
Buffer 11/25/2020 University of Virginia CS 655 34
Type Reconstruction 1 What type does Hindley-Milner type reconstruction produce for: g. f. x. g (f x) g: f: x: Term: ( ) Answer (( ) ( )) Return 11/25/2020 University of Virginia CS 655 35
Buffer 11/25/2020 University of Virginia CS 655 36
Type Reconstruction 2 Which of the following type declarations were valid in Algol 60? A. integer i All. Answer except char. B. Boolean b C. char c D. array a E. real array a[if i<0 then 2 else -2: 30] Return 11/25/2020 University of Virginia CS 655 37
Buffer 11/25/2020 University of Virginia CS 655 38
Type Reconstruction 4 A. B. C. D. E. X F. Which of the following were women? First programmer Creator of first compiler Author of first major study of programming languages Originator of most widelyused language of 60 s, 70 s and 80 s Designer of first language to support data abstraction Leader of Ada project Answer 11/25/2020 Names Ada Lovelace Admiral Hopper Jean Sammet (COBOL) Admiral G. Murray Hopper Prof. Liskov Jean Ichbiah University of Virginia CS 655 Return 39
Buffer 11/25/2020 University of Virginia CS 655 40
Type Reconstruction 10 What type does ML infer for sort as define below? fun split [] = ([], []) | split [h] = ([h], []) | split (x: : y: : t) = let val (s 1, s 2) = split t in (x: : s 1, y: : s 2) end fun merge ([], x) = x: int list // Explicit declarations mean x must | merge (x, []) = x: int list // have type int list. | merge (h 1: : t 1, h 2: : t 2) = if h 1 <int h 2 then h 1: : merge (t 1, h 2: : t 2) else h 2: : merge (h 1: : t 1, t 2); fun sort [] = [] | sort x = let val (p, q) = split x in merge (sort p, sort q) end; 11/25/2020 University of Virginia CS 655 41
Type Reconstruction 10 sort has type: ‘a list int list There is a “bug” in sort, it can’t sort a single element: sort [x] = merge (sort [x], sort []) = merge (sort[x], sort []), []) =. . . Hence, type unifier never has to unify ‘a list and int list! See 11/25/2020 University of Virginia 655 /yak/typing/typin 42 http: //www. plover. com/~ mjd/CSperl
Buffer 11/25/2020 University of Virginia CS 655 43
Syntax and Semantics 1 Using standard axiomatic semantics for an Algol-like language, what is the weakest pre-condition P such that: P { if (y > 3) x : = 5; else x : = x + 1; } x = 12 y = 2 Answer false 11/25/2020 University of Virginia CS 655 Return 44
Buffer 11/25/2020 University of Virginia CS 655 45
Syntax and Semantics 2 What Invariant can be used to prove: sum = 0 n = x. length i = 0 { while (i < n) sum : = sum + x[i]; i : = i + 1; end } Inv = n = x. length Answer x. length -1 sum = x[j] sum = x[i] i=0 11/25/2020 j=0, i -1 University of Virginia CS 655 Return 46
Buffer 11/25/2020 University of Virginia CS 655 47
Syntax and Semantics 4 DAILY DOUBLE Topic: Denotational Semantics 11/25/2020 University of Virginia CS 655 48
Syntax and Semantics 4 What would be unusual about our language if its statement semantics was described by the denotational semantics rules: L : Statement. List ( ) L [[]] = { ( , ) | } L [[Statement ; Statement. List ]] = S [[Statement]] L [[Statement. List]] Answer 11/25/2020 University of Virginia CS 655 49
Syntax and Semantics 4 L [[Statement ; Statement. List ]] = S [[Statement]] L [[Statement. List]] The statements are modifying the state in reverse order! b : = a; a : = a + 1; S [[b : = a]] (S [[a : = a + 1]] ) Return 11/25/2020 University of Virginia CS 655 50
Buffer 11/25/2020 University of Virginia CS 655 51
Syntax and Semantics 10 Use a standard operational semantics to describe the Linda primitives: u out (t) – add tuple t to tuple space u take (s) t – returns and removes tuple t matching template s You may assume a procedure match_and_bind ( : store, s: template, t: tuple) that returns true if tuple t matches template s, and adds appropriated bindings to ; otherwise, it returns false and does nothing. Return 11/25/2020 University of Virginia CS 655 52
Buffer 11/25/2020 University of Virginia CS 655 53
Exception Handling 1 What is the difference between exception propagation semantics in CLU and Java? Explain the advantages/disadvantages of each approach. Answer 11/25/2020 University of Virginia CS 655 54
Exception Handling 1 In CLU, an exception that is not handled by the calling context, is propagated up the call chain as an “unhandled exception”. In Java, the programmer must provide handlers for all exceptions except Run. Time. Exceptions. Return 11/25/2020 University of Virginia CS 655 55
Buffer 11/25/2020 University of Virginia CS 655 56
Exception Handling 2 What must be true about a language for the typing rule shown below to be sound? T 1 T 2 array[T 1] array [T 2] Array assignment, parameter passing and result passing must be. Answer by value (copy, not sharing). 11/25/2020 University of Virginia CS 655 Return 57
Buffer 11/25/2020 University of Virginia CS 655 58
Exception Handling 4 The decrease in the net worth of the secondary co-author of the first BASIC interpreter for the Altair in the past month is closest to the annual GDP of which country? $1. 2 B A. Andorra B. Bulgaria $33 B Values Answer C. Egypt $188 B D. Ireland $67 B E. Mexico $815 B 11/25/2020 University of Virginia CS 655 59
Buffer 11/25/2020 University of Virginia CS 655 60
Exception Handling 10 1. 2. 3. 4. 5. For each system, identify the language in which it was programmed: AWACS (air defense) Multics Unix World. Wide. Web (first Web server & browser) X-Windows 11/25/2020 University of Virginia CS 655 61
Exception Handling 10 1. 2. 3. 4. 5. For each system, identify the language in which it was programmed: AWACS (air defense) – JOVIAL Multics – PL/I Unix – C World. Wide. Web (first Web server & browser) – Objective C X-Windows – CLU (now C) Return 11/25/2020 University of Virginia CS 655 62
Buffer 11/25/2020 University of Virginia CS 655 63
Projects 1 In the Tabasco environment-updating rule for if, what does mean? A {S 1} A 1 A {S 2} A 2 -------------------- [if-else] A{ if exp 1: S 1 else: S 2} A 1 A 2 Answer (A 1 A 2) |- var: secure iff Return A 1|-var: secure and A 2|-var: secure 11/25/2020 University of Virginia CS 655 64
Buffer 11/25/2020 University of Virginia CS 655 65
Projects 2 Why is Par. Ty better than Pizza? Faster execution because run-time type checks are. Answer not needed. 11/25/2020 University of Virginia CS 655 Return 66
Buffer 11/25/2020 University of Virginia CS 655 67
Projects 4 What is the difference between “consistent pass-by-value” and “inconsistent pass-by-value”? 11/25/2020 University of Virginia CS 655 68
Projects 10 Give an elevator speech for the next group’s project: 1. Exception Mechanisms 2. Static Detection of Buffer Overflow 3. Par. Ty 4. Tabasco 5. JIST 6. Pass-by-Value Services in Object Component Software 11/25/2020 University of Virginia CS 655 69
Buffer 11/25/2020 University of Virginia CS 655 70
Final Jeopardy: Abstraction Functions and Rep Invariants 11/25/2020 University of Virginia CS 655 71
Final Jeopardy Stroustrup’s “What is Object-Oriented Programming” paper used the following example: class vector { int *v; int sz; vector: : vector (int s) { // Creates a new vector of size s. if (s < 0) error (“Size must be non-negative. ”); sz = s; v = new int[s]; } int vector: : operator[] (int i) { if (0 < i || sz <= i) error (“Bad selector!”); return v[i]; } } What is an abstraction function and rep invariant for vector? 11/25/2020 University of Virginia CS 655 72
Buffer 11/25/2020 University of Virginia CS 655 73
- Ba 655
- Norsafe mako 655
- Marc 655
- 01:640:244 lecture notes - lecture 15: plat, idah, farad
- Eric be that simple. he wants
- Yvonne has 10 tulip bulbs in a bag
- Who wants to be a millionaire template
- Who wants
- Wants and needs
- Caesar wants antony to touch calpurnia because…
- Google logo
- Open for delivery
- What exactly does gatsby want to recover?
- If any man will come after me
- My aunt wants us to in the school chorus
- Mathionaire
- Juan miguel wants to protect his bicycle parts from rusting
- Welcome to who wants to be a millionaire
- What are private wants
- Whos the author
- Who wants to be a super millionaire
- Hierarchy of wants
- Primary wants
- Who wants to sign up to hear stefano's band in concert
- Needs and wants objectives
- Needs analysis necessities lacks wants
- Sally wants to select an entire paragraph
- Who wants
- Value proposition canvas
- Who wants to be a millionaire a b c d
- 4-1 right triangle trigonometry word problems
- Super manager
- Alejandro wants to create a table comparing
- Who wants to be a millionaire a b c d
- Dr. penina segall-gutierrez
- Public finance meaning
- If amelia wants to make the maximum
- Who wants to be a millionaire a b c d
- Simple past for want
- Exploring business meaning
- Needs and wants
- The manager of a sports arena wants to learn
- Satisfying needs chapter 6
- Who wants to be millionaire template
- I am where god wants me to be
- Emily wants to buy turquoise stones
- Who wants to win a million dollars
- Who wants to be a mathionaire
- Father of economics
- God wants me to be happy
- The manager of a sports arena wants to learn
- Financial needs and wants
- 15 things every veteran wants you to know
- Who wants to be a millionaire a b c d
- Who wants to win
- Who wants to be a millionaire template
- Needs vs wants examples
- Change management
- Difference between internet and www
- Analyzing consumer market
- Who wants to be a millionaire sounds
- Needs wants and demands
- Who wants to be a millionaire a b c d
- Who wants
- There will come soft rains climax
- Selling is managing profitable customer relationships
- Needs and wants being satisfied
- Kelly curley
- Psalm 20:14
- Upset people
- The price of a leased vehicle is known as the
- When backed by buying power wants become
- Maybe god wants us to meet a few wrong
- Zoey wants to buy a new car