Skip to main content

Exception Handling In C Sharp — Part 2 MCQs with Explanations

Practice high-yield Programming & Software Development MCQs on Exception Handling In C Sharp — Part 2 with worked academic solutions for FPSC, PPSC, NTS, NITB, PTS.

Questions
40
Difficulty Level
Exam-Level
Target Exams
FPSC, PPSC, NTS...
Estimated Time
48 mins
Exam-Level FPSC PPSC NTS NITB PTS
Verified for Commission Syllabus • Oct 14, 2026
40

Verified Practice Questions

Interactive test mode with detailed academic worked solutions

Live Progress | 0/40 answered
✓ 0 correct ✗ 0 wrong 0% score
Question 1 of 40
★ FPSC ★ PPSC

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(); }

Question 2 of 40
★ FPSC ★ PPSC

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(); }

Question 3 of 40
★ FPSC ★ PPSC

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(); } }

Question 4 of 40
★ FPSC ★ PPSC

Which of the following keywords is used by the calling function to guard against the exception that is thrown by called function?

Question 5 of 40
★ FPSC ★ PPSC

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(); }

Question 6 of 40
★ FPSC ★ PPSC

Which of the keywords are used for the block to be examined for exceptions?

Question 7 of 40
★ FPSC ★ PPSC

Where the properties can be declared?

Question 8 of 40
★ FPSC ★ PPSC

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(); } }

Question 9 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code? class Output { public static void main(String args[]) { try { int a = 10; int b = 5; int c = a / b - 5; Console.WriteLine("Hi"); } catch(Exception e) { Console.WriteLine("hello"); } } }

Question 10 of 40
★ FPSC ★ PPSC

Choose the wrong statement about the properties used in C#.NET?

Question 11 of 40
★ FPSC ★ PPSC

Which of these keywords is not a part of exception handling?

Question 12 of 40
★ FPSC ★ PPSC

Which of the following is the object oriented way to handle run time errors?

Question 13 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code snippet? class program { public static void Main(string[] args) { try { throw new NullReferenceException("C"); Console.WriteLine("A"); } catch (ArithmeticException e) { Console.WriteLine("B"); } Console.ReadLine(); } }

Question 14 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code snippet? class program { public static void Main(string[] args) { try { int a = args.Length; int b = 1 / a; Console.WriteLine(a); } catch (ArithmeticException e) { Console.WriteLine("1"); } Console.ReadLine(); } }

Question 15 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code? class Output { public static void main(String args[]) { try { int a = 5; int b = 10; int c = b / a - 5; Console.WriteLine("Csharp"); } } }

Question 16 of 40
★ FPSC ★ PPSC

Choose the correct statement among the following?

Question 17 of 40
★ FPSC ★ PPSC

Which of these keywords are used for generating an exception manually?

Question 18 of 40
★ FPSC ★ PPSC

Choose the keyword which declares the indexer?

Question 19 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code? { try { int []a = {1, 2, 3, 4, 5}; for (int i = 0; i < 7; ++i) Console.WriteLine(a[i]); } catch(IndexOutOfRangeException e) { Console.WriteLine("0"); } Console.ReadLine(); }

Question 20 of 40
★ FPSC ★ PPSC

Select the modifiers which can be used with the properties?

Question 21 of 40
★ FPSC ★ PPSC

Which of the following is the wrong statement about exception handling in C#.NET?

Question 22 of 40
★ FPSC ★ PPSC

Which of these keywords are used for the block to handle the exceptions generated by try block?

Question 23 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code? class student { int []scores = new int[5] {23, 42, 54, 11, 65}; public int this[int index] { get { if (index < 5) return scores[index]; else { Console.WriteLine("invalid index"); return 0; } } set { if (index < 5) scores[index] = value; else Console.WriteLine("invalid index"); } } } class Program { public static void Main(string[] args) { student s = new student(); Console.WriteLine(s[4] + 8); Console.ReadLine(); } }

Question 24 of 40
★ FPSC ★ PPSC

Select the statements which describe the correct usage of exception handling over conventional error handling approaches?

Question 25 of 40
★ FPSC ★ PPSC

Which of these exceptions will occur if we try to access the index of an array beyond its length?

Question 26 of 40
★ FPSC ★ PPSC

Consider a class maths and we had a property called as sum.b which is the reference to a maths object and we want the statement Console.WriteLine(b.sum)to fail. Which among the following is the correct solution to ensure this functionality?

Question 27 of 40
★ FPSC ★ PPSC

Consider a class maths and we had a property called as sum.b is a reference to a maths object and we want the code below to work. Which is the correct solution to ensure this functionality? b.maths = 10; Console.WriteLine(b.maths);

Question 28 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code? class program { static void main(string[] args) { int i = 5; int v = 40; int[] p = new int[4]; try { p[i] = v; } catch(IndexOutOfRangeException e) { Console.WriteLine("Index out of bounds"); } Console.WriteLine("Remaining program"); } }

Question 29 of 40
★ FPSC ★ PPSC

If math class had add property with get and set accessors, then which of the following statements will work correctly?

Question 30 of 40
★ FPSC ★ PPSC

Which of these clauses will be executed even if no exceptions are found?

Question 31 of 40
★ FPSC ★ PPSC

Choose the statements which makes use of essential properties rather than making data member public in C#.NET?

Question 32 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code? class Program { static void Main(string[] args) { try { Console.WriteLine("csharp" + " " + 1/0); } finally { Console.WriteLine("Java"); } Console.ReadLine(); } }

Question 33 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code? { int sum = 10; try { int i; for (i = -1; i < 3; ++i) sum = (sum / i); } catch (ArithmeticException e) { Console.WriteLine("0"); } Console.WriteLine(sum); Console.ReadLine(); }

Question 34 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code? class number { private int num1; private int num2; public int anumber { get { return num1; } set { num1 = value; } } public int anumber1 { get { return num2; } set { num2 = value; } } } class Program { public static void Main(string[] args) { number p = new number(); p.anumber = 20; number k = new number(); k.anumber1 = 40; int m = p.anumber; int t = k.anumber1; int r = p.anumber + k.anumber1; System.Console.WriteLine("number1 = " +m); System.Console.WriteLine("number2 = " +t); System.Console.WriteLine("sum = " +r); System.Console.ReadLine(); } }

Question 35 of 40
★ FPSC ★ PPSC

Choose the correct statement among the followings?

Question 36 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code? class list { ArrayList array = new ArrayList(); public object this[int index] { get { if (index < 0 || index >= array.Count) { return null; } else { return (array[index]); } } set { array[index] = value; } } public int Count { get; set; } } class Program { static void Main(string[] args) { list list1 = new list(); list1[0] = "123"; list1[1] = " abc "; list1[2] = "xyz"; for (int i = 0; i<=list1.Count; i++) Console.WriteLine(list1[i]); Console.ReadLine(); } }

Question 37 of 40
★ FPSC ★ PPSC

If the math class had add property with get accessors then which of the following statements will work correctly?

Question 38 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code? class number { private int num1 = 60; private int num2 = 20; public int anumber { get { return num1; } set { num1 = value; } } public int anumber1 { get { return num2; } set { num2 = value; } } } class Program { public static void Main(string[] args) { number p = new number(); number k = new number(); int m = p.anumber; int t = k.anumber1; int r = p.anumber * k.anumber1; Console.WriteLine("sum = " + r); Console.ReadLine(); } }

Question 39 of 40
★ FPSC ★ PPSC

A single try block must be followed by which of these?

Question 40 of 40
★ FPSC ★ PPSC

Choose the correct statement about properties describing the indexers?

✓ Link copied to clipboard
Continue Your Practice

Advance Html — Part 1

Master the next curriculum module with 40 exam-standard MCQs.

Next Practice Set →

💡 Examiner's Advisory for Programming & Software Development

In competitive commission exams (FPSC, PPSC, KPPSC, SPSC, CSS, PMS), questions are frequently phrased with distractor options designed to catch rote learners. Whenever you answer an MCQ, read the Detailed Academic Explanation and Conceptual Anchor to understand why the remaining options are incorrect.

More Modules in Programming & Software Development

View All →
📚

Study Guides

Topic summaries and syllabus breakdown

Explore Guides →
🎯

Complete Library

Search through 78,000+ verified MCQs

Browse Library →
📱

Mobile App

Offline mock tests and instant bookmarks

Get Mobile App →