CSC 123 Scary Test A "scary test" tries to scare you into studying really hard for the real test. Answer the following questions to the best of your ability: 1. Write a function in Scheme or Perl that returns 1 the first time it's called, -1 the second time, 1 the third time, etc ..., always alternating between -1 and +1. Don't use global variables. 2. Write a code fragement in Scheme, C or Perl that will behave differently depending on whether static or dynamic scoping is used. If Perl is used, explain how to make the change from static to dynamic scoping. 3. Assume that the C# classes B and C both extend superclass A, and that there is no further inheritance relationship between these classes. Assume also that: A a1 = new A(); A a2 = new B(); B b; C c = new C(); Which of the following type casts are valid? Which will fail at compile time, and which at runtime? b = (B)a1; b = (B)a2; b = (B)c; 4. Write the interface for observee objects of the Observer pattern