Engineer I Interview Questions | Glassdoor

# Engineer I Interview Questions

2,157

Engineer i interview questions shared by candidates

## Top Interview Questions

Sort: RelevancePopular Date

### Senior Mechanical Engineer I at Northrop Grumman was asked...

Apr 26, 2014
 What has been your active role in the team process you're currently working with?2 AnswersExplained details of daily involvement, software used, level of completion of initial input received, and final deliverable.I quote the repairs and write up the job router steps to include R & R parts, inspection. Testing, and FAA 8130

Jan 26, 2017

Mar 10, 2017

Jan 29, 2017

Dec 21, 2016

### Software Development Engineer I at Microsoft was asked...

Jan 3, 2013
 Given a string of format '2+3*2-1', calculate and return the result. No parenthesis in the input, just integers and + - * / operators. Operator precedence has to be considered. Linear time complexity and minimal data structure use is preferred.4 AnswersI did 2 pass on input string.I also did two passes on the input string. I created the following helper classes: Calculate, which takes in the input string, the location of the operation and the operation itself, and returns the result of the calculation. It's not too hard to figure out how to extract the operands from the string (just iterate backwards/forwards until you bump into the end, beginning or another operator). InsertResultInStr, which takes in the input string, the location of insertion and places a given integer into the input string. I couldn't prove this, but I think its true that the result of a multiplication between m and n digit numbers can always fit in the concatenation of those numbers with '*' in the middle. Sorry if the explanation is a little confusing, but InsertResultInStr(input, 3, 6) for input string = "2 + 3*2* - 1" should result in string = "2 + 6 - 1". Now, in the main fn, iterate through the string until we find a '*' or a '/', and when we do, calculate the answer via Calculate(), then InsertResultInStr(). Then iterate through the string again looking for '+' and '-', and finally convert the final string to an int and return it. One thing that is not clear in the description is what we should do to handle if a/b is not an int. My guess is that a/b will always return an integer. I guess you can handle this in any way you want: ignore the stuff after the decimal point, or maybe keep the maximum amount of precision that your string-space can handle.I used a different approach by making use of a queue: - parse the string, and push in the operands and operators onto a queue - evaluate the queue My general approach was this: - read in lhs, operator and rhs - if operator is "+" or "-", enqueue lhs and operator > if string is empty, we are done parsing --> enqueue rhs > else, prepend rhs to the string (e.g. str = rhs + str), to be parsed further - else, the operator is "*" or "/" --> perform the operation on lhs and rhs, and prepend the result to the string Final step is evaluating the queue -- simply dequeue lhs, operator and rhs and evaluate. (*note: this was tricky to get right on paper, and I've made a few mistakes which I had to debug) // Given: a well-formatted string e.g. "2 + 2*3 - 1". Evaluate the expression. string getCurr(string& str); int eval(string str) { if (str.empty()) return -1; // operand / operator queue std::queue q; // construct it char buf; while (!str.empty()) { string lhs = getCurr(str), oper = getCurr(str), rhs = getCurr(str); // evaluate directly if (oper == "*") { int res = atoi(lhs.c_str()) * atoi(rhs.c_str()); // restore the string str = itoa(res, buf, 10) + str; } // evaluate directly else if (oper == "/") { int res = atoi(lhs.c_str()) / atoi(rhs.c_str()); // restore the string str = itoa(res, buf, 10) + str; } else // "+" or "-" { q.push(lhs); q.push(oper); // finished parsing the expression if (str.empty()) q.push(rhs); else // restore the string str = rhs + str; } } // evaluate the queue int res, rhs; string oper; res = atoi(q.front().c_str()); q.pop(); while (!q.empty()) { oper = q.front(); q.pop(); rhs = atoi(q.front().c_str()); q.pop(); if (oper == "+") res += rhs; else // "-" res -= rhs; } return res; } string getCurr(string& str) { if (str.empty()) return ""; string curr(""); // operator if (str == '-' || str == '+' || str == '*' || str == '/') { curr += str; str = str.substr(1); } else // a number { do { curr += str; str = str.substr(1); } while (!str.empty() && str >= '0' && str <= '9'); } return curr; }Show More ResponsesUse 2 stacks. one for operands and one for operators. Keep pushing in operator as long as the newly pushed opertor has higher precedence than the "top of stack " operator. if not, pop out 2 operands and calculate result and again push it on stack

### Software Engineer I at Wayfair was asked...

Dec 20, 2013
 Assume you have a binary number 00110010, you apply some function on it and the number changes to some random number 10100011. Write a function to determine which numbers flipped from 0 to 1 and which bits flipped from 1 to 0. (You will have to write 2 different functions for 0 to 1 and 1 to 0).4 AnswersFrom 0 to 1, 00110010 XOR 11111111 => 11001101 then & 10100011 => 10000001 From 1 to 0, 00110010 OR 10100011 => 10110011 then XOR 10100011 => 00010000// 1. c = a XOR b --> gives the number of bits that need to be flipped to change a to b // 2. count number of bits set in c static int countSetBits( int n) { int count = 0; while(n>0) { count = count+ (n & 1); // ie 1001 && 0001 = 1 ie count = 1 at first loop n >>= 1; //right shift by 1 ie 9 => 4 => 2 => 1 } return count; } //if you want to know how many bits need to be changed from reaching a to b // 1. c = a XOR b // 2. count number of bits set in c static int calculateBitsFlipped(int a, int b){ int c = 0; c = a ^ b; return countSetBits(c); }Wasabi can you please explain the logic?Show More ResponsesTo count number of 1 -> 0 : 1) c = a xor b 2) c & a to count 1->0: 1) c = a xor b 2) c & b Hope this helps.

### Software Engineer I at Northrop Grumman was asked...

Jul 9, 2012
 What is systems engineering?4 AnswersCoordinating a complex project across different disciplinesWOW...How many lines of code have you programmed?? They ask questions like this? I'd tell him that I program millions of lines of "Hello World" everyday. Really some nonsense question.What does question "System Engineering" has to do with "Software Engineering"? Weird question by the interviewer. This would be my answer towards the interviewer.Show More ResponsesSystemically approaching a problems, and systematically arriving at solutions.

### Software Development Engineer In Test I at A9.com was asked...

Apr 16, 2015
 1. Finding first non repeated character in an array 2. Linux command to list files containing specific string 3. Mysql query related to Group by Second phone interview 1. create a doubly linked list out of that tree where each node represents sum of all nodes in the same vertical line. 2. Implement search for a sorted rotated array.4 Answerspublic class Solution { /** *@param A : an integer rotated sorted array *@param target : an integer to be searched *return : an integer */ public int search(int[] A, int target) { // write your code here if(A == null || A.length == 0){ return -1; } int start = 0; int end = A.length - 1; int mid; while(start + 1 < end){ mid = start + (end - start) / 2; if(A[mid] == target){ return mid; } if(A[start] < A[mid]){ if(A[start] <= target && target <= A[mid]){ end = mid; }else{ start = mid; } }else{ if(A[mid] <= target && target <= A[end]){ start = mid; }else{ end = mid; } } } if(A[start] == target){ return start; }else if(A[end] == target){ return end; }else{ return -1; } } }1. Finding first non repeated character in an array class FirstNonRepeatedCharacter{ public static void main(String args[]){ Character[] input = {'a'}; if(input.length==1){ System.out.println(input); } else if(input.length>1){ for(int i=0;i1. Finding first non repeated character in an array class FirstNonRepeatedCharacter{ public static void main(String args[]){ Character[] input = {'a','b','c','b','a'}; if(input.length==1){ System.out.println(input); } else if(input.length>1){ Set unique = new LinkedHashSet(); Set duplicates = new LinkedHashSet(); for(int i=0;iShow More ResponsesLinux command to list files containing specific string grep -l "string" path to directory

### Software Development Engineer I at Amazon was asked...

Sep 24, 2016
 1. How do you pass something by reference in Python? 2. Write code to find the time between two dates? 3. Implement a tree and depth first search on that tree4 Answers1. You just pass it in wrapped in another object. 2. In Python: Date1 - Date2. Then they asked in c++ 3. We all know how to do this, I hope.Can you provide the 3rd answer please?function dfs (node, target) { if(node === null) { return false; } if (node.val === target) { return true; } return dfs(node.left, target) || dfs(node.right, target); }Show More ResponsesContinuation of my above function (these are all in javascript). Here is a node class for the tree: function Node(val){ this.val = val; this.left = null; this.right = null; } // create a simple binary tree var root = new Node(10); root.left = new Node(6); root.right = new Node(5); root.left.left = new Node(4); root.left.right = new Node(7); // see if element is in tree console.log(dfs(root, 4)); // returns true console.log(dfs(root, 8)); // returns false
110 of 2,157 Interview Questions