exam questions

Exam 98-361 All Questions

View all questions & answers for the 98-361 exam

Exam 98-361 topic 1 question 84 discussion

Actual exam question from Microsoft's 98-361
Question #: 84
Topic #: 1
[All 98-361 Questions]

The following functions are defined:

What does the console display after the following line?
Printer(2);

  • A. 210
  • B. 211
  • C. 2101
  • D. 2121
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Oryza
5 months, 1 week ago
I don't know why, but when I code this in C# Console App, its prints "211111111111~" and keep going (infinite loop), does anyone has tried it and got diff result?
upvoted 1 times
Oryza
5 months, 1 week ago
nevermind, I got a typo T_T it's CORRECT!! the result is "2 1 1"
upvoted 1 times
...
...
Brob
8 months ago
I executed the following code, and "2" is displayed. Could you please explain why I should get a different value than 2? static void Main(string[] args) { var printer = Printer(2); Console.WriteLine(printer); Console.ReadKey(); } public static int Printer(int j) { for (var i = j; i < 0; i = Printer(i - 1)) { Console.Write(i); } return j; }
upvoted 1 times
...
mk_dyn365
1 year, 6 months ago
The answer is correct. its 211. if you execute the code , you can see that in debug how the recursion takes place.
upvoted 3 times
...
sathwik222222
1 year, 7 months ago
I think It should be a infinite loop
upvoted 2 times
Heicke
1 year, 2 months ago
No, it's not. The for requires i > 0 to execute. So first enter the value 2, then subtract 1 to it's redundant call. The next one will subtract 1 again turning into 0, breaking the loop.
upvoted 1 times
...
matt11
1 year, 3 months ago
why? what's the point in saying this without any evidence? you're wrong and you could have checked this easily by making unsupported comments like this you're just confusing people who are trying to learn
upvoted 2 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago