Skip to main content

Miscellaneous In C Sharp — Part 2 MCQs with Explanations

Practice high-yield Programming & Software Development MCQs on Miscellaneous 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 snippet? class Program { static void Main(string[] args) { int y = (int)Math.Max(4,2); int z = (int)Math.Pow(y, 2); Console.WriteLine(z); Console.ReadLine(); } }

Question 2 of 40
★ FPSC ★ PPSC

In which of the following collections is the I/O based on a key?

Question 3 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code snippet? class UnsafeCode { unsafe static void Main() { int m = 10; int *mptr = &m; int **ptr = &mptr; int n = 20; int *nptr = &n; int **prt = &nptr; m = **prt + *nptr; n = *mptr* **prt; Console.WriteLine(n + " " + m); Console.ReadLine(); } }

Question 4 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code snippet? class Program { static void Main(string[] args) { double x = 3.14; int y = (int) Math.Abs(x); Console.WriteLine(y); } }

Question 5 of 40
★ FPSC ★ PPSC

Which among the following is not a preprocessor directive?

Question 6 of 40
★ FPSC ★ PPSC

Which among the following is the correct way to find out the number of elements currently present in an ArrayListCollection called arr?

Question 7 of 40
★ FPSC ★ PPSC

Which of these method returns a smallest whole number greater than or equal to variable X?

Question 8 of 40
★ FPSC ★ PPSC

Which statement is correct in the following C#.NET code snippet? Stack st = new Stack(); st.Push("Csharp"); st.Push(7.3); st.Push(8); st.Push('b'); st.Push(true);

Question 9 of 40
★ FPSC ★ PPSC

What does preprocessor directive #if and #endif explains?

Question 10 of 40
★ FPSC ★ PPSC

Which string operation does the below-mentioned method define? public static string Concat(string str0, string str1)

Question 11 of 40
★ FPSC ★ PPSC

Among the given collections which one is I/O index based?

Question 12 of 40
★ FPSC ★ PPSC

Choose the class from which the namespace 'System.Type' is derived?

Question 13 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code snippet? class UnsafeCode { struct MyStruct { public int a; public int b; public int Sum() { return a / b; } } unsafe static void Main() { MyStruct o = new MyStruct(); MyStruct* p; p = &o; p->a = 60; p->b = 15; int c = 30; Console.WriteLine("Value is : " + p->Sum()*c); Console.ReadLine(); } }

Question 14 of 40
★ FPSC ★ PPSC

What does the following C# code set specify? public static int Compare(string strA, int indexA, string strB, int indexB, int length, bool ignoreCase)

Question 15 of 40
★ FPSC ★ PPSC

Which of these is used as default for a member of a class if no access specifier is used for it?

Question 16 of 40
★ FPSC ★ PPSC

What is the process by which we can control what parts of a program can access the members of a class?

Question 17 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code snippet? static void Main(string[] args) { string s1 = "olleH"; string s2 = "olleh"; if (s1 == s2) Console.WriteLine("Equal"); else Console.WriteLine("Unequal"); if (s1.Equals(s2)) Console.WriteLine("Equal"); else Console.WriteLine("Unequal"); Console.ReadLine(); }

Question 18 of 40
★ FPSC ★ PPSC

What kind of exception is being thrown if Wait(), Pulse() or PulseAll() is called from code that is not within synchronized code?

Question 19 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code snippet? class Program { static void Main(string[] args) { double x = 4.772; double y = 4.76; double z = Math.Max(x, y); Console.WriteLine(z); Console.ReadLine(); } }

Question 20 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code snippet? class sum { public int x; public int y; public int add (int a, int b) { x = a + b; y = x + b; return 0; } } class Program { static void Main(string[] args) { sum obj1 = new sum(); sum obj2 = new sum(); int a = 2; obj1.add(a, a + 1); obj2.add(5, a); Console.WriteLine(obj1.x + " " + obj2.y); Console.ReadLine(); } }

Question 21 of 40
★ FPSC ★ PPSC

Which among the following is a correct statement about namespace used in C#.NET?

Question 22 of 40
★ FPSC ★ PPSC

Consider an integer pointer . *a.++*a will increment . . . . . . . . while *a++ will increment . . . . . . . .

Question 23 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code snippet? class UnsafeCode { unsafe static void Main() { int* p ; int ch = 13*5; p = &(ch); Console.WriteLine(Convert.ToChar(*p)); if (*p == 'A') Console.WriteLine(Convert.ToBoolean(1)); else Console.WriteLine(Convert.ToBoolean(0)); Console.ReadLine(); } }

Question 24 of 40
★ FPSC ★ PPSC

What does the following C# code specify? object Invoke(object obj, object[] parameters)

Question 25 of 40
★ FPSC ★ PPSC

What does the following C# code set specifies? public static int Compare(string strA, string strB)

Question 26 of 40
★ FPSC ★ PPSC

Which of the following is not a namespace in the .NET Framework Class Library?

Question 27 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code snippet? class Program { static void Main(string[] args) { float x = 3.14F; int y = (int)Math.Abs(x); Console.WriteLine(y); Console.ReadLine(); } }

Question 28 of 40
★ FPSC ★ PPSC

Which among the following is not the ordered collection class?

Question 29 of 40
★ FPSC ★ PPSC

What are strings in C#?

Question 30 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code snippet? class Program { static void Main(string[] args) { double x = 2.0; double y = 3.0; double z = Math.Pow( x, y ); Console.WriteLine(z); Console.ReadLine(); } }

Question 31 of 40
★ FPSC ★ PPSC

What is multithreaded programming?

Question 32 of 40
★ FPSC ★ PPSC

Which is the correct statement about the namespaces in C#.NET?

Question 33 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code snippet? class Program { static void Main(string[] args) { double x = 3.14; int y = (int) Math.Ceiling(x); Console.WriteLine(y); } }

Question 34 of 40
★ FPSC ★ PPSC

Which method is used to abort thread prior to it's normal execution?

Question 35 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code snippet? class MyClass { int[] a = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; public IEnumerator GetEnumerator() { for (int i = 0; i < 20; i++) { if (a[i] % 2 == 0) yield return (int)(a[i]); } } } class Program { static void Main(string[] args) { MyClass mc = new MyClass(); foreach (int i in mc) Console.Write(i + " "); Console.WriteLine(); Console.ReadLine(); } }

Question 36 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code snippet? #define DEBUG #define MYTEST using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication13 { class Program { static void Main(string[] args) { #if (DEBUG && !MYTEST) Console.WriteLine("DEBUG is defined"); #elif (!DEBUG && MYTEST) Console.WriteLine("MYTEST is defined"); #elif (DEBUG && MYTEST) Console.WriteLine("DEBUG and MYTEST are defined"); #else Console.WriteLine("DEBUG and MYTEST are not defined"); #endif Console.ReadLine(); } } }

Question 37 of 40
★ FPSC ★ PPSC

Which is the correct statement about an ArrayList collection that implements the IEnumerable interface?

Question 38 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code snippet? static void main(String args[]) { char chars[] = {'a', 'b', 'c'}; String s = new String(chars); Console.WriteLine(s); }

Question 39 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code snippet? class Program { static void Main(string[] args) { String c = " Hello World "; String s = c.Trim(); Console.WriteLine("""+s+"""); Console.ReadLine(); } }

Question 40 of 40
★ FPSC ★ PPSC

Select the operators used for checking the equality in strings:

✓ 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 →