Vidyalelo
C# Programming · all questions

Miscellaneous in C Sharp
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

170

Questions

9/9

Page

Pick an option on a question to see the right answer and solution.

Did method use to remove whitespace from the string?

Select an option to see the answer and solution.

Which of these base class are accessible to the derived class members?

Select an option to see the answer and solution.

What are the advantages of the named iterator?

Select an option to see the answer and solution.

The wrong statements about a HashTable collection are?

Select an option to see the answer and solution.

What will be the output of the following C# code snippet?
class A
{
    int i;
    int j;
    public A()
    {
        i = 1;
        j = 2;
    }
}
class Program
{
    static void Main(string[] args)
    {
       A obj1 = new A();
       Console.WriteLine(obj1.ToString());
       Console.ReadLine();
    }
}

Select an option to see the answer and solution.

What will be the output of the following C# code snippet?
class access
{
    public int x;
    private int y;
    public  void cal(int a, int b)
    {
        x = a + 1;
        y = b;
    }
    public  void print() 
   {
       Console.WriteLine(" " + y);     
   } 
}    
class Program
{
    static void Main(string[] args)
    {
        access obj = new access();   
        obj.cal(2, 3);
        Console.WriteLine(obj.x);
        obj.print();
        Console.ReadLine();
    }
}

Select an option to see the answer and solution.

What will be the output of the following C# code snippet?
static void Main(string[] args)
{
    string s = " i love you";
    Console.WriteLine(s.IndexOf('l') + "  " + s.lastIndexOf('o') + "  " + s.IndexOf('e'));
    Console.ReadLine();
}

Select an option to see the answer and solution.

What will be the output of the following C# code snippet?
class Program
{
    static void Main(string[] args)
    {
        String s1 = "CSHARP";
        String s2 = s1.Replace('H','L');
        Console.WriteLine(s2);
        Console.ReadLine();
    }
}

Select an option to see the answer and solution.

Which among the given classes provides types of rounding functions?

Select an option to see the answer and solution.

What will be the output of the following C# code snippet?
class MyClass
{
    char[] chrs = { 'A', 'B', 'C', 'D' };
    public System.Collections.IEnumerator GetEnumerator()
    {
        foreach (char ch in chrs)
        yield return ch;
    }
}
class Program
{
    static void Main(string[] args)
    {
        MyClass mc = new MyClass();
        foreach (char ch in mc)
        Console.Write(ch + " ");
        Console.WriteLine();
        Console.ReadLine();
    }
}

Select an option to see the answer and solution.