Question 6


Exam Question

Drag and Drop

You are developing an applicaton by using C#. The applicaton includes an array of decimal values named loanAmounts. You are developing a LINQ query to return the values from the array. The query must return decimal values that are evenly divisible by two. The values must be sorted from the lowest value to the highest value.
You need to ensure that the query correctly returns the decimal values.
How should you complete the relevant code?

  • join
  • from
  • group
  • ascending
  • descending
  • where
  • orderby
  • select
decimal[] loanAmounts = { 303m, 1000m, 85579m, 501.51m, 603m, 1200m, 400m, 22m};
IEnumerable<decimal> loanQuery =
    amount in loanAmounts
      amount % 2 == 0
        amount
            amount;

            Answer:

            • join
            • group
            • descending
            decimal[] loanAmounts = { 303m, 1000m, 85579m, 501.51m, 603m, 1200m, 400m, 22m};
            IEnumerable<decimal> loanQuery =
            • from
            amount in loanAmounts
            • where
            amount % 2 == 0
            • orderby
            amount
            • ascending
            • select
            amount;