38
335 Review Game 1

335 Review Game 1. Teams Zack, Jamie, Alex D, Marshall Colby, Riley, Alex Z, Fritz Lawrence, Paul, Gavan, Ben Catharine, Matt, Andrew, Alexis Spencer,

Embed Size (px)

Citation preview

335 Review Game 1

Teams

• Zack, Jamie, Alex D, Marshall• Colby, Riley, Alex Z, Fritz• Lawrence, Paul, Gavan, Ben• Catharine, Matt, Andrew, Alexis• Spencer, Jerry, Emily, Michelle• Dawn, David, Malecki, Casey• John, Tim, Lisa, Z, Rohan• Zane, Hugh, Dillon, Patrick

Individual round

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.

• What does the java keyword “static” refer to?

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 = 0for 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)

27.

• What is a stream in Java 8?

28.

• What is a lambda function?

29.

• What are the 2 main ways to obtain a Class object in Java?

30.

• Is this deterministic?

31.

• How many strings are in this language?

32.

• What strings are in this language?

All-Play

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”]}