1.
In C#, what is the output of the following code?

using System;
using System.Web;
using System.Net;
using System.IO;


class test {
    static void Main(string[] args) {
        int ch;
        HttpWebRequest req = (HttpWebRequest) WebRequest.Create("http://www.McGraw-Hill.com");
        HttpWebResponse resp = (HttpWebResponse) req.GetResponse();
        Stream istrm = resp.GetResponseStream();
        for (int j = 1;; j++) {
            ch = istrm.ReadByte();
            if (ch == -1)
                break;
            Console.Write((char) ch);
            if ((j % 400) == 0) {
                Console.Write(" Press Enter.");
                Console.ReadLine();
            }
        }
        resp.Close();
    }
}
2.
What is the output of the following C# code:

using System;
using System.Net;

class Program {
    static void Main(string[] args) {
        Uri obj = new Uri("http://www.yahoo.com/");
        Console.WriteLine(obj.AbsoluteUri);
    }
}
3.
In C#, what is the output of the following code?

public class test {
    int wid;
    int hei;
    int len;
    int vol;
    void vol1(int hei, int len, int wid) {
        vol = wid * hei * len;
    }
}
class Prameterized {
    static void main(String[] args) {
        test obj = new test();
        obj.hei = 1;
        obj.len = 5;
        obj.wid = 5;
        obj.vol(3, 2, 1);
        Console.WriteLine(obj.vol);
        Console.ReadLine();
    }
}
4.
In C#, what will be the output of the following code?

class square {
    public int width;
    public int height;
    public int length;
    public int volume1;
    public void volume() {
        volume1 = width * height * length;
    }
    public void volume(int x) {
        volume1 = x;
    }
}
class Program {
    static void Main(string[] args) {
        square obj = new square();
        obj.height = 1;
        obj.length = 5;
        obj.width = 5;
        obj.volume(5);
        Console.WriteLine(obj.volume1);
        Console.ReadLine();
    }
}
5.
In C#, what is the output of the following code?

#define DEBUG
# undef DEBUG
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication13 {
    class Program {
        static void Main(string[] args) {#
            if (DEBUG)
                Console.WriteLine("DEBUG is described");#
            elif(!DEBUG && MYTEST)
            Console.WriteLine("MYTEST is described");#
            elif(DEBUG && MYTEST)
            Console.WriteLine("DEBUG and MYTEST are described");#
            else
                Console.WriteLine("DEBUG and MYTEST are not described");#
            endif
            Console.ReadLine();
        }
    }
}
6.
In C#, what is the output of the following code?

class MyClass {
    char[] character = {
        'W', 'X', 'Y', 'Z'
    };
    public System.Collections.IEnumerator GetEnumerator() {
        foreach(char ch in character)
        yield
        return ch;
    }
}
class Program {
    static void Main(string[] args) {
        MyClass bc = new MyClass();
        foreach(char ch in bc)
        Console.Write(ch + " ");
        Console.WriteLine();
        Console.ReadLine();
    }
}
7.
Consider the following C# code snippet, which of the following statement is true?
public System.Collections.IEnumerator GetEnumerator()
{
foreach (char chr in character)
yield return ch;
}
8.
In C#, what is the output of the following code?

using System;
using System.Collections;
class MyClass {
    char chrs = 'X';
    public IEnumerator GetEnumerator() {
        for (int i = 20; i >= 0; --i) {
            if (i == 10) yield
            break;
            yield
            return (char)((chrs + i));
        }
    }
    class Program {
        static void Main(string[] args) {
            MyClass mc = new MyClass();
            foreach(char chrs in mc)
            Console.Write(chrs + " ");
            Console.WriteLine();
            Console.ReadLine();
        }
    }
}
9.
In C#, what is the output of the following code?

using System;
using System.Collections;
class MyClass {
    char ch = 'B';
    public IEnumerable MyItr(int end) {
        for (int i = 0; i < end; i++)
            yield
        return (char)(ch + i);
    }
    public IEnumerable MyItr(int begin, int end) {
        for (int i = begin; i < end; i++)
            yield
        return (char)(ch + i);
    }
}
class Program {
    static void Main(string[] args) {
        MyClass bc = new MyClass();
        Console.WriteLine("Iterate the first 7 letters:");
        foreach(char ch in bc.MyItr(7))
        Console.Write(ch + " ");
        Console.WriteLine("n");
        Console.WriteLine("Iterate letters from F to L:");
        foreach(char ch in bc.MyItr(7, 12))
        Console.Write(ch + " ");
        Console.WriteLine();
        Console.ReadLine();
    }
}
10.
In C#, what is the output of the following code?
using System;
using System.Collections;
class MyClass {
    char ch = 'A';
    int x = 4;
    int y = 9;
    int z = 6;
    public IEnumerator GetEnumerator() {
        for (int i = 0; i < 26; i++) {
            if (i == x * y / z) yield
            break;
            yield
            return (int)(ch + i);
        }
    }
}
class Program {
    static void Main(string[] args) {
        MyClass mc = new MyClass();
        foreach(int ch in mc)
        Console.Write(ch + " ");
        Console.WriteLine();
        Console.ReadLine();
    }
}