Interview questions

Software Developer interview questions – page 10

945 questions. Tap “Show answer” to check yourself.

  1. Modify this code to find the maximum subtree in tree which is a BST. Maximum subtree means subtree goes upto its leaves from any node. Modify the code again to find the maximum tree which is a BST. BST can lie anywhere and it may or may not go upto its leaves

  2. There is code like var i; { .. var j; .. } var k; .. var a; { .. var c; { var i; } .. var d; .. } For simplicity you may assume that there is only one variable declaration on 1 line. Now given a line number, you have to tell what all variables are valid on that line. Propose an algorithm for this

  3. Implement LRU cache. Write a code for this. LRU cache supports 3 operations, put(key, value) get(key) remove(key)

  4. Implement next_permutation function (similar to what is in algorithm.h)

  5. Your future interest, interaction capabilities

  6. Given a list of stars and their distances from the earth.Find an efficient solution to find the k closest stars to earth?

  7. Write a code to check if a tree is BST or not

  8. There are two sorted arrays. First one is of size m+n containing only 'first' m elements. Another one is of size n and contains n elements. Merge these two arrays into the first array of size m+n such that the output is sorted

  9. Find square root of a number

  10. A simple program to check whether a number is palindrome or not

  11. How would you design DBMS for SnapdealÂ's websiteÂ's shoe section. Now if you want to further break it into Sports and Casual Shoe would you break the DB into two or add another entity?

  12. Little discussion on Final Year Project and the summer training

  13. Basics of DBMS, difference between RDBMS and DBMS, Keys and its types, indices, joins and its types with example, normalization and denormalization

  14. What are inner join and outer join in sql

  15. A linked list contains loop.Find the length of non looped linked list

  16. 3 mislabeled jar puzzle.Since i had heard this puzzle many times,i answered it in 2-3 minutes.He said i can make out that you have heard this puzzle already ;)

  17. There is four digit number in aabb form and it is a perfect square.Find out the number

  18. You have a deck of 10 cards.You take one card out and put it on table and put next card in the end of deck.You repeat this sequence till all cards are on the table.Sequence formed on the table is 1,2,3,4,5Â…10. What was the original sequence of card. After doing some exercise i answered 1,6,2,10,3,7,4,9,5,8

  19. There is a file which contains ip addresses and corresponding url. Example 192.168.1.15 www.abc.com 10.255.255.40 http://www.snapdeal.com You have to return the subnet mask of the ip and the url after "www." Output 192.168.1 abc.com 10.19.76 snapdeal.com Write a Java function for that

  20. Number of rectangles in MxN matrix

  21. All anagrams of a string.He called it anagram but i think he wanted to ask all possible substrings of a string

  22. Which Design patterns you have used.I said Decorator,Factory,Singleton.Then he asked about Decorator design pattern

  23. Reverse linked list without recursion

  24. Two linked list are merging at a point.Find merging point

  25. Given an array of elements. We can perform following operation only- Increase an array element. Cost of operation is the amount of increment made per array element. Now for a given H, we need to make any H ( not necessarily consecutive ) elements of array equal with minimum cost. E.g. N=6, H=4 2 3 5 6 4 4 changes to -> 4 4 5 6 4 4 Cost is ( 4-2 + 4-3 = 3 ) N=6, H=3 2 3 5 6 4 4 changes to -> 2 4 5 6 4 4 Cost is ( 4-3 = 1 ) Optimal complexity- O(N)

  26. Lowest Common Ancestor of two nodes in binary tree.I wrote code for this.Then interviewer drew a tree and asked to print stacktrace on it

  27. You are given two ropes.Each rope takes exactly 1 hour to burn. How will you measure period of 45 minutes

  28. Find LCM of all numbers from 1 to n. Give an algorithm, then correctly estimate the time complexity

  29. SQL vs NoSQL. Why NoSQL

  30. JAVA-Spring and Hibernate

Companies that ask Software Developer questions