My Report

C# Programming Mock Test 9


Correct Answer: 2 points | Wrong: -1 point
Grades: A* (100% score) | A (80%-99%) | B (60%-80%) | C (40%-60%) | D (0%-40%)
advertisement
 10%

Question 1 of 10

1. Which of these data members of HttpResponse class is used to store the response from a http server?

Question 1 of 10

Question 2 of 10

2. Which of these data types can be used for a method having a return statement in it?

Question 2 of 10

Question 3 of 10

3. Which of the following functions return absolute value of a variable?

Question 3 of 10

Question 4 of 10

4. What will be the output of the following C# code snippet?

class MyClass
{
    char ch = 'A';
    int e = 4;
    int k = 9;
    int z = 6;
    public IEnumerator GetEnumerator()
    {
        for (int i = 0; i < 26; i++)
        {
            if (i == e*k /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();
    }
}

Question 4 of 10

Question 5 of 10

5. What will be the following C# code snippet specify?

class MyClass
{
    char chrs = 'A' ;
    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 ch in mc)
        Console.Write(ch + " ");
        Console.WriteLine();
        Console.ReadLine();
    }
}

Question 5 of 10

Question 6 of 10

6. Which method is used to abort thread prior to it's normal execution?

Question 6 of 10

Question 7 of 10

7. Which among the following is the correct statement about the using statement used in C#.NET?

Question 7 of 10

Question 8 of 10

8. What is mutex?

Question 8 of 10

Question 9 of 10

9. What will be the output of the following C# code snippet?

class box
{
    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)
    {
        box obj = new box();
        obj.height = 1;
        obj.length = 5;
        obj.width = 5;
        obj.volume(5);
        Console.WriteLine(obj.volume1);        
        Console.ReadLine();
    }
}

Question 9 of 10

Question 10 of 10

10. What kind of exception is being thrown if Wait(), Pulse() or PulseAll() is called from code that is not within synchronized code?

Question 10 of 10


 

Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.