Senior Software Engineer Interview Questions | Glassdoor.co.uk

Senior Software Engineer Interview Questions

568

Senior software engineer interview questions shared by candidates

Top Interview Questions

Sort: RelevancePopular Date

Write an algorithm to rotate a node of a binary tree.

2 Answers

void rotateLeft( Node p) { Node r = p.right; p.right = r.left; if (r.left != null) r.left.parent = p; r.parent = p.parent; if (p.parent == null) root = r; else if (p.parent.left == p) p.parent.left = r; else p.parent.right = r; r.left = p; p.parent = r; } void rotateRight(Node p) { Node l = p.left; p.left = l.right; if (l.right != null) l.right.parent = p; l.parent = p.parent; if (p.parent == null) root = l; else if (p.parent.right == p) p.parent.right = l; else p.parent.left = l; l.right = p; p.parent = l; }

To help visualise, right rotation is shown below. Consider a given tree: R /\ / \ P C /\ / \ A B Imagine nodes as metal coins suspended by strings (branches). For right rotation: 1. Pick up node P and pull it up so that node R falls down to the right of P. 2. Take B (right child of P) and make it left child of node R. The tree has been right rotated now and looks like this: P /\ / \ A R /\ / \ B C Similar process can be applied to this tree to rotate it left. This time start by pulling up R above P. Hope it helps.

I completely froze on following question which could be useful in a function that reverses order of words. How would you move a chunk of memory in C++/C?

2 Answers

How will you prevent the code in finally block from executing? The question isn't a very fair one as a good programmer would not write the code in finally block that he/she doesn't want to execute

3 Answers

Architecture design exercise: online ticket sales system

1 Answer

Explain how I applied agile methodologies in my project? What are the design considerations should take care while developing a new module?

1 Answer

All questions around multithreading.

2 Answers

Depending of the team, we ask techncal question that are specific to the project (web, desktop com/interop, services, processes, language: c++, C#, angular, react) I did interview a couple of candidate for our team and tend to see that people do not necessarly know what they put on their CV.

1 Answer

For a customer, take all the transactions in a given week and round them up to the nearest pound. For example with spending of £4.35, £5.20 and £0.87, the round-up would be £1.58. This amount should then be transferred into a savings goal, helping the customer save for future adventures.

1 Answer

The most difficult part was the accent. I had some problems with understanding the basic words like "synchronised".

1 Answer

Can a variable be both const and volatile ?

1 Answer
110 of 568 Interview Questions