# Financial Software Developer Interview Questions

Financial software developer interview questions shared by candidates

## Top Interview Questions

how many blocks on an n x n megablock are not on the edge? 4 Answersn X n - 4n + 4 n x n - 8xn + 8 Mega block, if in the sense a cube- (n^3) - (12(n-2)+8) where n^3- total 1x1 cubes 12(n-2)- cubes in the edges without the corners 8- corner cubes Show More Responses Why not just? // Guaranteed all edges if n <= 2 return 0 return (n-2)(n-2) |

Write a java program that can convert a string of numbers (e.g. "5387") into an integer (5387). 4 AnswersYou can do math on individual characters, so subtract a constant from '5' and you can transform that character into an actual integer, 5. Then you need the String class and the Math.Pow() function. Don't forget to import the library that contains Math.Pow() ! why do you need Math.pow()? will this work? fun() // input 5467 // take first character and transform into integer //multiply by 10 * index of character which is zero that is 5 + 0 = 5 then take the next character and transform into integer now multiply 5 * 10 * index of character which is one 50 +4 = 54 repeat 540+ 6 = 546 5460 + 7 = 5467 running time is O(k) k = no of digits or O(n) n being the number The way I did it was (for your example of 5467) essentially 5000 + 400 + 60 + 7. It's the first solution that came to mind and since that hour long portion of the interview seemed to be winding down, I just went with it. Not a pretty solution, but it does get the right answer. For your solution, I understand what you're doing but I think your description of it is a bit off, or at least confusing. The you don't multiply by the index of the character at any time. What you're doing is just multiplying the sum to that point by 10 before adding the next character... i.e. in pseudo code, sum = 0; n = (length of the string of characters); for(i==0; i < n; i++) { sum *= 10; sum+= (converted integer value of the character at index i); } So the first time through the loop when the index is zero, the initial sum multiplied by 10 is still zero, so you add 5 and get the running sum to be 5. Iteration 2, 5*10 = 50, add the next integer and you get 54, and so on. And that is a far more elegant solution, definitely. Thanks for pointing it out! Show More Responses If Java is allowed than why to do all these things. Why not directly use wrapper calss Integer and convert a string to integer. String s="12345"; int i = Integer.parseInt(s); Simple ! |

How to find out whether a number is odd or even. 6 Answerslook at last bit. #include using namespace std; int main () { int num; cout > num; if (num % 2) { cout << "This number is odd." << endl; }else { cout << "This number is even." << endl; return 0; } } } } Add however many digits together ex. 23 is 2+3 which is 5, so that is not an even number. Just like 222 is 2+2+2 which is 6 so that is an even number. I know it sounds too easy but just give it a try with any number you like. Show More Responses Just thought that I'd give some people to think about, of course this does not work:) But how many of you gave it a shot? or & with 1, if ans = 0 even else odd Just check if the first bit is 1. |

You have 4 aces and a king in a set of cards, what's the probability of get kind before all aces. 4 Answers20% 1 - P(getting all aces before king)= 1 - (4/5 * 3/4 * 2/3 * 1/2) The correct approach is to find out what is the chances of getting the King as the very first card out of the 5. The answer is trivial. The solution is thus 1 - that chances. Show More Responses interview candidate is right rest are wrong: chance of having the king at first is 1/5 and we dont care about the other cards. So answer is 1/5. Anonymous is wrong: having the king first and the king last are not opposite statements: so its p(KAAAA=1-p(AAAAK)-p(AAAKA)-p(AAKAA)-p(AKAAA) = 1/5 |

How do you reverse a linked list 4 AnswersThere are several ways you can reverse a linked list. One way would be to traverse through the list, each time removing the node you visit, and push the value of the node onto a stack. Once the list is empty, you pop the values one by one off the stack and append it onto the linked list until the stack is empty. The result is the same linked list only in reverse order. You could also append the values onto a separate list if you do so desire. If I missed anything, let me know. Happy problem solving! This video explains in detail how to reverse a linked list, hope it helps. http://www.youtube.com/watch?v=LgapVjJYxqc I believe we can do a recursive traversing to create a new linked list Show More Responses ll_node *reverse_recursive(ll_node *n) { // found the end of the linked list if(n->next == NULL) { first = n; return n; } ll_node *prev = reverse_recursive(n->next); prev->next = n; n->next = NULL; } void reverse_recursive_g() { ll_node *prev = reverse_recursive(first); last = prev; } |

How would you print a linked list in reverse order? 4 Answerspublic Node reverseList(Node root) { Node rev = root; Node current;// = root; Node fwd = root.left; rev.left=null; while (fwd!=null) { current = fwd; fwd=current.left; current.left=rev; rev=current; } return rev; } @blakdogg: The question is not about how to reverse the link list but to print it in reverse. Here is my solution: void reversePrint(Node* current) { if (current) { reversePrint(current->next); printf ("%s \n", current->data); } } Jon: Your solution would crash on a large data set. Too much stack space used. The first solution was a hint at the overall solution which would be to use that function twice. Once to reverse the list, then print, then reverse it back. Show More Responses void printReverseLinkedList (Node node) { if (node.next != null) { printReverseLinkedList(node.next); } System.out.println(node.data); } |

There is a panel containing 3 light switches in front of you. Each switch controls a light in a room somewhere. Doesn't really matter where. You can play with the switches as much as you like, but you're only allowed to enter the room once. How do you tell which switch controls which light? Again, you can only enter the room once, so you cannot play with the switches after you enter the room, but you can play with them as much as you want before you enter the room. One entry is all it takes to determine which switch controls which light. 4 AnswersThink about it for a bit... . . . . . . Here's a hint: the lights start off, and they've been off for a long time. turn on switches 1 and 2, turn off switch 3. Check room 1. Easy path: the light is off, its switch is # 3. turn off switch 1 and go to room 2, if ligth is on the its switch is # 2 otherwise is switch 1. Interesting path: light is on in room 1, turn off switch 2 and go to room 2, then you get 2 options: light is on, its switch is # 1, if light is off then switch 1 controls room 1... just complete the other options, that's easy. Take the hint. Key part is that you can play with the lights as long as you want. Flip on a light an leave it on for a long time. Flip it off, and turn on another one. Walk into the room. If the light is on, it was that switch. If it is off and warm, it was the first switch. Otherwise, it is the untouched switch Show More Responses Switch on the 1st one and switch it off, then switch on the 2nd one and go in the room to check if the light is on. If it is on it means it's the 2nd one, and if it's not touch the light to check if it's hot. If it's hot it means the 1st switch is the correct one as it was switched on once or else it's the 3rd one. |

Can you cover an 8x8 chess board with dominos if two corner squares are removed (not two from the same side, 2 diagonal from each other). A domino covers 2 squares and no dominos can hang over the side of the board. 4 AnswersNo. The more interesting answer is why. It took me a while to get this one, but I started looking at it from a linear algebra standpoint and that impressed the interviewer. So while it took me longer to get it than most people I explain it to, that didn't stop me from passing that round of the interview process (this was asked on the 2nd interview, although I don't know if it's a "second round" question). Can you explain your idea from linear algebra in more detail? Thanks! It was pretty half baked, but the general idea was, if you look at the board with the two corner pieces removed, it kind of looks like a matrix like this: 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 The two middle columns are linearly dependent, and I was sort of trying to tie that into somehow converting the matrix into something like this 0 1 1 1 1 1 1 0 If the board looked like that, then to cover the top right square you need to put on a vertical domino, and likewise for the bottom left square. The leaves the only two uncovered squares as the one in the second row, first column, and the one in the third row, second column, a scenario in which covering them would be impossible. I couldn't quite work this out, but I think the interviewer liked that I tried such an approach. It really goes to show that when you're on an interview like this, the answer, though it is the goal, is one of the last things they care about. Show More Responses No In the chess board, there are 32 black squares and 32 white squares. The two squares taken off are in the same colour. And a domino always covers two squares one next another. So the two are different in colour. Therefore, whatever you try, you can never cover the whole board. |

Given 2 eggs, how would you find the exact floor at which the egg breaks when thrown from a building comprising 100 floors 4 Answers14 Only need one egg, but I have two answers. 1) If I stand on the first floor and throw an egg, it will break 2) No matter what floor the egg is thrown from, it will break when it reaches the ground floor. I'm guessing they are looking for something clever having to do with hardboiling one of the eggs, but that isn't necessary. The brute force answer is start at floor one, drop an egg. Repeat until the egg breaks Throw one egg from 50 floor. Depending if egg breaks, will be known if egg breaks between floors 1-50, or above 50. If first egg did not broke, then throw second egg from floor 51, 52, 53, ... until it breaks. Maximum number of attempts to find answer is 51. Problem has another twist. What is least number of steps to find floor from which thrown egg is broken. Show More Responses I think you guys tried to find a twist in this question, but really I'm pretty sure there's none. Eggs will break if thrown from a human's arm height... not even a first floor. I don't think you need to go further than that. I think the real intent of this question is simply to test the interviewee's level of pragmatism. |

25 racehorse question. Given 25 horses a track that can only race 5 at a time, what is the fewest # of races to find the top 3 ranked horses? 4 Answers8 races. It's not 8, it's 7. First group the horses into sets of 5. We can eliminate finishers 4 and 5 in each race. Now race the fastest from each previous heat against each other. Now we have used 6 races so far. We can eliminate all of the horses from the 4th and 5th place horses groups, all but the fastest from the 3rd, the fastest and the runner up from the 2nd and none of the remaining group from the 1st. Thus we have 3 horses from the 1st place finishers heat, 2 from the 2nd, and 1 from the 3rd. However, we already know that the fastest of the 5 winners is the fastest overall and is in, leaving us with only 5 horses not eliminated. Race them against each other and take the top 2. You have only used 7 races. http://durso.org/puzzles/horse.html Refer to this Show More Responses 5 races of 5 horses. We automatically eliminate from contention all 4th and 5th place finishers. Sixth race: 5 winners race. The fastest of the 25 horses is the 6th race winner. The show horse in race 6 is faster than the other horses that participated in the race where the 4th place finisher was entered and faster than all the horses in the race where the fifth place finisher entered. The 2nd and third place finishers in the race where the show horse originally race are also eliminated. We now have seven horses remaining. The show horse in the preliminary race where the 6th race place horse participated is also eliminated since it cannot beat at least three remaining horses. We now have a field of six horses, viz., the win, place and show horses in the race where the 6th race winner participated; the win and place horse in the preliminary race where the 6th race place horse participated; the show horse in the 6th race. Since we already know the fastest horse is the 6th race winner, we have a field of five horses for a seventh race to give us the place and show horses. |

**11**–

**20**of

**296**Interview Questions

## See Interview Questions for Similar Jobs

- Software Engineer
- Software Developer
- Senior Software Engineer
- Senior Software Developer
- Analyst
- Software Development Engineer
- Intern
- Software Engineer Intern
- Associate
- Consultant
- Quantitative Analyst
- Technology Analyst
- Business Analyst
- Data Scientist
- Project Manager
- Software Engineering
- Data Analyst
- Vice President