Programming Languages an exam for Gabe Lein as part of his Plan for Jim Mahoney and Matt Ollis Handed out : Wed Nov 15 2006 Due : midnight Wed Nov 22 2006 Like the last one, this is an open exam: books or web sources are OK as long as you cite them explicitly. Don't ask other people for help. Your job is to convince us you understand this stuff. As we discussed, this exam will test your fluency and understanding of two languages : Perl and C++. For all the following, therefore, try to follow 'best practices' for each language, including documentation and tests as would typically be done in that language. As always with my exams, if you think there's a mistake in one of the questions or it doesn't make sense, you can (a) ask for clarification, and/or (b) make and state an explicit interpretation and do the problem that way. (Again: the point is to demonstrate your understanding, not to get the "right answer" per se.) Good luck. 1. General discussion of the languages Discuss the similarities, differences, strengths, weaknesses, and properties of Perl and C++, including a description of the following languages ideas and how they apply (or don't) to the two languages. Give brief examples where appropriate. As usual, cite your sources. * object oriented programming * libraries and/or standard packages * compiled vs interpreted * pass-by-value vs pass-by-reference * data structures * how each variable's 'scope' is handled: globals etc * file organization: header files, packages, modules, etc * file types and common extensions 2. Object oriented vs procedural / Perl vs C++ Write 4 programs (one in procedural Perl, one in procedural C++, one in object-oriented Perl, and one in object-oriented C++) to search for solutions to the 'perfect squares crossword puzzle', namely to place thirteen 3-digit perfect squares (for example 121 = 11**2) in the following crossword pattern. Discuss briefly how well this problem fits these languages and programming styles. Which would have been your first choice if you'd wanted to do this? Why? * * * * * * * * * * * * * * * * * * * * * * * * * 3. A typical C++ program Write a C++ program to solve a (smallish) problem of your choice that's related to computer security. Pick a problem that's well suited to C++. You may use external libraries if you wish. Include tests, documentation, and examples. 4. A typical Perl program Ditto for Perl. You may use CPAN if you wish.