CS 355 FINAL EXAM (take home) Name__________________________________ Fall 2002 Pledge________________________________ (1). How is "protected" in C++ different from "public" or "private"? (2). C (and C++) have some interesting syntax when it comes to array names such as pointer arithmetic. Why? (3). Give a single regular expression for float numerical literals that are found in C/C++. (4). In C++, the generalization relationship between classes is invoked through inheritance. How can C++ build an aggregation relationship? (5). What is the output of the following ML code? (the "map" function behaves just as it does in scheme and takes the following format: map ( fun, list ). ) fun square(x:int) = x*x; map (~, map (square, map (~, [1,2,3] ))); (6). "LISP is a pure functional while ML is a hybrid." Support or refute this statement. (7). We refered to Ada tasks as "servers" and "clients" where the servers contained only entries/accepts and the clients contained only calls to servers. It is possible to have tasks which contain both. Could this be a bad idea? If so, why? Give pseudo-code or a diagram(not Ada) with calls and entries to justify your answer. (8). What does the following Scheme function do? ( define ( xxx a b ) ( cond ( ( null? a ) b ) ( else ( xxx ( cdr a ) ( cons ( car a ) b ) ) ) ) ) (9). What C programming construct allows for member functions to be easily included in structs just like they are in C++ classes and structs? (10). As simple as it was, FORTRAN is mother of all relevent programming languages. Explain.