CECS 424 Midterm Study Guide The numbers refer to projects. These are not exam questions but questions will be based on them and the material they represent. Illustrate each answer with examples. One way or another examples will be the focus of the exam. Either you write them or I write them and ask you about them. 1. a. Explain with examples the difference between static typing in C# and dynamic typing in Ruby. b. Explain dynamic binding in C#. 2. a. How does the grammar in C# allow one to determine what can appear in a C# program not nested inside anything else? b. To what Ruby class do top-level variables and methods belong? What access do they have in other Ruby classes? 3. a. What can a Ruby module contain? What differentiates a module from a class? What is the point of putting instance methods in a module? What instance methods does Comparable contain and how are they used? b. If a class is defined in a C# namespace, how does one instantiate that class outside of that namespace? What does that imply about reusing that classes name? c. How does a C# class implement the IComparable interface? 4. a. What does an attribute accessor declaration in Ruby provide? How does one define an attribute getter and setter where the attribute is not itself stored but is computed from a stored attribute? b. How are attributes used in a program? How does this differ from methods? c. How does one define a property in C#? How are properties used in a C# program? How does this differ from methods? 5. Show how to define and use arrays in Ruby and hash tables in Ruby and C#. 6. Explain the regular expression syntax. Be able to interpret regular expressions and find matches. 7. a. A Ruby iterator is a method that can invoke a block of code. Illustrate how that works, using the yield statement. b. Show how the find method of the Array class could be implemented. How is find used? 8. a. Define and use Ruby methods with a variable number of parameters and with a block parameter. b. A block is a closure. It remembers the context in which it was defined. The lambda method creates a Proc object from a block. Give examples of the definition and use of closures in Ruby. 9. a. Show how an iterator method in the Ruby File class can be used to pass a file to a block. b. Show how an iterator method in the IO class can be used to pass each line of a file to a block. c. Give examples of exception handling in Ruby. d. Give an example of file use and exception handling in C#. 10. Know the steps for creating a Rails application, including MVC. 11. a. Understand the idea of a generic type. Illustrate with C# generics. b. Be able to write a C# 2.0 iterator and use it.