Csc 350 Comp Ling Exam 2 Page 1 of 6 Name___ KEY ___ 66 points _____ Multiple Choice. 3 points each. Choose the one best answer. 1. Which best describes the term language? a) language is a subset of dictionary b) language is a subset of dictionary* c) language is a subset {assertion, query, imperative}* B d) language is describable with a context-free grammar 2. Which best describes "the language generated by the context free grammar, G"? a) the set of all strings of terminal symbols derivable from the start symbol of G. b) the set of all strings of terminal symbols derivable from any nonterminal symbol of G. c) the set of all strings of terminal and nonterminal symbols derivable from the start symbol of G. d) the set of all strings of terminal and nonterminal symbols A derivable from any nonterminal symbol of G. 3. Which returns the penultimate (second to last) element of a list? a) f1([X],[]). f1([X|Xs],[X|Ys]) :- f1(Xs,Ys). b) f2([X],X). f2([X|Xs],Y) :- f2(Xs,Y). c) f3([X, Y],X). f3([X, Y | Zs],Z) :- f3([Y | Zs],Z). C d) f4([], A, A, []). f4([B|A], C, D, [_|E]) :- f4(A, [B|C], D, E). 4. A web-based template system gets its parameters a) positionally from the web form, so that the first INPUT element of the form will be parameter #1, for example. b) by the URL the user types in or clicks on to reach the form. c) by the name assigned to the INPUT element in the web form. C d) from assignment by the web server. 5. What can be said about the "Chomsky Hierarchy" of 6 types of languages? a) The languages don't intersect. b) There exist theoretical machines with finite state and finite memory to recognize all these types of languages. c) There exist theoretical machines with finite state to recognize all these types of languages, but some require infinite memory. d) a and b C e) a and c 6. Top-down parsing a) is used by Prolog when you write a definite clause grammar. b) is the method of choice for machine created parsers. c) always constructs a real parse tree as a data structure so it can be rearranged by the compiler to generate optimal code. d) uses a shift/reduce procedure to generate a tree by starting A at the leaves. 7. The X-Bar hypothesis a) has been shown to be the mechanism the brain uses to decode sentences. b) is provably better than any programmable alternatives. c) can not capture inflection. D d) organizes linguistic elements as binary trees. Csc 350 Comp Ling Exam 2 Page 2 of 6 Name___ KEY ___ 66 points _____ 8. That a meaning representation scheme should possess verifiability means a) a sentence should have only one representation. b) there must be a defined relationship between the representation and the real world. c) there should be only one way to model the world at any one time. d) predicate logic can be used to prove the representation models B the world correctly. 9. Semantic ambiguity a) is caused by representational ambiguity. b) is an unavoidable consequence of natural language. c) can be resolved by using canonical forms for knowledge representation. B d) can be resolved by using an unambiguous grammar for the language. 10. A semantic attachment specifies a) how to compute the meaning representation of an entity from the meanings of its constituents. b) whether to use denotational, axiomatic, or operational semantics. c) how a unification grammar attaches features to each element of the parse tree. A d) one element of the set of tags attached to a corpus. 11. Lexical semantics a) relies on a grammar to ascribe meaning to a sentence. b) is the lexical analysis phase of parsing. c) is based strictly on part-of-speech tagging. D d) extracts the meaning of a sentence from individual words. 12. Window is a holonym of D a) portal b) house c) view d) pane 13. Reduplication refers to a) allowing redundant adjectives such as the "red, red bike". b) allowing synonymous adjectives such as the "ruby red lips". c) repetition of syllables to, for example, change inflection. C d) use of a part for the whole, as "fifty sails" for "fifty ships". 14. The concept of I-Language a) argues that language is intrinsic to the brain. b) explains how humans distinguish between internal and external events. c) explores languages which have no concept of second and third person. A d) is the next evolutionary step beyond H-Language - human language. Csc 350 Comp Ling Exam 3 Page 3 of 6 Name___ KEY ___ 66 points _____ Short Answer. 6 points each. Consider the following context free grammar, G, meant to describe a voice-activated flight control language. Terminals = { roll, pitch, yaw, right, left, up, down, clockwise, anticlockwise } Nonterminals = { Sen, Cmd, Arg } Productions (note that "|" is shorthand for another production) = { Sen -> Cmd Arg, Cmd -> roll | pitch | yaw, Arg -> right | left | up | down | clockwise | anticlockwise } 15. Note that the legal sentences should be "pitch up" and "pitch down", "yaw right" and "yaw left", and "roll clockwise" and "roll anticlockwise". Change the grammar by adding new nonterminals and productions and deleting existing nonterminals and productions as necessary so it accepts just these legitimate commands. Do not add parameters to the nonterminals. Answer: Sen -> Cmd1 Arg1 | Cmd2 Arg2 | Cmd3 Arg3 Cmd1 -> roll Cmd2 -> pitch Cmd3 -> yaw Arg1 -> clockwise | anticlockwise Arg2 -> up | down Arg3 -> right | left Csc 350 Comp Ling Exam 3 Page 4 of 6 Name___ KEY ___ 66 points _____ 16. Re-visit the original grammar, and instead of adding any terminals or nonterminals, add parameters to the existing nonterminals so the language accepted is just the six legitimate commands. Answer: Sen -> Cmd(Adv) Arg(Adv) Cmd(roll) -> roll Cmd(pitch) -> pitch Cmd(yaw) -> yaw Arg(roll) -> clockwise | anticlockwise Arg(pitch) -> up | down Arg(yaw) -> right | left Csc 350 Comp Ling Exam 3 Page 5 of 6 Name___ KEY ___ 66 points _____ Consider the following language, consisting of attack commands for playing a game of "battleship". (In "battleship", you direct a weapon to a particular (x,y) location; and if your opponent has a ship there, it sustains damage in relation to the power of the weapon used.) fire torpedo toward 10 20! launch missile at 80 75! : ! where the allowed verbs are: fire, launch, direct and the allowed prepositions are: toward, at and the allowed weapons are: torpedo, missile, APDU, Harpoon, Exocet and any verb can be used with any preposition. 17. Create a Prolog definite clause grammar to recognize these statements. Try to ensure that the specified coordinates are actually numbers - the predicate number/1 does that. sen --> verb, weapon, preposition, coord, coord, ['!']. verb --> [fire] ; [launch] ; [direct]. weapon --> [torpedo] ; [missile] ; ['APDU'] ; ['Harpoon'] ; ['Exocet']. preposition --> [toward] ; [at]. coord --> [X], { number(X) }. Csc 350 Comp Ling Exam 3 Page 6 of 6 Name___ KEY ___ 66 points _____ 18. Assuming there is a database stored as a predicate ocean/3, add actions to your rule(s) to specify whether or not a hit has occurred. Note that calling the predicate write('Hey! I\'ve been hit.') or something like that is adequate. Don't worry about whose navy the ships are in. An example database could be: ocean(battleship,101,55). ocean(cruiser,98,42). ocean(destroyer,75,85). ocean(carrier,55,15). sen --> verb, weapon, preposition, coord(X), coord(Y), ['!'], { ocean(_Ship,X,Y), write('Hey! I\'ve been hit.'); write('Missed me!'), nl } coord(X) --> [X], { number(X) }.