Sample Problems -- CMSC 331 -- Spring 17

Stuff to Study and/or Think About

	
1.  What are the types of the following:

    fun zed x = x + 1;
 
    fun f g (a,b) = (f g a, g f b);

    fun f [] = 0 |
        f (a::b) = a + (f b);
        

2.  Write a ML function to sort a list of strings.

3.  Use a trth table to show that    ~(A \/ B) =  (~A /\ ~B)

4.  Write a grammar which generates all of the sentences  (abc)^n
    (n>0 copies of abc)

5)  Write the ML code to implement the stack Data Structure:
     
     top(empty) = ERROR     pop(empty) = empty
     top(push(a,S)) = a     pop(push(a,S)) = S

6)  Write a BNF grammar for the propositional calcuulus.
 
    Then, write an EBNF version.

7)  Write a ruby function to find the smallest int in an int list.

8)  Can a declarative language be implemented using a Von Neumann architecture?

9)  Does limiting access to each of the forks in the dining philosophers problem avoid all deadlock?

    How about using Monitors to control access to the forks?

10) Given the definitions:
     2 = \f . \x. f (f x)
     plus = \m. \n. \f. \x. m f (n f x)

     compute the value of (plus 2 2)

11) Is it possible to pass objects by value?  Discuss.

12) Compare and contrast cooperative/competitive synchronization.

13) Give two reasons why languages need to provide support for concurrency.

14) Describe two unique features of Ruby Exception Handling.

15) Why do many languages allow multiple catches in a try-catch construct?

16) Semaphores are made up of what two primary structures?

17) Which types of parameters (in/out/in-out) can be used in a recursive function.