Software development Interview Questions | Glassdoor

# Software development Interview Questions

5,494

software development interview questions shared by candidates

## Top Interview Questions

Sort: RelevancePopular Date

Apr 18, 2012

### Software Development Engineer In Test (SDET) at Microsoft was asked...

Mar 6, 2012
 In a given sorted array of integers remove all the duplicates.8 AnswersIterate the array and add each number to a set, if number is already there, it won't be added again, thus removing any duplicates. Complexity is Big-O of NThe array is already sorted, no need for a set. example: 2,2,5,7,7,8,9 Just keep tracking the current and previous and the index of the last none repeated element when found a difference copy the element to the last none repeated index + one and update current and previous, no extra space and it will run in O(n)public RemoveDuplicates() { int[] ip = { 1, 2, 2, 4, 5, 5, 8, 9, 10, 11, 11, 12 }; int[] op = new int[ip.Length - 1]; int j = 0, i = 0; ; for (i = 1; i <= ip.Length - 1; i++) { if (ip[i - 1] != ip[i]) { op[j] = ip[i - 1]; j++; } } if (ip[ip.Length - 1] != ip[ip.Length - 2]) op[j] = ip[ip.Length - 1]; int xxx = 0; }Show More Responsesdef removeDuplicatesSecondApproach(inputArray): prev = 0 noRepeatIndex = 0 counter = 0 for curr in range(1,len(inputArray)): if (inputArray[curr] == inputArray[prev]): counter = counter + 1 prev = curr else: inputArray[noRepeatIndex+1] = inputArray[curr] noRepeatIndex = noRepeatIndex + 1 prev = curr inputArray = inputArray[:-counter] return inputArrayif(inpArr[i] == inpArr[i+1]) { int repeats = 1; opArr[opPos] = inpArr[i]; int j = i + 1; while(j+1 <= inpArr.length - 1 && inpArr[i] == inpArr[j+1]) { j++; repeats++; } opArr = Arrays.copyOf(opArr, opArr.length - repeats); i = i + repeats; } else { opArr[opPos] = inpArr[i]; } opPos++; } for(int i =0; i<=opArr.length-1;i++) { System.out.println(opArr[i] + ","); }Apologies for the previous incomplete answer int[] inpArr = {1,2,2,3,4,5,5,5,8,8,8,9,13,14,15,18,20,20}; int[] opArr = new int[inpArr.length]; int opPos = 0; for(int i= 0; i<=inpArr.length - 1; i++) { if(inpArr[i] == inpArr[i+1]) { int repeats = 1; opArr[opPos] = inpArr[i]; int j = i + 1; while(j+1 <= inpArr.length - 1 && inpArr[i] == inpArr[j+1]) { j++; repeats++; } opArr = Arrays.copyOf(opArr, opArr.length - repeats); i = i + repeats; } else { opArr[opPos] = inpArr[i]; } opPos++; } for(int i =0; i<=opArr.length-1;i++) { System.out.println(opArr[i] + ","); }public static void removedup(int[] input){ int count =1; int i=0; for( ;ipublic static void removedup(int[] input){ int count =1; int i=0; for( ;i

### Software Development Engineer In Test || at Amazon was asked...

Mar 14, 2012
 Write a method to decide if the given binary tree is a binary search tree or not.4 Answersfor binary search tree, inorder traversal should result in sorted array in the increasing order.Further, know that the difference between the two is that a binary search tree cannot contain duplicate entries. recur down the tree - check if element is already in hashtable - - if it is, return false - - if it isnt, insert element into the hashtable - - - recur to childrenI'm sorry but Anon's answer is not correct, at least according to "Introduction to Algorithms, 3d Edition" by Cormen. The binary search tree property says that there CAN be duplicates: "Let x be a node in a binary search tree. If y is a node in the left subtree of x, then y.key = x.key." In other words, the value of a child node may be equal to the value of a parent node, which would yield the result that "Interview Candidate" posted on Mar 14 2012. Performing an inorder tree walk would yield sorted nodes.Show More Responsespublic static isValidBST(TreeNode root, MIN_INTEGER, MAX_INTEGER) { if (root == null) // children of leaf nodes { return true; } return root.data >= INTERGER_MIN && root.data <= INTEGER_MAX && isValidBST(root.left, INTEGER_MIN, root.data) && isValidBST(root.right, root.data, INTEGER_MAX) }

### Senior Software Development Manager at Amazon was asked...

May 4, 2010
 What would you do if senior management demanded delivery of software in an impossible deadline?3 AnswersGive them the choice of reduced scope, more resources, or changed dates. They can only pick 2.It is possible to keep scope, resources & timeline (dates) unchanged, but compromise on quality. This will impact team retention, especially the stronger engineers on the team, over the longer run. The leadership team must understand the consequences.The feasibility which could lead to happen this type of situations is due to critical business needs. It means senior management would be actively involved and here agile framework will come into play. Delivering the workable product and then further developing the solution would be the best possible shot for win win situation.

Jan 25, 2011
 What would you say are the minimal requirements needed to successfully manage a software development project?5 Answersclear requirements, functional specs, delivery estimates, daily scrumsWhat will make the user happier using this than another product.Show More ResponsesA vision, clear requirements, and a great team! One or more comments have been removed. Please see our Community Guidelines or Terms of Service for more information.

Apr 9, 2012

### Software Development Engineer In Test (SDET) at Microsoft was asked...

Mar 8, 2011
 Given a string (understood to be a sentence), reverse the order of the words. "Hello world" becomes "world Hello"2 Answers2 ways. At the low level: reverse the entire string. 'Hello World' becomes "dlroW olleH". Then reverse each word, becomes "World Hello". At a higher level: Tokenize the words and push them onto a stack, then pop them out.class Solution { public static void main(String[] args) { String input = "Hello World this is a string"; reversestring(input); } public static void reversestring(String input){ // Stack stack = new Stack(); String[] str = input.split(" "); for(int i = str.length-1;i>=0;i--) { System.out.print(" "+str[i]); } } }

### Software Development Manager at EchoStar was asked...

May 6, 2011
 What are some of the things you might consider when designing a database?2 Answers(Books have been written about this). "Normalization vs. denormalization, data model accurately reflects problem domain, adaptability / maintainability, performance, indexing, partitioning.The key aspects to consider are normalization vs. denormalization, partitioning, data model accurately reflects problem domain, adaptability and maintainability, performance, and indexing

### Software Development Engineer In Test (SDET) at Microsoft was asked...

Oct 21, 2010
 Write code in your favorite programming language that will accept two strings and return true if they are anagrams.2 AnswersThis was not really that hard to write it, however the interviewer asked me to reduce the complexity. My initial version had n*log(n) complexity and he asked me to reduce it to no more than n complexity. If you have had some upper level Computer Science classes this is not too difficult, however what they are looking for is a way to stump you. If you adjust your code or thinking rapidly to their request they will change it again until they find something that you have trouble with. Do not be discouraged by this, it is the interviewers job to determine how much you know!Found this good link. Time complexity is O(n). http://www.dreamincode.net/code/snippet1481.htm The algorithm can still be improved but gives some basic idea on how to implement.

Jan 26, 2017