Select from following answers:- 0, 1, -2, -4, 5
- 1, 3, 0, 5

- 1, 3, 5
- Run time error
- All Above
First we have declared a list of numbers (+ve/-ve)
Dim nums() As Integer = {1, -2, 3, 0, -4, 5}
Then by using LINQ expression we are picking up only those that are greater than or equals to zero and then appending those values with a comma(,) operator
var posNums = from n in nums
where n >= 0
Dim n As select
The result is 1,3,0,5
Show Correct Answer
Asked In: Many Interviews |
Alert Moderator