330 likes | 409 Views
335 Review Game 1. Teams. James, George, Becca , Alex Daniels Asher, Rex, Peter D, Colin Josh, Emily, Nick, Chad Emma, Alex Dawson, Jacopo, Peter T Heather, Brian, Matt, Eric Evan , Ryan, Todd, Sam. Individual round. 1. Describe Java in terms of: Generation? Paradigm?. 2.
E N D
Teams • James, George, Becca, Alex Daniels • Asher, Rex, Peter D, Colin • Josh, Emily, Nick, Chad • Emma, Alex Dawson, Jacopo, Peter T • Heather, Brian, Matt, Eric • Evan, Ryan, Todd, Sam
1. • Describe Java in terms of: • Generation? • Paradigm?
2. • Describe Java in terms of: - Declarative/Procedural? - Compiled/ Interpreted?
3. • Describe Python in terms of: • Generation? • Paradigm?
4. • Describe Python in terms of: - Declarative/Procedural? - Compiled/ Interpreted?
5. • What is reflection?
6. • What does it mean to say a variable is hidden?
7. • What kind of data structure is the symbol table?
8. • What does it mean for a language to be statically scoped?
9. Is it deterministic? Finite? What language?
10. • Give a pro and a con of a language offering reflection.
11. • What is forward-referencing?
12. • What makes a language regular?
13. • What are the 2 ways to make an automaton non-deterministic?
14. • Give a pro and a con for a language being very high level.
15. • What does it print? s = “Hello” print s[:2]
16. • What is the difference? x = [] y = {}
17. If L1 = {abn, n> 0} and L2 = {anb2n, n>0} what is L1 intersect L2?
18. • If L1 = {abn, n> 0} what is L1*?
19. What does it do? def mystery(lst): sec = 0 for x in lst: sec += len(x) return sec
20. NFA or DFA? Give 2 strings NOT in the language.
21. • Name the kind of problem where Java would be a better choice of language than Python
22. • For this code, tell what generation it is and what paradigm it belongs to. parent(X,Y) if mom(X,Y) or dad(X,Y). grandParent(X,Y) if parent(X,Z) and parent(Z,Y). mom(sue, sally).
23. • Give an example of a program that cannot be written without reflection.
24. • In Java reflection, what is a field?
25. • What is a scripting language?
26. • For this code, tell what generation it is and whether it is declarative or procedural. ADD(R1, 3)MUL(R1, 5) STO(R1,2032)
int a = 2 • int b = 1 • Main(): • a=3 • b=7 • int x = 10 • A(x) • A(x): • int a = -3 • Print x • B(x) • B(x): • Print a What is the symbol table on line 13 if there is static scoping? If Main calls A which calls B, & there’s dynamic scoping, what is symbol table on line 13?
Write the automata • Draw an automaton for the language of all strings on {a,b}* that start with aa but do NOT contain the substring bb.
Write a Python method that takes a list of strings called lst and makes a dictionary where the keys are the lengths of the words and the values are the words themselves • lst = [“yeah”, “this”, “rocks”] • {4:[“yeah”, “this”], 5:[“rocks”]}