ExamVeda
Login
Home
31
What is the term for an exception that occurs during the execution of a program in C#?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
32
In C#, what is the purpose of the using statement in exception handling?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
33
Which keyword is used to specify a block of code where an exception might occur in C#?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
34
In C#, which class is the base class for all exceptions?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
35
What is the purpose of the catch block in C# exception handling?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
36
What is the term for handling an exception and continuing program execution in C#?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
37
In C#, what happens if an exception is thrown inside a finally block?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
38
What is the purpose of the try-catch block in C#?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
39
Which statement is used to specify code that should always run regardless of whether an exception occurs in C#?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
40
What will be the output of the following C# code?
class student
{
    int []scores = new int[3] {13, 32, 24};
    public int this[int index]
    {
        get
        {
            if (index < 3)
            return scores[index];
            else
            {
                Console.WriteLine("invalid index");
                return 0;
            }
        }
        private  set
        {
            if (index < 3)
            scores[index] = value;
            else
            Console.WriteLine("invalid index");
        }
    }
}
class Program
{
    public static void Main(string[] args)
    {
        student s = new student();
        int[] scores1 = new int[3] {8, 19, 40};
        for (int i = 0; i < 3; i++)
        {
            if (scores1[i] > s[i])
            {
                Console.WriteLine(" scores1 had greater value :" + scores1[i]);
            }
            else
            {
                Console.WriteLine("scores had greater value :" + s[i]);
            }
        }
        Console.ReadLine();
    }
}
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board