Microsoft Interview Question for Web Developers






Comment hidden because of low score. Click to expand.
0
of 0 vote

???
I wasn't ready for that one...

- dal December 04, 2007 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 2 vote

simpe...

void callF(Node* root, void(*fun)(void *) )
{
if(root ==NULL) return;
if(root->left) callF(root->left, fun);
if(root->right)callF(root->right, fun);

if(!root->left && !root->right)
(*fun)();

}

- desiNerd April 22, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

should be fun() instead of (*fun)()?

- cwr July 10, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

This wouldn't work for the 4 child nodes of node C at the leaves

- gonzofish May 14, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

And here is the Java version : It uses java's reflection mechanism

public void traverseAndCallFunction(AvlNode root, String functionName)
	{
		if(root == null) return;
		else
		{
			traverseAndCallFunction(root.left, functionName);
			traverseAndCallFunction(root.right, functionName);

			if(root.left == null && root.right== null)
			{
				try{
					this.getClass().getMethod(functionName).invoke(this, (Object[]) null);
				}catch(Exception e)
				{
					e.printStackTrace();
				}
			}
		}
	}

	public void dummyFunction()
	{
		System.out.println("Dummy Function called using reflection technique of Java");
	}

- Ashupriya June 29, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I would rather it would be in JS, from the looks of it!

- Juxtaposition October 22, 2012 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More