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
🎉 Set complete! All 40 questions answered.
Question 1 of 40
★ FPSC
★ PPSC
★ 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(); }
Correct Answer: Option C — -1 0
Detailed Academic Explanation:
-1 0 is the correct answer to “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(); }”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 2 of 40
★ FPSC
★ PPSC
★ 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(); }
Correct Answer: Option D — 12345B
Detailed Academic Explanation:
12345B is the correct answer to “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(); }”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 3 of 40
★ FPSC
★ PPSC
★ 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(); } }
Correct Answer: Option A — A
Detailed Academic Explanation:
A is the correct answer to “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(); } }”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 4 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following keywords is used by the calling function to guard against the exception that is thrown by called function?
Correct Answer: Option C — throws
Detailed Academic Explanation:
throws is the correct answer to “Which of the following keywords is used by the calling function to guard against the exception that is thrown by called function”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 5 of 40
★ FPSC
★ PPSC
★ 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(); }
Correct Answer: Option C — B C
Detailed Academic Explanation:
B C is the correct answer to “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(); }”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 6 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the keywords are used for the block to be examined for exceptions?
Correct Answer: Option A — try
Detailed Academic Explanation:
try is the correct answer to “Which of the keywords are used for the block to be examined for exceptions”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 7 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Where the properties can be declared?
Correct Answer: Option D — All of the mentioned
Detailed Academic Explanation:
All of the mentioned is the correct answer to “Where the properties can be declared”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 8 of 40
★ FPSC
★ PPSC
★ 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(); } }
Correct Answer: Option B — 75
Detailed Academic Explanation:
75 is the correct answer to “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(); } }”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 9 of 40
★ FPSC
★ PPSC
★ 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"); } } }
Correct Answer: Option B — hello
Detailed Academic Explanation:
hello is the correct answer to “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"); } } }”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 10 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Choose the wrong statement about the properties used in C#.NET?
Correct Answer: Option A — Each property consists of accessor as get and set
Detailed Academic Explanation:
Each property consists of accessor as get and set is the correct answer to “Choose the wrong statement about the properties used in C#.NET”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 11 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of these keywords is not a part of exception handling?
Correct Answer: Option C — thrown
Detailed Academic Explanation:
thrown is the correct answer to “Which of these keywords is not a part of exception handling”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 12 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following is the object oriented way to handle run time errors?
Correct Answer: Option D — Exceptions
Detailed Academic Explanation:
Exceptions is the correct answer to “Which of the following is the object oriented way to handle run time errors”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 13 of 40
★ FPSC
★ PPSC
★ 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(); } }
Correct Answer: Option D — Runtime error
Detailed Academic Explanation:
Runtime error is the correct answer to “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(); } }”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 14 of 40
★ FPSC
★ PPSC
★ 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(); } }
Correct Answer: Option B — 1
Detailed Academic Explanation:
1 is the correct answer to “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(); } }”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 15 of 40
★ FPSC
★ PPSC
★ 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"); } } }
Correct Answer: Option D — Compile time error
Detailed Academic Explanation:
Compile time error is the correct answer to “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"); } } }”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 16 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Choose the correct statement among the following?
Correct Answer: Option D — All of the mentioned
Detailed Academic Explanation:
All of the mentioned is the correct answer to “Choose the correct statement among the following”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 17 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of these keywords are used for generating an exception manually?
Correct Answer: Option C — throw
Detailed Academic Explanation:
throw is the correct answer to “Which of these keywords are used for generating an exception manually”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 18 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Choose the keyword which declares the indexer?
Correct Answer: Option B — this
Detailed Academic Explanation:
this is the correct answer to “Choose the keyword which declares the indexer”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 19 of 40
★ FPSC
★ PPSC
★ 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(); }
Correct Answer: Option B — 123450
Detailed Academic Explanation:
123450 is the correct answer to “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(); }”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 20 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Select the modifiers which can be used with the properties?
Correct Answer: Option D — All of the mentioned
Detailed Academic Explanation:
All of the mentioned is the correct answer to “Select the modifiers which can be used with the properties”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 21 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following is the wrong statement about exception handling in C#.NET?
Correct Answer: Option B — a program can contain multiple finally clauses
Detailed Academic Explanation:
a program can contain multiple finally clauses is the correct answer to “Which of the following is the wrong statement about exception handling in C#.NET”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 22 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of these keywords are used for the block to handle the exceptions generated by try block?
Correct Answer: Option B — catch
Detailed Academic Explanation:
catch is the correct answer to “Which of these keywords are used for the block to handle the exceptions generated by try block”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 23 of 40
★ FPSC
★ PPSC
★ 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(); } }
Correct Answer: Option A — 73
Detailed Academic Explanation:
73 is the correct answer to “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(); } }”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 24 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Select the statements which describe the correct usage of exception handling over conventional error handling approaches?
Correct Answer: Option D — All of the mentioned
Detailed Academic Explanation:
All of the mentioned is the correct answer to “Select the statements which describe the correct usage of exception handling over conventional error handling approaches”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 25 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of these exceptions will occur if we try to access the index of an array beyond its length?
Correct Answer: Option D — IndexOutOfRangeException
Detailed Academic Explanation:
IndexOutOfRangeException is the correct answer to “Which of these exceptions will occur if we try to access the index of an array beyond its length”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 26 of 40
★ FPSC
★ PPSC
★ 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?
Correct Answer: Option B — Declares sum property with only set accessor
Detailed Academic Explanation:
Declares sum property with only set accessor is the correct answer to “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”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 27 of 40
★ FPSC
★ PPSC
★ 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);
Correct Answer: Option A — Declare maths property with get and set accessors
Detailed Academic Explanation:
Declare maths property with get and set accessors is the correct answer to “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);”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 28 of 40
★ FPSC
★ PPSC
★ 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"); } }
Correct Answer: Option B — The output will be : Index out of bounds Remaining program
Detailed Academic Explanation:
The output will be : Index out of bounds Remaining program is the correct answer to “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"); } }”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 29 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
If math class had add property with get and set accessors, then which of the following statements will work correctly?
Correct Answer: Option B — math m = new math(); m.add = 10
Detailed Academic Explanation:
math m = new math(); m.add = 10 is the correct answer to “If math class had add property with get and set accessors, then which of the following statements will work correctly”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 30 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of these clauses will be executed even if no exceptions are found?
Correct Answer: Option B — finally
Detailed Academic Explanation:
finally is the correct answer to “Which of these clauses will be executed even if no exceptions are found”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 31 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Choose the statements which makes use of essential properties rather than making data member public in C#.NET?
Correct Answer: Option D — All of the mentioned
Detailed Academic Explanation:
All of the mentioned is the correct answer to “Choose the statements which makes use of essential properties rather than making data member public in C#.NET”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 32 of 40
★ FPSC
★ PPSC
★ 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(); } }
Correct Answer: Option B — Run time Exception generation
Detailed Academic Explanation:
Run time Exception generation is the correct answer to “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(); } }”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 33 of 40
★ FPSC
★ PPSC
★ 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(); }
Correct Answer: Option C — 0 -10
Detailed Academic Explanation:
0 -10 is the correct answer to “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(); }”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 34 of 40
★ FPSC
★ PPSC
★ 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(); } }
Correct Answer: Option C — number1 = 20 number2 = 40 sum = 60
Detailed Academic Explanation:
number1 = 20 number2 = 40 sum = 60 is the correct answer to “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(); } }”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 35 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Choose the correct statement among the followings?
Correct Answer: Option D — All of the mentioned
Detailed Academic Explanation:
All of the mentioned is the correct answer to “Choose the correct statement among the followings”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 36 of 40
★ FPSC
★ PPSC
★ 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(); } }
Correct Answer: Option B — Run time error
Detailed Academic Explanation:
Run time error is the correct answer to “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(); } }”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 37 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
If the math class had add property with get accessors then which of the following statements will work correctly?
Correct Answer: Option C — math m = new math(); int i; i = m.add
Detailed Academic Explanation:
math m = new math(); int i; i = m.add is the correct answer to “If the math class had add property with get accessors then which of the following statements will work correctly”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 38 of 40
★ FPSC
★ PPSC
★ 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(); } }
Correct Answer: Option C — 1200
Detailed Academic Explanation:
1200 is the correct answer to “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(); } }”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 39 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
A single try block must be followed by which of these?
Correct Answer: Option C — Both finally & catch
Detailed Academic Explanation:
Both finally & catch is the correct answer to “A single try block must be followed by which of these”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
Question 40 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Choose the correct statement about properties describing the indexers?
Correct Answer: Option D — All of the mentioned
Detailed Academic Explanation:
All of the mentioned is the correct answer to “Choose the correct statement about properties describing the indexers”. This question is standard in competitive examination syllabi for Exception Handling In C Sharp.
💡Key Conceptual Anchor:Exception Handling In C Sharp
✓Link copied to clipboard
Continue Your Practice
Advance Html — Part 1
Master the next curriculum module with 40 exam-standard MCQs.
💡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.