IndiaBIX
IndiaBIX
Start typing & press "Enter" or "ESC" to close
  • Home
  • Jobs
  • Results
  • Current Affairs
  • GK
  • Online Test
  • HR Interview
  • BLOG

Exception Handling - General Questions

  • Home
  • Computer Science & Engineering
  • C# Programming Questions and Answers
  • Exception Handling - General Questions
1. 

It is compulsory for all classes whose objects can be thrown with throw statement to be derived from System.Exception class.

 

A. True
B. False

Answer: Option B

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

2. 

Which of the following statements is correct about the C#.NET program given below if a value "ABCD" is input to it?

using System;
namespace IndiabixConsoleApplication
{
class MyProgram
{
static void Main(string[] args)
{
int index;
int vat = 88;
int[] a = new int(5];
try
{
Console.Write("Enter a number: ");
index = Convert.Toint32(Console.ReadLine());
a[index] = val;
}
catch(Exception e)
{
Console.Write("Exception occurred");
}
Console.Write("Remaining program");
}
}
}

A. It will output: Exception occurred
B. It will output: Remaining program
C. It will output: Remaining program Exception occurred
D. It will output: Exception occurred Remaining program
E. The value 88 will get assigned to a[0].

Answer: Option D

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

3. 

Which of the following is NOT an Exception?

 

A. StackOverflow
B. Division By Zero
C. Insufficient Memory
D. Incorrect Arithmetic Expression
E. Arithmetic overflow or underflow

Answer: Option D

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

4. 

All code inside finally block is guaranteed to execute irrespective of whether an exception occurs in the protected block or not.

 

A. True
B. False

Answer: Option A

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

5. 

Which of the following statements is correct about the C#.NET program given below if a value "ABCD" is input to it?

using System;
namespace IndiabixConsoleApplication
{
class MyProgram
{
static void Main(string[] args)
{
int index;
int val = 55;
int[] a = new int[5];
try
{
Console.Write("Enter a number: ");
index = Convert.ToInt32(Console.ReadLine());
a[index] = val;
}
catch(FormatException e)
{
Console.Write("Bad Format ");
}
catch(IndexOutOfRangeException e)
{
Console.Write("Index out of bounds ");
}
Console.Write("Remaining program ");
}
}
}

A. It will output: Bad Format
B. It will output: Remaining program
C. It will output: Index out of bounds
D. It will output: Bad Format Remaining program
E. It will output: Index out of bounds Remaining program

Answer: Option D

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

6. 

Which of the following statements is correct about the C#.NET program given below if a value "6" is input to it?

using System;
namespace IndiabixConsoleApplication
{
class MyProgram
{
static void Main (string[] args)
{
int index;
int val = 66;
int[] a = new int[5];
try
{
Consote.Write("Enter a number: ");
index = Convert.ToInt32(Console.ReadLine());
a[index] = val;
}
catch(Exception e)
{
Console.Write("Exception occurred ");
}
Console.Write("Remaining program ");
}
}
}

A. It will output: Exception occurred
B. It will output: Remaining program
C. It will output: Exception occurred Remaining program
D. It will output: Remaining program Exception occurred
E. The value 66 will get assigned to a[6].

Answer: Option C

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

7. 

Exceptions can be thrown even from a constructor, whereas error codes cannot be returned from a constructor.

 

A. True
B. False

Answer: Option A

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

8. 

Which of the following statements are correct about exception handling in C#.NET?

1 try blocks cannot be nested.

2 In one function, there can be only one try block.

3 An exception must be caught in the same function in which it is thrown.

4 All values set up in the exception object are available in the catch block.

5 While throwing a user-defined exception multiple values can be set in the exception, object.

 

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

Answer: Option D

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

  • 1
  • 2
  • 3

Questions & Answers

Aptitude Chemical Engineering Civil Engineering Computer Science & Engineering Current Affairs Data Interpretation Electrical & Electronics Engineering Electronics & Communication Engineering General Knowledge Logical Reasoning Mechanical Engineering Non Verbal Reasoning Verbal Ability Verbal Reasoning

Interviews

HR Interview

Jobs

Sarkari Jobs

Results

Rojgar ResultSarkari Result

Admission

Admission 2023

Admit Card

Admit Card 2023

Answer Key

Answer Key 2023
copyright
Privacy Policy
© 2025 IndiaBIX. All Rights Reserved.

Report