├── README.md ├── junior └── readme.md ├── mid └── readme.md └── senior ├── fizzbuzz └── readme.md ├── nested-folders-and-files └── readme.md ├── readme.md ├── sales-and-commissions └── readme.md ├── short-questions └── README.md ├── sql-design-question └── readme.md └── valet-parking ├── CarFactory.cs ├── Cars ├── BMW.cs ├── ICar.cs ├── Mazda.cs ├── Mercedes.cs └── Toyota.cs ├── ParkingLots ├── IParkingLot.cs ├── NorthParkingLot.cs └── SouthParkingLot.cs ├── Program.cs ├── Valets ├── IValet.cs ├── JackValet.cs └── MichealValet.cs ├── project.json ├── readme.md └── result.png /README.md: -------------------------------------------------------------------------------- 1 | # Interview questions 2 | 3 | This repository contains questions about different aspects in programming and prblem solving skills that we check for during interviews in Motorola Solutions. The repository contains questions for various levels inlcuding junior, mid, and senior. 4 | 5 | ## Problem Solving skills 6 | 7 | The following areas can be checked for when assessing the candidate problem solving skills: 8 | 9 | A thought process can follow one or more of the following steps: 10 | 11 | 1. Conceptualizing the problem. 12 | 2. Going reduction in the problem to start easy. 13 | 3. Dividing and conquering the problem. 14 | 4. Explaining the problem in an easy and confident way. 15 | 5. Approaching the problem using brute force and improving it after. 16 | 17 | ## Programming Concepts 18 | 19 | Programming concepts are a broad area which may containa a wide range of paradigms, practices, concepts, and so on. It also depends on whether the programming language is functional, object oriented, procedural, declaritive, etc. 20 | 21 | However, we will mostly use Object-Oriented programming languages, therefore, the practices will be from there. 22 | 23 | ### Fundamental concepts in OOP 24 | 25 | Fundamental concepts are what the design patterns and SOLID principles are built upon in OOP. They are: 26 | 27 | 1. Composition 28 | 2. Aggregation 29 | 3. Inheritance 30 | 4. Polymorphism 31 | 32 | Using these concepts, we can implement other concepts in an object-oriented programming such as: 33 | 34 | 1. Encapsulation 35 | 2. Abstraction 36 | 3. Single Responsibilty Principle 37 | 4. Open/Closed Principle 38 | 5. Liskov's Substituion Principle 39 | 6. Interface Segregation Principle 40 | 7. Dependency Injection Principle 41 | 42 | The SOLID principles can be implemented using various Design Patterns. The SOLID principles define the goals, whereas, ta developer can use various design patterns to reach these goals. 43 | 44 | **Note**: Many of these principles, concepts, and paradigms are language-agnostic, meaning that they can be used in almost any type of language as long as the language supports some of the vital constructs. 45 | 46 | ## Overall Skills and Personality Traits 47 | 48 | | Problem Solving Skills | Data Structure | Algoritms | Programming Concepts | Personality | 49 | |---|---|---|---|---| 50 | | Conceptualizing the Problem | Linked List | Searching Algorithms | Design Patterns | Humble | 51 | | Problem Reduction | Queue | Sorting Algorithms | SOLID Principles | Open for Criticism | 52 | | Brute Forcing | Stack | | Inheritance | Eager to Learn | 53 | | | Array | | Abstraction & Encapsulation | Friendly | 54 | | | Map | | | Calm | 55 | 56 | ## Personality 57 | 58 | As everyone usually agrees, the personality of a candidate is important factor to hire him. Some of the traits can be as follows (YourDictionary, n.d.): 59 | 60 | 1. Being honest no matter what the consequences are is one personality trait people should aspire to. 61 | 2. Having responsibility for all of your actions and being a little bit of a perfectionism are also personality traits. 62 | 3. Adaptability and compatibility are great and can help you get along with others. 63 | 4. Having the drive to keep going, and having compassion and understanding are positive personality traits. 64 | 5. Patience is a virtue and also another trait. 65 | 6. Getting up the courage to do what’s right in those tough situations and loyalty to your friends and loved ones are also personality traits. 66 | 67 | Depending on the seniority level, what's being looked for can change. However, the personality is important in any case. 68 | 69 | ## References 70 | 71 | YourDictionary. (n.d.). Examples of personaliy traits. Retrieved from http://examples.yourdictionary.com/examples-of-personality-traits.html -------------------------------------------------------------------------------- /junior/readme.md: -------------------------------------------------------------------------------- 1 | # Junior Level Software Engineer 2 | -------------------------------------------------------------------------------- /mid/readme.md: -------------------------------------------------------------------------------- 1 | # Mid-Level Software Engineer 2 | -------------------------------------------------------------------------------- /senior/fizzbuzz/readme.md: -------------------------------------------------------------------------------- 1 | # Fizz Buzz 2 | 3 | Write a method that prints 1 – 100. It should print one number per line. Each number must be followed by a colon. Conditionally, write out the following additional information: 4 | 5 | - If the number is a multiple of 3, write out “Fizz” after the colon. 6 | - If the number is a multiple of 5, write out “Buzz” after the colon. 7 | - If the number is a multiple of 3 and 5, write out “Fizz Buzz” after the colon. 8 | 9 | ### Sample output: 10 | - 1: 11 | - 2: 12 | - 3: Fizz 13 | - 4: 14 | - 5: Buzz 15 | - 6: Fizz 16 | - 7: 17 | - 8: 18 | - 9: Fizz 19 | - 10: Buzz 20 | - 11: 21 | - 12: 22 | - 13: 23 | - 14: 24 | - 15: Fizz Buzz 25 | - . 26 | - . 27 | - . 28 | - 100: Buzz 29 | -------------------------------------------------------------------------------- /senior/nested-folders-and-files/readme.md: -------------------------------------------------------------------------------- 1 | Write a method that accepts a string representing a folder as input (For example: “C:\Windows”). Assume that the folder is correct and that it exists on the system. Make the function write out a list of all folders and files in that folder, and in any nested folders. 2 | 3 | Example input: 4 | 5 | C:\WINDOWS 6 | Example output: 7 | C:\WINDOWS\addins 8 | C:\WINDOWS\addins\FXSEXT.ecf 9 | C:\WINDOWS\appcompat 10 | C:\WINDOWS\appcompat\appraiser 11 | C:\WINDOWS\appcompat\appraiser\Appraiser_AlternatData.cab 12 | -------------------------------------------------------------------------------- /senior/readme.md: -------------------------------------------------------------------------------- 1 | # What is a senior software engineer? 2 | 3 | The following description is taken from Stackoverflow.com. 4 | 5 | When I hear “Senior Developer” I think of someone who has mastered programming. I think of a person who can design, code and test a 6 | system. They can talk to system architecture or component design. They understand and use design patterns. This person can anticipate the 7 | performance bottlenecks, but knows not to pre-optimize. This person will leverage asynchronous programming, queuing, caching, logging, security and 8 | persistence when appropriate. When asked they can give a detail explanation of their choice and the pros and cons. In most cases they have mastered 9 | object oriented programming and design, this not an absolute other languages such as Javascript, F#, Scheme are powerful and are not object 10 | oriented. They are adept in risk management and most important of all they can communicate the before mentioned to their peers (Stackoverflow, 11 | 2014). 12 | 13 | ## What to expect in this folder? 14 | 15 | This folder contains questions that can be asked senior level candidates. They can either be randomly selected or depending on where the candidate 16 | shines. 17 | 18 | 19 | ## References 20 | 21 | Stackoverflow. (2014). When should you call yourself a senior developer? Retrieved from 22 | http://softwareengineering.stackexchange.com/questions/25564/when-should-you-call-yourself-a-senior-developer 23 | -------------------------------------------------------------------------------- /senior/sales-and-commissions/readme.md: -------------------------------------------------------------------------------- 1 | # Sales and Commissions 2 | 3 | You have been asked to design a system a door-to-door sales company. The company sells cable, Internet, and telephone products. The system will keep track of customers, sales that are made, and commissions. 4 | 5 | Within the company, there are multiple offices across the United States. Each office has a unique list of products they sell. While it is possible for the same product to be sold in multiple offices, the price may differ for the same product from one office to the next. 6 | Each office also contains one or more sales teams. A sales team consists of multiple sales representatives, and a sales team leader. The sales representatives receive a commission based on each product sold, as well as the sales team leader. 7 | 8 | Each office belongs to an area. An area is a group of offices. An area contains an area manager. The area manager receives a commission for each sale that is made under him/her. 9 | 10 | Each area belongs to a region. A region is a group of areas. A region contains a regional manager. The regional manager receives a commission for each sale that is made under him/her. 11 | 12 | Commissions are calculated biweekly. Sales reps are paid a tiered commission, based on how many sales they made during that two-week period. The commission tiers are currently as follows, although, they may change later one: 13 | 14 | 1. 0-10 products sold: 35% commission 15 | 2. 11-20 products sold: 45% commission 16 | 3. 21+ products sold: 55% commission 17 | 18 | The sales team leader, the area manager, and the regional manager each currently receive $5.00 for each sale. This may change at a later date. 19 | 20 | Ensure the system is able to keep track of the following items: 21 | 22 | - Regions and Regional Managers 23 | - Areas and Area Managers 24 | - Sales Teams, Sales Reps, and Sales Team Managers 25 | - Product Lists, Products, and product prices 26 | - Commission tiers, and commissions for each role 27 | - Customers, Orders, and Products sold, as well as who sold each product 28 | -------------------------------------------------------------------------------- /senior/short-questions/README.md: -------------------------------------------------------------------------------- 1 | ## Question #1: 2 | 3 | Without modifying the Sparta class, write some code that makes MakeItReturnFalse return false. 4 | 5 | ``` 6 | public class Sparta : Place 7 | { 8 | public bool MakeItReturnFalse() 9 | { 10 | return this is Sparta; 11 | } 12 | } 13 | ``` 14 | Calling as following: 15 | 16 | ``` 17 | Sparta s = new Sparta(); 18 | s.MakeItReturnFalse(); 19 | ``` 20 | 21 | ## Solution 22 | ``` 23 | public class Place 24 | { 25 | public interface Sparta { } 26 | } 27 | ``` 28 | 29 | Source: https://stackoverflow.com/questions/44120947/this-is-sparta-or-is-it?newsletter=1&nlcode=432%7c1b17 30 | -------------------------------------------------------------------------------- /senior/sql-design-question/readme.md: -------------------------------------------------------------------------------- 1 | # SQL Design and Query Question 2 | 3 | This question will test candidates from the following perspectives: 4 | 5 | 1. SQL Table Creation 6 | 2. Relationships and Foreign Keys 7 | 3. Data Insertion 8 | 4. Data Read 9 | 5. Aggregation 10 | 6. Join 11 | 12 | # Exercise 13 | 14 | Teriyaki Brothers is an online shopping site, and they have many customers. Out of these customers, a customer named Brandon J. Srinath with age of 31 has two orders, each contains the following items: 15 | 16 | Order #1 - Ordered on 01/01/2010 at 4:21 PM 17 | 18 | 1. Two Head and Shoulders Shampoo Bottles 19 | 2. Three packages of Mac and Cheese 20 | 21 | Order #2 on 02/02/2012 22 | 23 | 1. Four Godiva Chocolate Bars 24 | 2. Two "Life is Good" Books 25 | 26 | Currently, the online shopping cart website sells the following items: 27 | 28 | 1. Godiva Chocolate - Total sold: 100 29 | 2. Head and Shoulders Shampoo -- Total sold: 1000 30 | 3. Mac and Cheese -- Total sold: 5 31 | 4. Life is Good Book -- Total sold: 20 32 | 5. DasKeyboard Keyboard --Total sold: 10000 33 | 34 | ## Questions: 35 | 36 | 1. Design the database with the given information above 37 | 2. Write SQL query that brings all the orders with their items Brandon J. Srinath has, including the information about who the order belongs to. 38 | 3. Bring orders placed after 01/01/2011 by Brandon J. Srinath 39 | 4. Calculate and bring the most sold product. 40 | 5. Calculate and bring the most sold product among the ones that Brandon J. Srinath purchased. -------------------------------------------------------------------------------- /senior/valet-parking/CarFactory.cs: -------------------------------------------------------------------------------- 1 | using ConsoleApplication.Cars; 2 | using System; 3 | 4 | namespace ConsoleApplication 5 | { 6 | public static class CarFactory 7 | { 8 | public static ICar GetCar(string carName){ 9 | switch(carName.ToLower()){ 10 | case "mazda": 11 | return new Mazda(); 12 | case "toyota": 13 | return new Toyota(); 14 | case "bmw": 15 | return new BMW(); 16 | case "mercedes": 17 | return new Mercedes(); 18 | } 19 | throw new ArgumentException("Unknown car type"); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /senior/valet-parking/Cars/BMW.cs: -------------------------------------------------------------------------------- 1 | namespace ConsoleApplication.Cars{ 2 | 3 | public class BMW:ICar 4 | { 5 | public string Name{get{return "BMW";}} 6 | public float EngineSize {get{return 4.5f;}} 7 | } 8 | } -------------------------------------------------------------------------------- /senior/valet-parking/Cars/ICar.cs: -------------------------------------------------------------------------------- 1 | namespace ConsoleApplication.Cars{ 2 | public interface ICar 3 | { 4 | string Name{get;} 5 | float EngineSize {get;} 6 | } 7 | } -------------------------------------------------------------------------------- /senior/valet-parking/Cars/Mazda.cs: -------------------------------------------------------------------------------- 1 | namespace ConsoleApplication.Cars 2 | { 3 | public class Mazda : ICar{ 4 | public string Name {get{return "Mazda";}} 5 | public float EngineSize {get{return 2.5f;}} 6 | } 7 | } -------------------------------------------------------------------------------- /senior/valet-parking/Cars/Mercedes.cs: -------------------------------------------------------------------------------- 1 | namespace ConsoleApplication.Cars 2 | { 3 | public class Mercedes: ICar 4 | { 5 | public string Name {get{return "Mercedes";}} 6 | public float EngineSize {get{return 2.5f;}} 7 | } 8 | } -------------------------------------------------------------------------------- /senior/valet-parking/Cars/Toyota.cs: -------------------------------------------------------------------------------- 1 | namespace ConsoleApplication.Cars 2 | { 3 | public class Toyota: ICar 4 | { 5 | public string Name {get{return "Toyota";}} 6 | public float EngineSize{get{return 4.5f;}} 7 | } 8 | } -------------------------------------------------------------------------------- /senior/valet-parking/ParkingLots/IParkingLot.cs: -------------------------------------------------------------------------------- 1 | using ConsoleApplication.Cars; 2 | 3 | namespace ConsoleApplication.ParkingLots 4 | { 5 | public interface IParkingLot 6 | { 7 | ICar[] GetParkingSpaces(); 8 | } 9 | } -------------------------------------------------------------------------------- /senior/valet-parking/ParkingLots/NorthParkingLot.cs: -------------------------------------------------------------------------------- 1 | using ConsoleApplication.Cars; 2 | 3 | namespace ConsoleApplication.ParkingLots{ 4 | public class NorthParkingLot: IParkingLot{ 5 | private ICar[] _parkingSpaces; 6 | public NorthParkingLot () 7 | { 8 | _parkingSpaces = new ICar[7]; 9 | } 10 | 11 | public ICar[] GetParkingSpaces(){ 12 | return _parkingSpaces; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /senior/valet-parking/ParkingLots/SouthParkingLot.cs: -------------------------------------------------------------------------------- 1 | using ConsoleApplication.Cars; 2 | 3 | namespace ConsoleApplication.ParkingLots{ 4 | public class SouthParkingLot:IParkingLot{ 5 | private ICar[] _parkingSpaces; 6 | public SouthParkingLot () 7 | { 8 | _parkingSpaces = new ICar[5]; 9 | } 10 | 11 | public ICar[] GetParkingSpaces() 12 | { 13 | return _parkingSpaces; 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /senior/valet-parking/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using ConsoleApplication.Cars; 4 | using ConsoleApplication.ParkingLots; 5 | using ConsoleApplication.Valets; 6 | 7 | 8 | namespace ConsoleApplication 9 | { 10 | public class Program 11 | { 12 | public static void Main(string[] args) 13 | { 14 | var carQueue = new Queue(new string[]{"Mazda","Toyota","Mercedes","BMW"}); 15 | IValet jackValet = new JackValet(); 16 | IValet michaelValet = new MichealValet(); 17 | 18 | IParkingLot southParkingLot = new SouthParkingLot(); 19 | IParkingLot northParkingLot = new NorthParkingLot(); 20 | 21 | jackValet.ParkCar(CarFactory.GetCar("Mazda"), southParkingLot); 22 | michaelValet.ParkCar(CarFactory.GetCar("Toyota"), southParkingLot); 23 | 24 | jackValet.ParkCar(CarFactory.GetCar("Mercedes"), northParkingLot); 25 | michaelValet.ParkCar(CarFactory.GetCar("BMW"), northParkingLot); 26 | 27 | // Writing the parking lots to the output 28 | Console.WriteLine("South Parking Lot"); 29 | Console.WriteLine("------------------"); 30 | PrintParkingSpaceStatus(southParkingLot.GetParkingSpaces()); 31 | 32 | Console.WriteLine("\nNorth Parking Lot"); 33 | Console.WriteLine("--------------------"); 34 | PrintParkingSpaceStatus(northParkingLot.GetParkingSpaces()); 35 | } 36 | 37 | private static void PrintParkingSpaceStatus(ICar[] parkingLotSpaces){ 38 | for(var i = 0; i < parkingLotSpaces.Length; i++){ 39 | Console.WriteLine("Parking Space: " + i); 40 | Console.WriteLine("Car Name: " + (parkingLotSpaces[i] == null ? "Empty" : parkingLotSpaces[i].Name)); 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /senior/valet-parking/Valets/IValet.cs: -------------------------------------------------------------------------------- 1 | using ConsoleApplication.ParkingLots; 2 | using ConsoleApplication.Cars; 3 | 4 | namespace ConsoleApplication.Valets{ 5 | public interface IValet 6 | { 7 | string Name{get;} 8 | void ParkCar(ICar car, IParkingLot parkingLot); 9 | } 10 | } -------------------------------------------------------------------------------- /senior/valet-parking/Valets/JackValet.cs: -------------------------------------------------------------------------------- 1 | using ConsoleApplication.Cars; 2 | using ConsoleApplication.ParkingLots; 3 | using System; 4 | namespace ConsoleApplication.Valets{ 5 | public class JackValet:IValet{ 6 | public string Name{get{return "Jack";}} 7 | 8 | public void ParkCar(ICar car, IParkingLot parkingLot){ 9 | var parkingSpaces = parkingLot.GetParkingSpaces(); 10 | var randomSpaceGenerator = new Random(); 11 | bool spaceFound = false; 12 | while(!spaceFound) 13 | { 14 | var randomSpace = randomSpaceGenerator.Next(parkingSpaces.Length-1); 15 | if(parkingSpaces[randomSpace] == null) 16 | { 17 | spaceFound = true; 18 | parkingSpaces[randomSpace] = car; 19 | } 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /senior/valet-parking/Valets/MichealValet.cs: -------------------------------------------------------------------------------- 1 | using ConsoleApplication.Cars; 2 | using ConsoleApplication.ParkingLots; 3 | 4 | namespace ConsoleApplication.Valets{ 5 | public class MichealValet:IValet{ 6 | public string Name{get{return "Michael";}} 7 | public void ParkCar(ICar car, IParkingLot parkingLot) 8 | { 9 | var parkingSpaces = parkingLot.GetParkingSpaces(); 10 | for(var i = 0; i < parkingSpaces.Length; i++){ 11 | if(parkingSpaces[i] == null) 12 | { 13 | parkingSpaces[i] = car; 14 | break; 15 | } 16 | } 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /senior/valet-parking/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0.0-*", 3 | "buildOptions": { 4 | "debugType": "portable", 5 | "emitEntryPoint": true 6 | }, 7 | "dependencies": {}, 8 | "frameworks": { 9 | "netcoreapp1.0": { 10 | "dependencies": { 11 | "Microsoft.NETCore.App": { 12 | "type": "platform", 13 | "version": "1.0.0" 14 | } 15 | }, 16 | "imports": "dnxcore50" 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /senior/valet-parking/readme.md: -------------------------------------------------------------------------------- 1 | ## Valet Parking Exercise 2 | 3 | In this exercise, we will write a fictional valet parking application. Simply speaking, in a valet parking service, a person called valet parks customers' cars to designated parking lots. Valet parking service is usually used in expensive restaurants and hotels. 4 | 5 | In our valet parking example, there will be three major components playing roles in the parking process: 6 | 7 | 1. Three types of vehicle: Sedan, Van, and Truck. For each vehicle that we create from the given vehicle types, we capture the following pieces of information: Make and Model (e.g. "Honda Civic") and Plate Number (e.g. "ATB455"). 8 | 2. Two types of parking lot: North and South. **There can be many parking lots as of types North and South.** Although for now, there will be only two parking lots per parking lot types. Let's name north parking lots "N1-PL" and "N2-PL", and south parking lots as "S1-PL" and "S2-PL". All the north parking lots have only 10 parking spaces each, whereas, the south parking lots have 15 spaces each. 9 | 3. Two types of valets: Junior and Senior. There can be many junior or senior valets. For now, let's have "Michael" as senior valet and "Jack" as junior valet. 10 | 11 | The junior and senior valets behave differently when parking customers' cars: 12 | 13 | 1. The junior valets park **randomly** to any available parking spot. 14 | 2. The senior valets park the cars to the **next available spot** starting from the beginning. 15 | 16 | Our parking scenario will look like the following: 17 | 18 | There are 4 cars in the queue and they are: 19 | 1. Two sedans: Toyota Camry (11111) and Mazda CX5 (22222), 20 | 2. One van: Mercedes Sprinter (33333) 21 | 3. One truck: GMC (44444). 22 | 23 | The parking takes place in the following **order**: 24 | 25 | 1. The 16-year old Jack gets the Mazda from the queue and parks it to N1-PL parking lot. 26 | 2. The 30-year old Michael gets Toyota and parks it into S1-PL parking lot. 27 | 3. Jack parks Mercedes to the N2-PL parking lot. 28 | 4. Michael parks the GMC to the S2-PL parking lot. 29 | 30 | Lastly, we will print out all filled and empty spots for each parking lot to the console. 31 | 32 | # Execution Result 33 | 34 | !["result"](result.png) 35 | 36 | Developed with Visual Code and DOTNET CORE with (love)... 37 | -------------------------------------------------------------------------------- /senior/valet-parking/result.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tarikguney/interview-questions/f629df869145ee9d8c59382cf04249be58aa91bf/senior/valet-parking/result.png --------------------------------------------------------------------------------