nerdexam
Microsoft

MB6-894 · Question #18

MB6-894 Question #18: Real Exam Question with Answer & Explanation

The correct answer is C. The variables are valid within the block of code in which they were declared. D. The var keyword infers the type of the variables from their initialization expression.. See the full explanation below for the reasoning.

Question

You are an Independent Software Vendor (ISV) developer, and you are reviewing the code in a solution. During the code review, you see the following: using (var sr = new System.IO.StreamReader(_inputFilename)) { var textFromFile = sr.ReadToEnd(); this.processFileDate(textFromFile); } Which two statements about the sr and textFromFile variables are true? Each correct answer presents a complete solution.

Options

  • AThe variables storing .Net Framework objects have to be declared using the var keyword.
  • BThe var keyword indicates the variables can store values of any type.
  • CThe variables are valid within the block of code in which they were declared.
  • DThe var keyword infers the type of the variables from their initialization expression.

Community Discussion

No community discussion yet for this question.

Full MB6-894 Practice