ExamVeda
Login
Home
41
What will be the output of the following C# code snippet?
{
    try 
    {
        int a, b;
        b = 0;
        a = 10 / b;
        Console.WriteLine("A");
    }
    catch(ArithmeticException e) 
    {
        Console.WriteLine("B");        	
    }
    Console.ReadLine();
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
42
What will be the output of the following C# code snippet?
class Output 
{
    public static void main(String args[]) 
   {
       try 
       {
           int a = 0;
           int b = 5;
           int c = a / b - 5;
           Console.WriteLine("C");
       }
       finally 
       {
           Console.WriteLine("sharp");
       } 
   }
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
43
What will be the output of the following C# code?
{
    try 
    {
        int i, sum;
        sum = 10;
        for (i = -1 ;i < 3 ;++i) 
        {
            sum = (sum / i);
            Console.WriteLine(i);
        }
    }
    catch(ArithmeticException e) 
    {
        Console.WriteLine("0");
    }
    Console.ReadLine();
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
44
What will be the output of the following C# code?
{
    try 
    {
        int []a = {1, 2, 3, 4, 5};
        for (int i = 0; i < 5; ++i) 
        Console.WriteLine(a[i]);
        int x = (1 / Convert.ToInt32(0));
    }
    catch(IndexOutOfRangeException e) 
    {
        Console.WriteLine("A");        	
    }
    catch(ArithmeticException e) 
    {     	
        Console.WriteLine("B");
    }
    Console.ReadLine();
}
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
45
What will be the output of the following C# code snippet?
class Program
{
    public static void Main(string[] args)
    {
        try
        {
            int a = 1;
            int b = 10 / a;
            try
            {
                if (a == 1)
                    a = a / a - a;
                if (a == 2)
                {
                    int[] c = { 1 };
                    c[8] = 9;
                }
            }
            finally
            {
                Console.WriteLine("A");
            }
       }
       catch (IndexOutOfRangeException e)
       {
            Console.WriteLine("B");
       }
       Console.ReadLine();
   }
}
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
46
Which of the following keywords is used by the calling function to guard against the exception that is thrown by called function?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
47
What will be the output of the following C# code snippet?
{
    try 
    {
        int a, b;
        b = 0;
        a = 5 / b;
        Console.WriteLine("A");
    }
    catch(ArithmeticException e) 
    {
        Console.WriteLine("B");
    }
    finally
    {
        Console.WriteLine("C");
    }
    Console.ReadLine();
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
48
Which of the keywords are used for the block to be examined for exceptions?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
49
Where the properties can be declared?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
50
What will be the output of the following C# code?
class number
{
    int length = 60;
    public int number1
    {
        get
        {
            return length;
        }
    }
}
class Program
{
    public static void Main(string[] args)
    {
        number p = new number();
        int l;
        l = p.number1 + 40;
        int k = l * 3 / 4;
        Console.WriteLine(k);
        Console.ReadLine();
    }
 }
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board