nerdexam
Microsoft

MB6-890 · Question #92

You are writing a function "SumOflnt(n)" that returns the sum of numbers from 0 to n as shown in the following exhibit: SumOflnt(l) = 0 + 1 = 1 SumOflnt(2) = 0+1 + 2 = 3 SumOflnt(n) = 0 + 1 +…

The correct answer is B. public static int SumOfInt(int n) C. public static int SumOflnt(int n). See the full explanation below for the reasoning.

Question

You are writing a function "SumOflnt(n)" that returns the sum of numbers from 0 to n as shown in the following exhibit:

SumOflnt(l) = 0 + 1 = 1 SumOflnt(2) = 0+1 + 2 = 3 SumOflnt(n) = 0 + 1 + ... (n-1) + n The function prototype is the following:

public static int SumOflnUint n) { } Which two functions return the correct answer? Each correct answer presents a complete solution.

Options

  • Apublic static int SumOflnt(int n)
  • Bpublic static int SumOfInt(int n)
  • Cpublic static int SumOflnt(int n)
  • Dpublic static int SumOflnt(int n)

How the community answered

(48 responses)
  • A
    8% (4)
  • B
    77% (37)
  • D
    15% (7)

Community Discussion

No community discussion yet for this question.

Full MB6-890 Practice