├── LICENSE └── README.md /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | {description} 294 | Copyright (C) {year} {fullname} 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | {signature of Ty Coon}, 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Back-End Developer Interview Questions 2 | ====================================== 3 | 4 | I'm not a big fan of asking technical questions in job interviews: I'd rather prefer to sit together with candidates in front of some real code, facing a real problem, and have a full day of pair programming rotating with all the team members. Yet, some technical questions could be used to start a deep and nice conversation, and this can be useful to get a deeper knowledge of eachothers. 5 | 6 | This repo contains a number of backend interview questions that can be used when vetting potential candidates. It is by no means recommended to use every single question here on the same candidate (that would take hours). Choosing a few items from this list should help you vet the intended skills you require. 7 | 8 | This project is admittedly inspired by [Front-end Job Interview Questions](https://github.com/darcyclarke/Front-end-Developer-Interview-Questions) by [@darcyclarke](https://github.com/darcyclarke) 9 | 10 | **Note:** Keep in mind that many of these questions are open ended and could lead to interesting discussions that tell you more about the person's capabilities than a straight answer would. Again, I stress that just asking question is hardly sufficient. Complete the interview with a long pair programming session with your candidates: it is one of the best opportunities to know eachothers' style and approach and to let candidates know some details about their future dayjob. 11 | 12 | 13 | ## Table of Contents 14 | 15 | 1. [General Questions](#general) 16 | 1. [Open Questions](#open) 17 | 1. [Questions about Design Patterns](#patterns) 18 | 1. [Languages Questions](#languages) 19 | 1. [Web Questions](#web) 20 | 1. [Databases Questions](#databases) 21 | 1. [NoSQL Questions](#nosql) 22 | 1. [Code Versioning Questions](#codeversioning) 23 | 1. [Concurrency Questions](#concurrency) 24 | 1. [Questions about Distributed Systems](#distributed) 25 | 1. [Questions about Software Lifecycle and Team Management](#management) 26 | 1. [Questions about logic and algorithms](#algorithms) 27 | 1. [Questions about Software Architecture](#architecture) 28 | 1. [Questions about Service Oriented Architecture and Microservics](#soa) 29 | 1. [Questions about Security](#security) 30 | 1. [Bill Gates Style Questions](#billgates) 31 | 1. [Questions based on snippets of code](#snippets) 32 | 33 | 34 | ####[[↑]](#toc) General Questions: 35 | 36 | * Why Functional Programming matters? When should a functional programming language be used? 37 | I think current Procedural or OOP languages can't be run on multiple processors simultaneously because of their binding with data. Functional programming can benefit from it. eg: Scheme and Haskell 38 | Good in concurrency, gamingAPI, mathematical computations. 39 | 40 | http://fsharpforfunandprofit.com/posts/ten-reasons-not-to-use-a-functional-programming-language/ 41 | 42 | * What is Encapsulation important for? difference of encapsulation with abstraction. 43 | encapsulation hides how a function does it. eg: convertStringToNumber( str ) , how it does is hidden because of encapsulation. 44 | abstraction( saransh in hindi ): revealing what function does( show essential details only ). above function tells that it converts string to integer. 45 | 46 | * What is a real-time system and how is it different from an ordinary system? 47 | real time system has to do its task within time frame with minimum delay. it should have minimal context switching latency, interrupt latency. eg: ABS system in cars, pacemaker 48 | 49 | * What's the relationship between real-time languages and heap memory allocation? 50 | ? 51 | 52 | * Immutability is the practice of setting values once, at the moment of their creation, and never changing them. How immutability can help writing safer code? 53 | to avoid someone from accidently changing the constant or read only value, immutability is used. 54 | 55 | * Pro and cons of mutable and unmutable values. 56 | http://stackoverflow.com/questions/214714/mutable-vs-immutable-objects 57 | 58 | * What's the Object-Relational impedence mismatch? 59 | https://en.wikipedia.org/wiki/Object-relational_impedance_mismatch 60 | 61 | * What's the difference between design, architecture, functionality and aesthetic? Discuss 62 | software architecture is about design of entire system giving bigger picture while design include designing module/class or implementation details. 63 | http://stackoverflow.com/questions/704855/software-design-vs-software-architecture 64 | 65 | functionality is practically working of things while aesthetic means prettiness of things. 66 | 67 | * Which principles would you apply to define the size of a cache? 68 | 69 | * How do Companies like Microsoft, Google, Opera and Mozilla profit from their browsers? 70 | 71 | * Why opening a TCP socket has a large overhead? 72 | * What's the difference between TCP and HTTP? 73 | * Remove the concept of "null" from your preferred language. 74 | http://stackoverflow.com/questions/1296843/what-is-the-difference-between-null-0-and-0 75 | 76 | * What are the tradeoffs of client-side rendering vs. server-side rendering? 77 | using client side rendering( jQuery, AngularJS etc.. ) avoids loading whole page on small changes. but it harms SEO ( although phantomJS can be used, but it adds complexity ), quirks on various browsers. Sometimes it takes more time to load than getting page from server. So I think we should consider client side rendering only if number of simultaneous users are very high on server, then its good to offload some work to client side. 78 | http://www.quora.com/What-are-the-tradeoffs-of-client-side-rendering-vs-server-side-rendering 79 | 80 | ####[[↑]](#toc) Open Questions: 81 | * What did you learn this week? 82 | * List the last 5 books you read. 83 | * Let's have a conversation about "*Reinventing the wheel*", the "*Not Invented Here Syndrome*" and the "*Eating Your Own Food*" practice 84 | its good not to waste time in something which has already been created, tested and optimized. if we think that we are doing something new, we should check that someone else has done same thing earlier, because most of the time someone has already faced the same problem and might have given solution. 85 | 86 | In programming, it is also common to refer to the "NIH syndrome" as the tendency towards reinventing the wheel (reimplementing something that is already available) based on the belief that in-house developments are inherently better suited, more secure, more controlled, quicker to develop, and incur lower overall cost (including maintenance cost) than using existing implementations. -- wiki 87 | but sometimes it may be good because of patent infringement, lock-in, better control 88 | 89 | Eating Your Own Food is using own product, eg: using bing search only. although its good bugs to find bugs. 90 | e difficult? What makes maintaining software hard? 91 | more you know about technology, architecture more you think about scalability, portability, performance harder it get. 92 | 93 | * Would you prefer working on Green Field or Brown Field projects? Why? 94 | https://en.wikipedia.org/wiki/Greenfield_project 95 | 96 | 97 | 98 | * [What happens when you type google.com into your browser and press enter?](https://github.com/alex/what-happens-when) 99 | * As a software engineer you want both to innovate and to be predictable. How those 2 goals can coexist in the same strategy? 100 | * There is an aesthetic element to all design. The question is, is this aesthetic element your friend or your enemy? 101 | * What does your computer do when you wait? 102 | * Explain Unicode/Database Transactions to a 5 year old child 103 | * Defend the monolithic architecture 104 | simple to develop, deploy, scale: just use multiple copies of application behind load balancer 105 | but as application grows code becomes difficult to understand, modify. scaling is in 1D, everything has to be scaled. what if only few parts of applications are loaded. 106 | OR we can use microservices arch :) 107 | 108 | * What does it mean to be a "Professional Developer"? 109 | * Is developing software an art, a craftsmanship or an engineering endeavour? Your opinion. 110 | * "People who like this also like... ". How would you implement this feature in an e-commerce shop? 111 | * Say your Company gives you one week you can use to improve your and your colleagues' lifes: how would you use that week? 112 | * What's the next thing you would automate in your current workflow? 113 | 114 | 115 | ####[[↑]](#toc) Questions about Design Patterns: 116 | 117 | * Tell me about the Hollywood Principle. 118 | https://en.wikipedia.org/wiki/Hollywood_principle 119 | 120 | * About the Law of Demeter (the Principle of Least Knowledge): write a code violating it, then fix it. 121 | component units should be decoupled in such a way that they call only their neighbours not strangers. increases adaptability and portability. 122 | 123 | * Which are the limits and pitfalls of Active-Record? 124 | * What are the differences between Active-Record and Data-Mapper? 125 | http://culttt.com/2014/06/18/whats-difference-active-record-data-mapper/ 126 | 127 | * What is the intent of the Null Object Pattern? 128 | In Null Object pattern, we create an abstract class specifying various operations to be done, concrete classes extending this class and a null object class providing do nothing implemention of this class and will be used seemlessly where we need to check null value. 129 | http://www.tutorialspoint.com/design_pattern/null_object_pattern.htm 130 | 131 | * Why is Composition often better than Inheritance? 132 | http://stackoverflow.com/questions/2399544/difference-between-inheritance-and-composition 133 | http://stackoverflow.com/questions/49002/prefer-composition-over-inheritance 134 | 135 | * Domain driven design 136 | You should have knowledge of domain( say banking software ) before building software or that domain 137 | 138 | * What is an Anti-corruption Layer? 139 | similar to adapter design pattern but different, you are fixing someone else's code. 140 | http://programmers.stackexchange.com/questions/184464/what-is-an-anti-corruption-layer-and-how-is-it-used 141 | 142 | * Could you write a Thread-Safe Singleton class? 143 | auto thread safe singleton pattern can be used: 144 | private static final Object instance = new Object(); 145 | 146 | public static Object getInstance() { 147 | return instance; 148 | } 149 | 150 | * Could you implement Objects in terms of Higher Order Functions, and vice-versa? 151 | ? 152 | 153 | * Show with an example that global objects are evil. 154 | 155 | * The ability to change implementation without affecting clients is called Data Abstraction. Produce and example violating this property, then fix it. 156 | 157 | * Write a snippet of code violating the DRY principle. Then, fix it. 158 | 159 | * How would you deal with Dependency Hell? 160 | use tools like npm for nodejs, use composer for php, make files can help. OS have their own package managers. 161 | 162 | * Why is goto evil? 163 | goto is a quick way to get out of mess. if you have to use goto there might be some problem with design. I think if we can't redesign we should use goto. 164 | 165 | * Suppose the system you are working on does not support transactionality. How would you implement it from scratch? 166 | 167 | 168 | ####[[↑]](#toc) Questions about Languages: 169 | 170 | * Tell me the 3 worse defects of your preferred language 171 | php: dynamic typing and casting like C, == and === for comparison 172 | doesn't support unsigned integers, have to use lib BCMath, auto conversion of integers to float in overflow 173 | order of arguments differ strpos and array_search 174 | can't do recursion 175 | 176 | * Why is there a rising interest about Functional Programming? 177 | 178 | 179 | * What is a closure, and what is useful for? What's in common between closures and classes? 180 | * What are generics useful for? 181 | * What are high-order functions? What are they useful for? Write one, in your preferred language. 182 | * Write a loop, then transform it into a recursive function, avoiding mutability. Discuss. 183 | * What does it mean when a language treats functions as first-class citizens?
184 | 185 | this means the language supports passing functions as arguments to other functions, returning them as the values from other functions, and assigning them to variables or storing them in data structures. 186 | 187 | * Show me an example where an Anonymous Function can be useful
188 | https://en.wikipedia.org/wiki/Anonymous_function 189 | 190 | * What is Dynamic Method Dispatch?
191 | http://stackoverflow.com/questions/20187587/what-is-the-difference-between-dynamic-dispatch-and-late-binding-in-c 192 |
193 | 194 | 195 | * What are namespaces useful for? Invent an alternative. 196 | 197 | * Talk about Interoperability between Java and C# (choose 2 other arbitrary languages) 198 | 199 | * Why do many software engineers not like Java?
200 | http://www.forbes.com/sites/quora/2015/02/21/java-makes-programmers-want-to-do-absolutely-anything-else-with-their-time/ 201 | complexity, running in VM etc... 202 | 203 | * What makes a good language good and a bad language bad?
204 | https://www.quora.com/What-makes-a-good-programming-language 205 | 206 | 207 | * Write two functions, one Referentially Transparent and the other one Referentially Opaque. Discuss.
208 | if compiler can replace funciton with expression( content in funciton ) function is referentially transparent other wise its opaque. funciton using global vars can be opaque. 209 | https://en.wikipedia.org/wiki/Referential_transparency_(computer_science) 210 | 211 | * Whats the Stack and what's the Heap? 212 | * Why is it important that in a language functions are first class citizen? 213 | 214 | 215 | ####[[↑]](#toc) Questions about Web development: 216 | * Why first-party cookies and third-party cookies are treated so differently?
217 | 218 | 219 | ####[[↑]](#toc) Questions about Databases: 220 | * mysql vs postgress sql
221 | http://stackoverflow.com/questions/110927/would-you-recommend-postgresql-over-mysql 222 | 223 | 224 | * How would you manage the migration of a project from MySQL to PostgreSQL?
225 | https://wiki.postgresql.org/wiki/How_to_make_a_proper_migration_from_MySQL_to_PostgreSQL 226 | http://stackoverflow.com/questions/4756825/mysql-to-postgresql-migration 227 | 228 | * Why in SQL ```SELECT * FROM table WHERE field = null``` does not match records with null ``field``?
229 | http://stackoverflow.com/questions/12853944/why-in-sql-null-cant-match-with-null 230 | 231 | * What's ACID (Atomicity, Consistency, Isolation, Durability)? 232 | 233 | * How would you manage database schema migrations?
234 | when adding or removing coloumn, other teams should be notified about changes. be careful, sometimes old codebase might not work with new schema. situation like we changed database, new code doesnt work with it and old code doesn't work too because db has changed. get help from migration tools. 235 | 236 | * How is Lazy Loading achieved? When is it useful? What are its pitfalls? 237 | Lazy Loading is a programming practice in which you only load or initialize an object when you first need it. eg: lazily loading images on scroll of page or some threshold time. 238 | 239 | if we are using ORM, due to lazy loading ORM will fire query for each cat, which will flood DB. 240 | $cats = load_cats(); 241 | foreach ($cats as $cat) { 242 | $cats_hats = load_hats_for_cat($cat); 243 | // ... 244 | } 245 | 246 | we can batch queries or use eager loading by: 247 | 248 | $cats = load_cats(); 249 | $hats = load_all_hats_for_these_cats($cats); 250 | foreach ($cats as $cat) { 251 | $cats_hats = $hats[$cat->getID()]; 252 | } 253 | 254 | http://www.sitepoint.com/silver-bullet-n1-problem/ 255 | 256 | * What's the N+1 problem? 257 | https://secure.phabricator.com/book/phabcontrib/article/n_plus_one/ 258 | 259 | * How would you find the most expensive queries in an application?
260 | http://www.ducea.com/2006/11/06/identifying-mysql-slow-queries/ 261 | or we can find interval it took to fetch/update data... 262 | 263 | ####[[↑]](#toc) Questions about NoSQL: 264 | 265 | * What is Eventual Consistency?
266 | Eventual consistency => data will be updated eventually like DNS system. strong consistency => but SQL requires databases to be ACID compliant and latest data should always be visible. 267 | 268 | https://cloud.google.com/datastore/docs/articles/balancing-strong-and-eventual-consistency-with-google-cloud-datastore/ 269 | 270 | * About the CAP Theorem, make examples of CP, AP and CA systems.
271 | C - consistency, A - availability, P -partition tolerant: can't have more than 2 at a time
272 | http://stackoverflow.com/questions/3342497/explanation-of-base-terminology 273 | 274 | * How does NoSQL tackle scalability challenges?
275 | http://programmers.stackexchange.com/questions/194340/why-are-nosql-databases-more-scalable-than-sql 276 | 277 | * mongoDB vs lucene searching 278 | mongodb stores data, creates indexes as in sql so searching is similar to sql. but lucene stores inverted indexes for tokens, so its good for full text search 279 | 280 | 281 | ####[[↑]](#toc) Questions about code versioning: 282 | 283 | * Why branching with Mercurial or git is easier than with SVN? 284 | * What are the pros and cons of Distributed Version Control Systems like git over Centralized ones like SVN? 285 | * Could you describe GitHubFLow and GitFlow workflows? 286 | * What's a rebase? 287 | * Why merges are easier with Mercurial and git than with SVN and CVS? 288 | 289 | 290 | 291 | ####[[↑]](#toc) Questions about Concurrency: 292 | 293 | * Why do we need Concurrency, anyway? Explain.
294 | http://programmers.stackexchange.com/questions/115474/why-should-i-know-concurrent-programming 295 | 296 | * Why is testing multithreading / concurrent code so difficult? 297 | 298 | * What is a Race Condition? Code an example, using whatever language you like.
299 | http://stackoverflow.com/questions/34510/what-is-a-race-condition 300 | 301 | * What is a Deadlock? Explain using code.
302 | http://www.java2novice.com/java-interview-programs/thread-deadlock/ 303 | 304 | * What is Process Starvation? 305 | * What is a Wait Free algorithm? 306 | 307 | ####[[↑]](#toc) Questions about Distributed Systems: 308 | 309 | * How to test a distributed system? 310 | * In which case whould you apply asynchronously communication between two systems? 311 | * What are the general pitfalls of Remote Procecure Call? 312 | * If you are building a distributed system for scalability and robustness, what are the different things you'd think of in the case you are working in a closed and secure network environment or in geographically distributed and public system? 313 | * How to manage Fault Tolerance in a Web application? And in a Desktop one? 314 | * How to deal with failures in Distributed Systems? 315 | * Let's talk about the several approaches to Reconciliation after network partitions 316 | * What are the Fallacies of Distributed Computing? 317 | * When would you use Request/Reply and when Publish/Subscribe? 318 | 319 | 320 | ####[[↑]](#toc) Questions about Software Lifecycle and Team Management: 321 | 322 | * What is agility? 323 | * How would you deal with Legacy Code? 324 | * I'm the CEO of your Company. Explain me Kanban and convince me to invest on it. 325 | * What is the biggest difference between Agile and Waterfall? 326 | * Being a team manager, how would you deal with the problem of having too many meetings? 327 | * How would you manage a very late project? 328 | * "*Individuals and interactions over processes and tools*" and "*Customer collaboration over contract negotiation*" comprise half of the values of the Agile Manifesto. Discuss 329 | * Tell me what decisions would you take if you could be the CTO of your Company. 330 | * Are Program Managers useful? 331 | * Organize a development team using flexible schedules (that is, no imposed working hours) and "Take as you need" vacation policy 332 | * How would you manage a very high turn over and convince developers not to leave the team, without increasing compensation? 333 | 334 | 335 | ####[[↑]](#toc) Questions about logic and algorithms: 336 | 337 | * Make a FIFO Queue using only LIFO Stacks. Then build a LIFO Stack using only FIFO Queues. 338 | * Write a snippet of code affected by a Stack Overflow 339 | * Write a tail-recursive version of the factorial function 340 | * Using your preferred language, write a REPL that echoes your inputs. Evolve it to make it an RPN calculator. 341 | * How would you design a "defragger" utility? 342 | * Write a programs that builds random mazes. 343 | * Write a sample code that produces a memory leak 344 | * Generate a sequence of unique random numbers 345 | * Write a simple Garbage collection system 346 | * Write a basic message broker, using whatever language you like. 347 | * Write a very basic web server. Draw a road map for features to be implemented in the future. 348 | * How would you sort a 10GB file? How would your approach change with a 10TB one? 349 | * Implement the `rnd()` function. 350 | 351 | 352 | ####[[↑]](#toc) Questions about Software Architecture: 353 | 354 | * What is CQRS (Command Query Responsibility Segregation)? How is it different from the oldest Command-Query Separation Principle?
355 | http://programmers.stackexchange.com/questions/165120/separation-versus-segregation 356 | 357 | * What is Three-Tier architecture? 358 | http://stackoverflow.com/questions/4577587/mvc-vs-3-tier-architecture 359 | 360 | * How would you design a software system for scalability? 361 | 362 | * What are the strategies to deal with the C10k problem? 363 | https://www.youtube.com/watch?v=73XNtI0w7jA&feature=youtu.be 364 | 365 | * How to deal with failover and user sessions? 366 | 367 | * How would you design a decentralized (that is, with no central server) P2P system?
368 | http://abdulapopoola.com/2013/03/12/design-patterns-pub-sub-explained/ 369 | 370 | * pubsub vs observer
371 | http://stackoverflow.com/questions/15594905/difference-between-observer-pub-sub-and-data-binding 372 | 373 | * Why doesn't CGI scale? 374 | * How would you defend the design of your systems against Vendor Lock-in? 375 | * What makes code readable? 376 | * What are the disadvantages of the Publish-Subscribe pattern at scale? 377 | * When would you apply horizontal scaling and when vertical scaling? 378 | horizontal or scaling out: use cluster of multiple machines. scaling vertically: increase RAM/CPU on same machine.
379 | http://stackoverflow.com/questions/11707879/difference-between-scaling-horizontally-and-vertically-for-databases 380 | 381 | * When is a cache not useful or even dangerous?
382 | http://www.slideshare.net/betclicTech/minitraining-to-cache-or-not-to-cache 383 | 384 | * What's new in CPUs since the 80s, and how does it affect programming?
385 | http://danluu.com/new-cpu-features/ 386 | 387 | * In which part of the lifecycle performance should be taken in consideration, and how? 388 | 389 | * How could a Denial of Service arise not maliciously but for a design or architectural problem? 390 | * Why does Event-Driven Architecture improve scalability? 391 | 392 | * What’s the relationship between Performance and Scalability?
393 | http://apmblog.dynatrace.com/2008/09/11/performance-vs-scalability/ 394 | 395 | * When is it OK to use tight coupling?
396 | http://stackoverflow.com/questions/19976273/where-loose-and-tight-coupling-would-be-used-as-a-real-scenario
397 | 398 | * What characteristic should a system have to be Cloud Ready?
399 | http://www.ibm.com/developerworks/websphere/techjournal/1404_brown/1404_brown.html
400 | http://vitalflux.com/how-to-design-develop-cloud-ready-applications/ 401 | 402 | ####[[↑]](#toc) Questions about Service Oriented Architecture and Microservices: 403 | * Why, in a SOA, long-lived transactions are discorauged and Sagas are suggested instead? 404 | * What are the differences between Soa and Microservices? 405 | * Let's talk about web services versioning, version compatibility and breaking changes. 406 | * What's the difference between a transaction and a compensation operation in a saga, in SOA? 407 | * When is a Microservice too micro? 408 | * What are the pros and cons of MicroService architecture? 409 | 410 | 411 | ####[[↑]](#toc) Questions about Security: 412 | * What's Two Factor Authentication? How would you implement it in an existing web application? 413 | 414 | 415 | ####[[↑]](#toc) Bill Gates Style Questions: 416 | * What would happen if you put a mirror in a scanner? 417 | * Imagine there's a perfect clone of yourself. Imagine that that clone is your boss. Would you like to work for him/her? 418 | * Interview me 419 | * Why are Quora's answers better than Yahoo Answers' ones? 420 | * Defend Cobol against modern languages 421 | * Where will be you, in 10 years? 422 | * You are my boss and I'm fired. Inform me. 423 | * I want to refactor a legacy system. You want to rewrite it from scratch. Argument. Then, switch our roles. 424 | * Your boss asks you to lie to the Company. What's your reaction? 425 | 426 | 427 | ####[[↑]](#toc) Questions about snippets of code: 428 | * What's the output of this Javascript function? 429 | ```javascript 430 | function hookupevents() { 431 | for (var i = 0; i < 3; i++) { 432 | document.getElementById("button" + i) 433 | .addEventListener("click", function() { 434 | alert(i); 435 | }); 436 | } 437 | } 438 | ``` 439 | 440 | * About Type Erasure, what's the output of this Java snippet, and why? 441 | ```java 442 | ArrayList li = new ArrayList(); 443 | ArrayList lf = new ArrayList(); 444 | if (li.getClass() == lf.getClass()) // evaluates to true 445 | System.out.println("Equal"); 446 | ``` 447 | 448 | 449 | * Can you spot the memory leak? 450 | ```java 451 | public class Stack { 452 | private Object[] elements; 453 | private int size = 0; 454 | private static final int DEFAULT_INITIAL_CAPACITY = 16; 455 | 456 | public Stack() { 457 | elements = new Object[DEFAULT_INITIAL_CAPACITY]; 458 | } 459 | 460 | public void push(Object e) { 461 | ensureCapacity(); 462 | elements[size++] = e; 463 | } 464 | 465 | public Object pop() { 466 | if (size == 0) 467 | throw new EmptyStackException(); 468 | return elements[--size]; 469 | } 470 | 471 | /** 472 | * Ensure space for at least one more element, roughly 473 | * doubling the capacity each time the array needs to grow. 474 | */ 475 | private void ensureCapacity() { 476 | if (elements.length == size) 477 | elements = Arrays.copyOf(elements, 2 * size + 1); 478 | } 479 | } 480 | ``` 481 | 482 | * `if`s and in general conditional statements lead to procedural and imperative programming. Can you get rid of this `switch` and make this snippet more objetct oriented? 483 | 484 | ```java 485 | public class Formatter { 486 | 487 | private Service service; 488 | 489 | public Formatter(Service service) { 490 | this.service = service; 491 | } 492 | 493 | public String doTheJob(String theInput) { 494 | String response = service.askForPermission(); 495 | switch (response) { 496 | case "FAIL": 497 | return "error"; 498 | case "OK": 499 | return String.format("%s%s", theInput, theInput); 500 | default: 501 | return null; 502 | } 503 | } 504 | } 505 | ``` 506 | 507 | 508 | * Can you get rid of these `if`s and make this snippet of code more object oriented? 509 | 510 | ```java 511 | public class TheService { 512 | private final FileHandler fileHandler; 513 | private final FooRepository fooRepository; 514 | 515 | public TheService(FileHandler fileHandler, FooRepository fooRepository) { 516 | this.fileHandler = fileHandler; 517 | this.fooRepository = fooRepository; 518 | } 519 | 520 | public String Execute(final String file) { 521 | 522 | final String rewrittenUrl = fileHandler.getXmlFileFromFileName(file); 523 | final String executionId = fileHandler.getExecutionIdFromFileName(file); 524 | 525 | if ((executionId == "") || (rewrittenUrl == "")) { 526 | return ""; 527 | } 528 | 529 | Foo knownFoo = fooRepository.getFooByXmlFileName(rewrittenUrl); 530 | 531 | if (knownFoo == null) { 532 | return ""; 533 | } 534 | 535 | return knownFoo.DoThat(file); 536 | } 537 | } 538 | ``` 539 | --------------------------------------------------------------------------------