Whats wrong with option B?
Give an example?
Option B won't be correct as it will print all the nodes in kth level.
It's a kind of Depth First traversal . Has it been a Breadth First type, your conjecture may be teated correct.
So, I think option A is correct.
Option B would be discarded as It is saying about kth level Nodes of BINARY TREE ,
But this program is for all node present at K distance from a given node ,(could be any other node in tree )
then It will print all the nodes at distance of K from that given node.
Note : Option B will be correct if in function Argument we are passing tree root node then It will print Kth level Nodes of Binary Tree.
X->YZ , Y->XZ , ...