Skip to main content

Arrays And Strings In C Sharp — Part 2 MCQs with Explanations

Practice high-yield Programming & Software Development MCQs on Arrays And Strings 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

In C#, what method is used to convert a string to an array of characters?

Question 2 of 40
★ FPSC ★ PPSC

What is the correct way to declare and initialize a jagged array with 2 rows in C#?

Question 3 of 40
★ FPSC ★ PPSC

What is the correct syntax to access the second character of a string named text in C#?

Question 4 of 40
★ FPSC ★ PPSC

What is the result of the expression Array.IndexOf(numbers, 5) where numbers = {1, 2, 3, 4, 5} in C#?

Question 5 of 40
★ FPSC ★ PPSC

In C#, which method is used to split a string into substrings based on a specified delimiter?

Question 6 of 40
★ FPSC ★ PPSC

What is the correct way to declare and initialize a multidimensional array with 3 rows and 4 columns in C#?

Question 7 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code? class math { public int a,b; public math(int i, int j) { a = i; b = j; } public void sum(math m) { m.a *= 2; m.b += 2; } } class Program { static void Main(string[] args) { math t = new math(20, 10); t.sum(t); Console.WriteLine(t.a + " " + t.b); Console.ReadLine(); } }

Question 8 of 40
★ FPSC ★ PPSC

Which of these base classes are accessible to the derived class members?

Question 9 of 40
★ FPSC ★ PPSC

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

Question 10 of 40
★ FPSC ★ PPSC

Which of these methods of class are used to remove the leading and backward whitespaces?

Question 11 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code? static void Main(string[] args) { String a = "Ilove"; String b = "CSHARP"; b = string.Concat(a, ' ', b); Console.WriteLine(b); Console.ReadLine(); }

Question 12 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code? static void Main(string[] args) { String obj = "hello"; String obj1 = "world"; String obj2 = obj; string s = obj+" "+obj1; Console.WriteLine(s.IndexOf('r')); Console.ReadLine(); }

Question 13 of 40
★ FPSC ★ PPSC

What does the term 'immutable' means in term of string objects?

Question 14 of 40
★ FPSC ★ PPSC

Accessibility modifier defined in a class are?

Question 15 of 40
★ FPSC ★ PPSC

Which of these methods is an alternative to getChars() that stores the characters in an array of bytes?

Question 16 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code? static void main(string[] args) { int i; int res = fun (out i); console.writeline(res); console.readline(); } static int fun(out int i) { int s = 1; i = 7; for (int j = 1; j <= i; j++ ) s = s * j; return s; }

Question 17 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code? static void Main(string[] args) { String obj = "hello"; String obj1 = "world"; String obj2 = obj; string s = obj + " " + obj1; Console.WriteLine(s.Substring(6 ,5)); Console.ReadLine(); }

Question 18 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code? static void Main(string[] args) { int i, j; int[, ] arr = new int[ 3, 3]; for (i = 0; i < 3; ++i) { for (j = 0; j < 3; ++j) { arr[i, j] = i * 2 + i * 2; Console.WriteLine(arr[i, j]); } Console.ReadLine(); } }

Question 19 of 40
★ FPSC ★ PPSC

The modifiers used to define an array of parameters or list of arguments is . . . . . . . .

Question 20 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code? static void Main(string[] args) { object[] a = {" 1 ", 4.0f, " harsh "}; fun(a); Console.ReadLine(); } static void fun(params object[] b) { for (int i = 0; i < b.Length - 1; i++) Console.WriteLine(b[i] + " "); }

Question 21 of 40
★ FPSC ★ PPSC

Select the correct match of parameter declaration. static Void main(string[] args) { int a = 5; int b = 6; float c = 7.2f; math (ref a, ref b, ref c); Console.WriteLine(a + " " + b + " " + c); } static int math(/*add parameter declaration */) { a += b; b *= (int)c; c += a * b; return 0; }

Question 22 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code? static void Main(string[] args) { int[] x = { 80, 82, 65, 72, 83, 67 }; fun(x); Console.ReadLine(); } static void fun(params int [] b ) { int i; for (i = 5; i >=0 ; i--) { Console.WriteLine(Convert.ToChar(b[i])); } }

Question 23 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code snippet? static void Main(string[] args) { string c = "hello"; string c1 = c.Remove(1); Console.WriteLine(c1); Console.ReadLine(); }

Question 24 of 40
★ FPSC ★ PPSC

Which method does following C# code explains? static void Main(string[] args) { int a = 10, b = 20; method(ref a, ref b); console.writeline(a + " " + b); } static void swap(ref int i, ref int j) { int t; t = i; i = j; j = t; }

Question 25 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code? static void Main(string[] args) { int [] a = {1, 2, 3, 4, 5}; fun(a); Console.ReadLine(); } static void fun(params int[] b ) { for (int i = 0; i < b.Length; i++) { b[i] = b[i] * 5 ; Console.WriteLine(b[i] + ""); } }

Question 26 of 40
★ FPSC ★ PPSC

Which of these data type values is returned by equals() method of String class?

Question 27 of 40
★ FPSC ★ PPSC

Which statement is correct about following C# code? int[, ]a={{5, 4, 3},{9, 2, 6}};

Question 28 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code? class Program { static void Main(string[] args) { String s1 = "I love You"; String s2 = s1; Console.WriteLine((s1 == s2) + " " + s1.Equals(s2)); Console.ReadLine(); } }

Question 29 of 40
★ FPSC ★ PPSC

Correct way to convert a string to uppercase using string class method()?

Question 30 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code? static void Main(string[] args) { string s = " i love you"; Console.WriteLine(s.IndexOf('l') + " " + s.lastIndexOf('o') + " " + s.IndexOf('e')); Console.ReadLine(); }

Question 31 of 40
★ FPSC ★ PPSC

The Method use to remove white space from a string?

Question 32 of 40
★ FPSC ★ PPSC

Correct way to find if contents of two strings are equal?

Question 33 of 40
★ FPSC ★ PPSC

Which of these methods can be used to convert all characters in a String into a character array?

Question 34 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code? static void Main(string[] args) { String c = "Hello"; String a ; a = c.Replace('l', 'w'); Console.WriteLine(a); Console.ReadLine(); }

Question 35 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code snippet? static void Main(string[] args) { String c = "Hello i love you"; String a ; a = c.Substring(12, 3); Console.WriteLine(a); Console.ReadLine(); }

Question 36 of 40
★ FPSC ★ PPSC

Which of the following statements are correct?

Question 37 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code? static void Main(string[] args) { String obj = "hello"; String obj1 = "world"; String obj2 = obj; Console.WriteLine(obj + " " + obj1); string s = obj + " " + obj1; Console.WriteLine(s.Length); Console.ReadLine(); }

Question 38 of 40
★ FPSC ★ PPSC

Which of these methods returns the string such that some characters which are specified to be removed from the end of strings are removed from string by mentioning the number of characters to be removed?

Question 39 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code? static void Main(string[] args) { String obj = "hello"; String obj1 = "world"; String obj2 = obj; Console.WriteLine (obj.Equals(obj2) + " " + obj2.CompareTo(obj) ); Console.ReadLine(); }

Question 40 of 40
★ FPSC ★ PPSC

To perform comparison operation on strings supported operations are . . . . . . . .

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