The Artima Developer Community
Sponsored Link

Java Buzz Forum
Friday C# Quiz: Know Your Closures

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Weiqi Gao

Posts: 1808
Nickname: weiqigao
Registered: Jun, 2003

Weiqi Gao is a Java programmer.
Friday C# Quiz: Know Your Closures Posted: May 2, 2008 8:28 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Weiqi Gao.
Original Post: Friday C# Quiz: Know Your Closures
Feed Title: Weiqi Gao's Weblog
Feed URL: http://www.weiqigao.com/blog/rss.xml
Feed Description: Sharing My Experience...
Latest Java Buzz Posts
Latest Java Buzz Posts by Weiqi Gao
Latest Posts From Weiqi Gao's Weblog

Advertisement

Although I've vowed not to post about closures anymore, I can't help but post one more quiz. I know Friday is mostly over for many of my readers, but there are still a few time zones left.

Without downloading Microsoft Visual C# 2008 Express Edition and compiling the following C# source file, answer the following question:

Q: Will the following program

public delegate int IntToInt(int i);

public class Foo {
  public static IntToInt fib =
    n => n == 0 ? 0 :
         n == 1 ? 1 :
         fib(n - 1) + fib(n - 2);

  public static void Main() {
    System.Console.WriteLine(fib(6));
  }
}

compile? Run? If so, what will it print out?

Read: Friday C# Quiz: Know Your Closures

Topic: Deliver On-the-Fly Mapping Services to Your Rich Desktop Java Application, Part 3 Previous Topic   Next Topic Topic: Demo for Elaine

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use