gs gs108 Delegates, Generics and LINQ - Fundamental of LINQ - Quiz No.1
gs gs108 CSharp Quiz
This quiz belongs to book/course code gs gs108 CSharp of gs organization. We have 110 quizzes available related to the book/course CSharp. This quiz has a total of 10 multiple choice questions (MCQs) to prepare and belongs to topic Delegates, Generics and LINQ. NVAEducation wants its users to help them learn in an easy way. For that purpose, you are free to prepare online MCQs and quizzes.
NVAEducation also facilitates users to contribute in online competitions with other students to make a challenging situation to learn in a creative way. You can create one to one, and group competition on an topic of a book/course code. Also on NVAEducation you can get certifications by passing the online quiz test.
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(); } }
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(); } }
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(); } }
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(); } }
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(); } }