Menu
Popular Courses
Search
Question
Select the output for the given 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();        }    }
Options:
A .  code run successfully prints nothing
B .  run time error
C .  code run successfully and executes output
D .  compile time error
Answer: Option C


-2, 0, -4



Was this answer helpful ?

Share this page with your friends!

Latest Videos

Chapter 1 - RMHP / OHP / OB & BP Part 1 : (14-02-2024) GPOE 2024
Cube & Cuboid Part 1 Reasoning (Hindi)
Data Interpretation (DI) Part1 Basic Concepts Reasoning (Hindi)
Counting Figures Part 1 Counting Of Straight Lines Reasoning (Hindi)
Direction Sense Test Part 1 Reasoning (Hindi)
Chapter 1 - GLOBAL STEEL SCENARIO & INDI Part 1 : (13-04-2024) ICA 2024
Real Numbers Part 7 Class 10 Maths

Latest Test Papers

Test paper 1 Reasoning & DI
Chapter 3.1 : INTRODUCTION GPOE/GPA 2024
Chapter 1.1 : INTRODUCTION GPOE/GPA 2024
Chapter 2.3 : COAL HANDLING PLANT - Set 1 GPOE/GPA 2024
Chapter 1.1 : Personnel Functions- An overview GFM 2024