Senior Developer Interview Questions | Glassdoor.ca

# Senior Developer Interview Questions

549

Senior developer interview questions shared by candidates

## Top Interview Questions

Sort: RelevancePopular Date

### Senior Software Developer at D2L was asked...

Oct. 18, 2018
 Given an array of int[] like 1,2,3 Find the next largest integer than can be made with these digits (e.g.: 2,1,3)5 AnswersWrote code in C# to solve the problem in a generic case. Think about this situation: 5,9,8,7,6,4,3,1,2 -> 5,9,8,7,6,4,3,2,1 followed by 5,9,8,7,6,4,3,2,1 -> 6,1,2,3,4,5,7,8,9.// Typescript implementation // Assumption 1: all numbers in the input array are single digits, i.e. between 0 and 9 // Assumption 2: if a larger number cannot be found then return the current number as is const getNextLargestNumber = (inputs: number[]): number => { if (inputs) { // Do not mutate the initial inputs let copiedInputs: number[] = inputs.slice(); // Loop through the digits in reverse order // Exclude the first digit for (let i = copiedInputs.length - 1; i >= 1; i--) { // Loop through the previous digits for (let j = i - 1; j >= 0; j--) { const swapFrom: number = copiedInputs[i]; const swapTo: number = copiedInputs[j]; // Swap if a smaller digit is found before if (swapTo x - y)]; return convertArrayToNumber(copiedInputs); } } } } return convertArrayToNumber(inputs); }; const convertArrayToNumber = (inputs: number[]): number => { let num: number = 0; if (inputs) { const inputsLength: number = inputs.length; for (let i = 0; i < inputsLength; i++) { // Use index to determine the power of 10 num += inputs[i] * (10 ** (inputsLength - i - 1)); } } return num; }; console.log(getNextLargestNumber([4, 1, 9, 5])); console.log(getNextLargestNumber([4, 5, 1, 9])); console.log(getNextLargestNumber([4, 5, 9, 1])); console.log(getNextLargestNumber([4, 9, 1, 5])); console.log(getNextLargestNumber([4, 9, 5, 1])); console.log(getNextLargestNumber([5, 1, 4, 9])); console.log(getNextLargestNumber([1, 4, 2, 4, 3, 8, 6, 4, 0])); console.log(getNextLargestNumber([1, 4, 2, 4, 4, 0, 3, 6, 8])); console.log(getNextLargestNumber([1, 4, 2, 4, 4, 0, 3, 8, 6])); console.log(getNextLargestNumber([1, 4, 2, 4, 4, 0, 6, 3, 8])); console.log(getNextLargestNumber([5, 9, 8, 7, 6, 4, 3, 1, 2])); console.log(getNextLargestNumber([5, 9, 8, 7, 6, 4, 3, 2, 1])); console.log(getNextLargestNumber([6, 1, 2, 3, 4, 5, 7, 8, 9])); console.log(getNextLargestNumber()); console.log(getNextLargestNumber([6, 5])); console.log(getNextLargestNumber([5, 6]));// Wrong copy-paste // Corrected version // Typescript implementation // Assumption 1: all numbers in the input array are single digits, i.e. between 0 and 9 // Assumption 2: if a larger number cannot be found then return the current number as is const getNextLargestNumber = (inputs: number[]): number => { if (inputs) { // Do not mutate the initial inputs let copiedInputs: number[] = inputs.slice(); // Loop through the digits in reverse order // Exclude the first digit for (let i = copiedInputs.length - 1; i >= 1; i--) { // Loop through the previous digits for (let j = i - 1; j >= 0; j--) { const swapFrom: number = copiedInputs[i]; const swapTo: number = copiedInputs[j]; // Swap if a smaller digit is found before if (swapTo x - y)]; return convertArrayToNumber(copiedInputs); } } } } return convertArrayToNumber(inputs); }; const convertArrayToNumber = (inputs: number[]): number => { let num: number = 0; if (inputs) { const inputsLength: number = inputs.length; for (let i = 0; i < inputsLength; i++) { // Use index to determine the power of 10 num += inputs[i] * (10 ** (inputsLength - i - 1)); } } return num; }; console.log(getNextLargestNumber([4, 1, 9, 5])); console.log(getNextLargestNumber([4, 5, 1, 9])); console.log(getNextLargestNumber([4, 5, 9, 1])); console.log(getNextLargestNumber([4, 9, 1, 5])); console.log(getNextLargestNumber([4, 9, 5, 1])); console.log(getNextLargestNumber([5, 1, 4, 9])); console.log(getNextLargestNumber([1, 4, 2, 4, 3, 8, 6, 4, 0])); console.log(getNextLargestNumber([1, 4, 2, 4, 4, 0, 3, 6, 8])); console.log(getNextLargestNumber([1, 4, 2, 4, 4, 0, 3, 8, 6])); console.log(getNextLargestNumber([1, 4, 2, 4, 4, 0, 6, 3, 8])); console.log(getNextLargestNumber([5, 9, 8, 7, 6, 4, 3, 1, 2])); console.log(getNextLargestNumber([5, 9, 8, 7, 6, 4, 3, 2, 1])); console.log(getNextLargestNumber([6, 1, 2, 3, 4, 5, 7, 8, 9])); console.log(getNextLargestNumber()); console.log(getNextLargestNumber([6, 5])); console.log(getNextLargestNumber([5, 6]));Show more responses// Hmm, after posting the comment, some code gets changed (after "Swap if a smaller digit is found before" comment) // Attempt 3 to post // Typescript implementation // Assumption 1: all numbers in the input array are single digits, i.e. between 0 and 9 // Assumption 2: if a larger number cannot be found then return the current number as is const getNextLargestNumber = (inputs: number[]): number => { if (inputs) { // Do not mutate the initial inputs let copiedInputs: number[] = inputs.slice(); // Loop through the digits in reverse order // Exclude the first digit for (let i = copiedInputs.length - 1; i >= 1; i--) { // Loop through the previous digits for (let j = i - 1; j >= 0; j--) { const swapFrom: number = copiedInputs[i]; const swapTo: number = copiedInputs[j]; // Swap if a smaller digit is found before if (swapTo x - y) ]; return convertArrayToNumber(copiedInputs); } } } } return convertArrayToNumber(inputs); }; const convertArrayToNumber = (inputs: number[]): number => { let num: number = 0; if (inputs) { const inputsLength: number = inputs.length; for (let i = 0; i < inputsLength; i++) { // Use index to determine the power of 10 num += inputs[i] * (10 ** (inputsLength - i - 1)); } } return num; }; console.log(getNextLargestNumber([4, 1, 9, 5])); console.log(getNextLargestNumber([4, 5, 1, 9])); console.log(getNextLargestNumber([4, 5, 9, 1])); console.log(getNextLargestNumber([4, 9, 1, 5])); console.log(getNextLargestNumber([4, 9, 5, 1])); console.log(getNextLargestNumber([5, 1, 4, 9])); console.log(getNextLargestNumber([1, 4, 2, 4, 3, 8, 6, 4, 0])); console.log(getNextLargestNumber([1, 4, 2, 4, 4, 0, 3, 6, 8])); console.log(getNextLargestNumber([1, 4, 2, 4, 4, 0, 3, 8, 6])); console.log(getNextLargestNumber([1, 4, 2, 4, 4, 0, 6, 3, 8])); console.log(getNextLargestNumber([5, 9, 8, 7, 6, 4, 3, 1, 2])); console.log(getNextLargestNumber([5, 9, 8, 7, 6, 4, 3, 2, 1])); console.log(getNextLargestNumber([6, 1, 2, 3, 4, 5, 7, 8, 9])); console.log(getNextLargestNumber()); console.log(getNextLargestNumber([6, 5])); console.log(getNextLargestNumber([5, 6]));// Last attempt // Possibly, angle brackets break the code sample // Typescript implementation // Assumption 1: all numbers in the input array are single digits, i.e. between 0 and 9 // Assumption 2: if a larger number cannot be found then return the current number as is const getNextLargestNumber = (inputs: number[]): number => { if (inputs) { // Do not mutate the initial inputs let copiedInputs: number[] = inputs.slice(); // Loop through the digits in reverse order // Exclude the first digit for (let i = copiedInputs.length - 1; i >= 1; i--) { // Loop through the previous digits for (let j = i - 1; j >= 0; j--) { const swapFrom: number = copiedInputs[i]; const swapTo: number = copiedInputs[j]; // Swap if a smaller digit is found before if (swapTo < swapFrom) { copiedInputs[i] = swapTo; copiedInputs[j] = swapFrom; // Take portion of array up to the swap point // The remaining digits are sorted in ascending order copiedInputs = [...copiedInputs.slice(0, j + 1), ...copiedInputs.slice(j + 1).sort((x, y) => x - y)]; return convertArrayToNumber(copiedInputs); } } } } return convertArrayToNumber(inputs); }; const convertArrayToNumber = (inputs: number[]): number => { let num: number = 0; if (inputs) { const inputsLength: number = inputs.length; for (let i = 0; i < inputsLength; i++) { // Use index to determine the power of 10 num += inputs[i] * (10 ** (inputsLength - i - 1)); } } return num; }; console.log(getNextLargestNumber([4, 1, 9, 5])); console.log(getNextLargestNumber([4, 5, 1, 9])); console.log(getNextLargestNumber([4, 5, 9, 1])); console.log(getNextLargestNumber([4, 9, 1, 5])); console.log(getNextLargestNumber([4, 9, 5, 1])); console.log(getNextLargestNumber([5, 1, 4, 9])); console.log(getNextLargestNumber([1, 4, 2, 4, 3, 8, 6, 4, 0])); console.log(getNextLargestNumber([1, 4, 2, 4, 4, 0, 3, 6, 8])); console.log(getNextLargestNumber([1, 4, 2, 4, 4, 0, 3, 8, 6])); console.log(getNextLargestNumber([1, 4, 2, 4, 4, 0, 6, 3, 8])); console.log(getNextLargestNumber([5, 9, 8, 7, 6, 4, 3, 1, 2])); console.log(getNextLargestNumber([5, 9, 8, 7, 6, 4, 3, 2, 1])); console.log(getNextLargestNumber([6, 1, 2, 3, 4, 5, 7, 8, 9])); console.log(getNextLargestNumber()); console.log(getNextLargestNumber([6, 5])); console.log(getNextLargestNumber([5, 6]));

### Senior Operations Developer, at PNI Digital Media was asked...

Nov. 19, 2018
 write a c# method to bring pairs of integers that sum up to 10 from an array of integers.3 AnswersThey said the solution should have to sorted the integer array, put two pointers at the end and front compare the sum of a and b, if it was more than 10 then bring the last pointer forward until end of array ... They best solution was (On), and I gave them( lgn)... The other solution was to build a dictionary with pairs and each time adding new element check to see if it already exited ... #include #include #include static std::map findPairsOfSum(int array[], int sum){ std::map myPair; int len = sizeof(array); if (array == NULL) return myPair; for (int i=0; i pairs; int myArray[] = {0,10,3,7,3,5,7,3}; pairs = findPairsOfSum(myArray,10); // printing map std::map :: iterator it; for (it = pairs.begin(); it != pairs.end(); ++it){ std::coutfirstsecond myPairs(int [] myArr, int sumUp){ Dictionary returnPair = new Dictionary (); int len = myArr.Length; Console.WriteLine("Array Size -> "+len); for (int i=0;i myDictionary = myPairs(myArray,10); foreach (var item in myDictionary) { Console.WriteLine("key {0} and value {0}",item.Key,item.Value); } } } }#include #include #include static std::map findPairsOfSum(int array[], int sum){ std::map myPair; int len = sizeof(array); if (array == NULL) return myPair; for (int i=0; i pairs; int myArray[] = {0,10,3,7,3,5,7,3}; pairs = findPairsOfSum(myArray,10); // printing map std::map :: iterator it; for (it = pairs.begin(); it != pairs.end(); ++it){ std::coutfirstsecond <<'\n'; } return 0; }using System; using System.Collections.Generic; namespace pairsSum { class Program { public static Dictionary myPairs(int [] myArr, int sumUp){ Dictionary returnPair = new Dictionary (); int len = myArr.Length; Console.WriteLine("Array Size -> "+len); for (int i=0;i myDictionary = myPairs(myArray,10); foreach (var item in myDictionary) { Console.WriteLine("key {0} and value {0}",item.Key,item.Value); } } } }

### Senior Software Developer at Route1 was asked...

Mar. 21, 2014
 The following code creates an unnecessary temporary variable. How would you change it to be more efficient? C++ code that searches an unsorted list...2 AnswersIf efficiency is so important that you want to save the cycles in instantiating a new variable, you will save a lot more by using a hash map for the data structure in the first place.I guess you didn't get the job. Lucky employer.

### Senior Developer at CPP Investments was asked...

Jul. 25, 2014
 Almost all behavioral questions were unexpected because in other companies it is usually reserved for HR round, not technical.2 AnswersI replied truthfully and they appeared shocked by my answers each time, which was entertaining to observe.This is true. I experienced it as well. I thought it was weird that behavioural questions were asked outside of the initial HR round. This to me meant that the managers didn't read HRs notes on the candidate. It seems like everyone at that firm is running around like a headless chicken.

### Senior Software Developer at Epicor Software was asked...

Jun. 11, 2013
 What you do if you cannot get something from upper management you need?2 Answersvery typical question in many companies this dayThese should not be issues, upper management should be aware of these needs from the get go. A clear and concise communication plan as well as regular engagement reviews including upper management should always be in place. Unless logic and common sense are not the norm this should not occur. This said each project or initiative should have its sponsorship clearly defined and hopefully proper support already in place

### Senior Applications Developer at RBC was asked...

Mar. 10, 2018
 What would the count for the list of it. public class Test { string Data; int Id; public Test(int id, string data) { Data = data; Id = id; } } static void Main(string[] args) { List list = new List(); list.Add(new Test(10, "test")); var d = new Test(10, "test"); if (!list.Contains(d)) list.Add(d); Console.WriteLine("Count of the list is : " + list.Count); Console.ReadLine(); } } What to do to make count 1?2 AnswersFirst count would be 2. To make it 1. Add override method as following. public override bool Equals(object obj) { if (obj == null) return false; var d = (Test)obj; return (d.Data == Data && d.Id == Id); }public class Test : IEquatable { string Data; int Id; public Test(int id, string data) { Data = data; Id = id; } public bool Equals(Test other) { return this.Id == other.Id && this.Data == other.Data; } }

### Senior Software Developer at Arista Networks was asked...

Oct. 14, 2017
 Why two calls to printf with same parameters were giving completely different results?2 AnswersLikely the compiler/linker were resolving these calls to slightly different library functions/wrappers.The format string and arguments aren't consistent, so the stack is not unwound properly. As the result, the caller's addressing (like %esp + auto variable offset) becomes irrelevant to the actual addresses and gives wrong values.

### Senior Software Developer at Wealthsimple was asked...

Nov. 9, 2018
 Design the data model and API for a customer survey.2 AnswersUsed whiteboard to work through the solution with input from interviewers on requirements and in response to feedback.What was your response ?