logo

CuriousTab

CuriousTab

Discussion


Home C# Programming Exception Handling See What Others Are Saying!
  • Question
  • Which of the following statements are correct about the exception reported below?
    Unhandled Exception: System.lndexOutOfRangeException:
    Index was outside the bounds of the array.
    at CuriousTabConsoleApplication.Program.Main(String[] args) in
    D:\ConsoleApplication\Program.cs:line 14

    1. The program did not handle an exception called IndexOutOfRangeException.
    2. The program execution continued after the exception occurred.
    3. The exception occurred in line number 14.
    4. In line number 14, the program attempted to access an array element which was beyond the bounds of the array.
    5. The CLR could not handle the exception.


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

  • Correct Answer
  • 1, 3 and 4 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