logo

CuriousTab

CuriousTab

Discussion


Home C# Programming Exception Handling See What Others Are Saying!
  • Question
  • Which of the following statements are correct about exception handling in C#.NET?

    1. If our program does not catch an exception then the .NET CLR catches it.
    2. It is possible to create user-defined exceptions.
    3. All types of exceptions can be caught using the Exception class.
    4. CLRExceptions is the base class for all exception classes.
    5. For every try block there must be a corresponding finally block.


  • Options
  • A. 1 and 2 only
  • B. 1, 2 and 3 only
  • C. 4 and 5 only
  • D. All of the above
  • E. None of the above

  • Correct Answer
  • 1, 2 and 3 only 


  • More questions

    • 1. Which of the following code snippets are the correct way to determine whether a is Odd or Even?

      1. int a;
        String res; 
        if (a % 2 == 0)
            res = "Even"; 
        else 
            res = "Odd";
      2. int a; 
        String res; 
        if (a Mod 2 == 0) 
            res = "Even"; 
        else
            res = "Odd";
      3. int a;
        Console.WriteLine(a Mod 2 == 0? "Even": "Odd");
      4. int a; 
        String res;
        a % 2 == 0? res = "Even" : res = "Odd";
        Console.WriteLine(res);

    • Options
    • A. 1, 3
    • B. 1 Only
    • C. 2, 3
    • D. 4 Only
    • E. None of these
    • Discuss
    • 2. What will be the output of the C#.NET code snippet given below?

      int a = 10, b = 20, c = 30; 
      int res = a < b? a < c? c : a : b; 
      Console.WriteLine(res);

    • Options
    • A. 10
    • B. 20
    • C. 30
    • D. Compile Error / Syntax Error
    • Discuss
    • 3. How can you prevent inheritance from a class in C#.NET?

    • Options
    • A. Declare the class as shadows.
    • B. Declare the class as overloads.
    • C. Declare the class as sealed.
    • D. Declare the class as suppress.
    • E. Declare the class as override.
    • Discuss
    • 4. There is no private or protected inheritance in C#.NET.

    • Options
    • A. True
    • B. False
    • Discuss
    • 5. Which of the following is NOT an Arithmetic operator in C#.NET?

    • Options
    • A. **
    • B. +
    • C. /
    • D. %
    • E. *
    • Discuss
    • 6. The space required for structure variables is allocated on stack.

    • Options
    • A. True
    • B. False
    • Discuss
    • 7. Is it possible to invoke Garbage Collector explicitly?

    • Options
    • A. Yes
    • B. No
    • Discuss
    • 8. It possible to create a custom attribute that can be applied only to specific programming element(s) like ____ .

    • Options
    • A. Classes
    • B. Methods
    • C. Classes and Methods
    • D. Classes, Methods and Member-Variables
    • Discuss
    • 9. C#.NET structures are always value types.

    • Options
    • A. True
    • B. False
    • Discuss
    • 10. What does the following C#.NET code snippet will print?

      int i = 0, j = 0; 
      
      label:
          i++;
          j+=i;
      if (i < 10)
      {
          Console.Write(i +" ");
          goto label; 
      }

    • Options
    • A. Prints 1 to 9
    • B. Prints 0 to 8
    • C. Prints 2 to 8
    • D. Prints 2 to 9
    • E. Compile error at label:.
    • Discuss


    Comments

    There are no comments.

Enter a new Comment