Skip to main content

Linq _Language Integrated Query_ In C Sharp — Part 2 MCQs with Explanations

Practice high-yield Programming & Software Development MCQs on Linq _Language Integrated Query_ 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

Which LINQ operator is used to return a specified number of contiguous elements from the end of a sequence?

Question 2 of 40
★ FPSC ★ PPSC

In LINQ, what does the Reverse operator do?

Question 3 of 40
★ FPSC ★ PPSC

What is the purpose of the Zip operator in LINQ?

Question 4 of 40
★ FPSC ★ PPSC

Which LINQ operator is used to return elements from a sequence until a specified condition becomes false?

Question 5 of 40
★ FPSC ★ PPSC

In LINQ, what does the ElementAtOrDefault operator do?

Question 6 of 40
★ FPSC ★ PPSC

Can we use linq to query against a DataTable?

Question 7 of 40
★ FPSC ★ PPSC

Which operator among the following supplies the information about the characteristics of a typeof?

Question 8 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code snippet? class Program { static void Main(string[] args) { int[] nums = { 1, -2, 3, 0, -4, 5 }; var posNums = nums.Where(n => n < 10).Select(r => r%3); Console.Write("The values in nums: "); foreach (int i in posNums) Console.Write(i + " "); Console.WriteLine(); Console.ReadLine(); } }

Question 9 of 40
★ FPSC ★ PPSC

Assume 2 columns named as Product and Category how can be both sorted out based on first by category and then by product name?

Question 10 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code snippet? class B { } class A : B { } class Program { static void Main(string[] args) { A a = new A(); B b = new B(); if (a is A) Console.WriteLine("a is an A"); if (b is A) Console.WriteLine("b is an A because it is derived from A"); if (a is B) Console.WriteLine("This won’t display -- a not derived from B"); Console.ReadLine(); } }

Question 11 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code snippet? class Program { static void Main(string[] args) { string[] strs = { ".com", ".net", "facebook.com", "google.net", "test", "netflix.net", "hsNameD.com" }; var netAddrs = from addr in strs where addr.Length > 4 && addr.EndsWith(".net", StringComparison.Ordinal) select addr; foreach (var str in netAddrs) Console.WriteLine(str); Console.ReadLine(); } }

Question 12 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code snippet? class Program { static void Main(string[] args) { int[] nums = { 1, -2, 3, 0, -4, 5 }; var posNums = nums.Where(n => n > 0).Select(r => r*2). OrderByDescending(r=>r); Console.Write("The positive values in nums: "); foreach(int i in posNums) Console.Write(i + " "); Console.WriteLine(); Console.ReadLine(); } }

Question 13 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code snippet? class UseTypeof { static void Main() { Type t = typeof(StreamReader); Console.WriteLine(t.FullName); if(t.IsClass) Console.WriteLine("Is a class."); if(t.IsAbstract) Console.WriteLine("Is abstract."); else Console.WriteLine("Is concrete."); } }

Question 14 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code snippet? static void Main(string[] args) { int[] nums = { 5, 4, 6, 3, 14, 9, 8, 17, 1, 24, -1, 0 }; Array.Sort(nums); int idx = Array.BinarySearch(nums, 14); if (idx == 9) { Console.WriteLine(Convert.ToBoolean(1)); } else { Console.WriteLine(Convert.ToBoolean(0)); } Console.WriteLine("Index of 14 is " + idx); Console.ReadLine(); }

Question 15 of 40
★ FPSC ★ PPSC

Choose the namespace in which Expression trees are encapsulated?

Question 16 of 40
★ FPSC ★ PPSC

Which mechanism among the following helps in identifying a type during the execution of a program?

Question 17 of 40
★ FPSC ★ PPSC

In the following C# code, which query will work according to the set of code? class Program { static void Main(string[] args) { int[] nums = { 1, -2, 3, 0, -4, 5 }; int len = /*_________________ */ Console.WriteLine("The number of positive values in nums: " + len); Console.ReadLine(); } }

Question 18 of 40
★ FPSC ★ PPSC

Choose the correct statement about the IComparer interface in C#?

Question 19 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code snippet? class Program { static void Main(string[] args) { int[] nums = {1}; var posNums = from n in nums wheres n > 0 select Math.Max(78, 9); Console.Write("The largest values in nums: "); foreach (int i in posNums) Console.Write(i + " "); Console.WriteLine(); Console.ReadLine(); } }

Question 20 of 40
★ FPSC ★ PPSC

What does the following property defined in the array class defines in C#? public bool IsReadOnly { get; }

Question 21 of 40
★ FPSC ★ PPSC

Choose the namespace in which the interface IEnumerable is declared?

Question 22 of 40
★ FPSC ★ PPSC

Select the Keyword which supports the run time type identification?

Question 23 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code snippet? static void Main() { int[] nums = { 1, 2, 3, 4, 5 }; Console.Write("Original order: "); foreach(int i in nums) Console.Write(i + " "); Array.Reverse(nums); Console.Write("Reversed order: "); foreach(int i in nums) Console.Write(i + " "); Console.WriteLine(); }

Question 24 of 40
★ FPSC ★ PPSC

Choose the wrong statement about the LINQ?

Question 25 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code snippet? class Program { static void Main(string[] args) { int[] nums = { 1, -2, 3, 0, -4, 5}; var posNums = from n in nums where n >= 0 select n; foreach (int i in posNums) Console.Write(i + " "); Console.WriteLine(); Console.ReadLine(); } }

Question 26 of 40
★ FPSC ★ PPSC

Select the interfaces implemented by array class.

Question 27 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code snippet? class Program { static void Main(string[] args) { int[] nums = { 1, -2, 3, 0, -4, 5 }; var posNums = from n in nums where n > -5 && n < 6 orderby n descending select n; Console.Write("The positive values in nums: "); foreach (int i in posNums) Console.Write(i + " "); Console.WriteLine(); Console.ReadLine(); } }

Question 28 of 40
★ FPSC ★ PPSC

Select the class which is the base class for all arrays in C#?

Question 29 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code snippet? class Program { static void Main(string[] args) { int[] nums = { 1, -2, 3, 0, -4, 5 }; var posNums = from n in nums where n % 2 ==0 select n; Console.Write("The positive values in nums: "); foreach (int i in posNums) Console.Write(i + " "); Console.WriteLine(); Console.ReadLine(); } }

Question 30 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code snippet? class Program { static void Main(string[] args) { int[] nums = { 16, 9, 25}; var posNums = from n in nums where n > 0 select Math.Sqrt(n); Console.Write("The positive values in nums: "); foreach (int i in posNums) Console.Write(i + " "); Console.WriteLine(); Console.ReadLine(); } }

Question 31 of 40
★ FPSC ★ PPSC

Select the namespace which should be included while making use of LINQ operations?

Question 32 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code snippet? class Program { static void Main(string[] args) { int[] nums = { 1, -2, -3, 5 }; var posNums = from n in nums orderby n descending select n*4 / 2; Console.Write("The values in nums: "); foreach (int i in posNums) Console.Write(i + " "); Console.WriteLine(); Console.ReadLine(); } }

Question 33 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code snippet? class A {} class B : A {} class CheckCast { static void Main() { A a = new A(); B b = new B(); b = a as B; b = null; if(b==null) Console.WriteLine("The cast in b = (B) a is NOT allowed."); else Console.WriteLine("The cast in b = (B) a is allowed"); } }

Question 34 of 40
★ FPSC ★ PPSC

Select the statement which are correct about RTTI(Runtime type identification)?

Question 35 of 40
★ FPSC ★ PPSC

In the following C# code, what does the output represent? class Program { static void Main(string[] args) { int[] nums = { 1, -2, 3, 0, -4, 5 }; var posNums = from n in nums where n > 0 select n; int len = posNums.Count(); Console.WriteLine(len); Console.ReadLine(); } }

Question 36 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code snippet? static void Main(string[] args) { string[] strings = {"beta", "alpha", "gamma"}; Console.WriteLine("Array elements: "); DisplayArray(strings); Array.Reverse(strings); Console.WriteLine("Array elements now: "); DisplayArray(strings); Console.ReadLine(); } public static void DisplayArray(Array array) { foreach (object o in array) { Console.Write("{0} ", o); } Console.WriteLine(); }

Question 37 of 40
★ FPSC ★ PPSC

What does the following C# code signify? expr is type

Question 38 of 40
★ FPSC ★ PPSC

Which operator among the following is used to perform the operation of boxing, unboxing, reference and identity conversions?

Question 39 of 40
★ FPSC ★ PPSC

What does the following property define in C#? public static int BinarySearch<T>(T[] array, int index, int length, T value)

Question 40 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code snippet? class Program { static void Main(string[] args) { Expression<Func<int, int, bool>> IsFactorExp = (n, d) => (d != 0) ? (n % d) == 0 : false; Func<int, int, bool> IsFactor = IsFactorExp.Compile(); if (IsFactor(10, 5)) Console.WriteLine("5 is a factor of 10."); if (!IsFactor(343, 7)) Console.WriteLine("7 is not a factor of 10."); Console.ReadLine(); } }

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