Skip to content

Latest commit

 

History

History
236 lines (205 loc) · 10.4 KB

README.md

File metadata and controls

236 lines (205 loc) · 10.4 KB

Interview Questions

This repository is a curated collection of some of those repetitive, and boring coding trivia questions that gets asked around at Indian startups.

JAVA Questions

  • What is the difference between JVM, JRE, JDK?
  • Is java compiled or interpreted language
  • What is JIT?
  • What is a mutable class and how to make a class immutable?
  • What is a singelton. Can you create a singelton class?
  • Hashmap vs Hashtable
  • Checked vs Unchecked exceptions
  • What is boxing and unboxing
  • Is java value-type or reference type
  • How do you solve readers-writers problem using java
  • abstract vs interfaces
  • When to use abstract class and interfaces
  • What are inner classes
  • Yielding vs sleeping
  • What is the difference between IdentityHashMap and a HashMap?
  • Differentiate between <? extends T> and <? super T> in Generics?
  • What is serialization and why it is used
  • How does hashmap work ?
  • What is meant by string pooling ?
  • Difference between String s ="Test" and String s = new String("Test")
  • Why is string class immutable
  • What is difference between StringBuffer and StringBuilder?
  • How do you create your own immutable class?
  • Stringbuilder vs Stringbuffer
  • Why is volatile keyword used ?
  • Implement double checked locking on Singelton Class in java
  • Can you override static methods in a class
  • What are inner classes ?
  • What is dynamic binding /late binding ?
  • Why are generics used in java ?
  • What are some new things in 1.8 ?
  • What are lambda expression ?
  • final vs finally vs finalize java ?
  • How do you avoid deadlock in java ?
  • What is Object Pooling? How do you implement it?
  • What are different types of design patterns in java ?

Spring Questions

  • Difference between @Component @Controller @Repository ?

Software Design Questions

  • Design elevator system for a building
  • Design a chat application
  • Design an ecommerce system
  • Design an analytics platform for an ecommerce system
  • Design offer system for a products for an ecommerce system
  • Design a restaurant finder app for a customer in accordance to his/her geo cordinates?
  • How would you arrange 10TB sized text file with many duplicated lines in a 4GB memory RAM?
  • For web service lovers, how do you design a RESTful service, not specific to any JAX-RS Library?
  • Design a system where you can provide suggestions to users for ecommerce based company?
  • How do you search tweets based on a hashtag ?
  • How do you implement coupons system in ecommerce ?
  • How do you implement spell corrector for say reviews ?
  • How do you implement a Messages bus ?
  • Design BookMyShow ?

WebDev Questions

  • What is HTTP?
  • Whats new in HTML 5 ?
  • What are some commonly used HTTP headers?
  • Describe the process from the time you type in a website's URL to it finishing loading on your screen.
  • How do you prevent session hijacking?
  • What are different ways of authentication?
  • What is CORS?
  • How do you bypass CORS?
  • What is meant by Client Side MVC?
  • What does doc type do?
  • What does the defer attribute do when loading a script tag?
  • What is Cross-Site Scripting?
  • What is the Same Origin Policy?
  • What is Cross-Site Request Forgery?
  • What are HTTP actions? List all HTTP actions that you know, and explain them.
  • Explain the following HTTP headers: Expires, Date, Age, If-Modified, Do Not Track, Cache-Control, Transfer-Encoding, ETag, X-Frame-Options
  • Long-Polling vs Websockets vs Server-Sent Events?
  • What is CDN ?
  • Why is minification useful?
  • What are different means of making a website faster ?
  • Cookies vs Local Storage vs Session Storage
  • What does a doctype do?
  • REST vs SOAP ?
  • How do you write REST resource for user ?
  • What is XSS and SQL injection and how do you prevent it ?
  • How do you improve database performance ?
  • What and how does HTTPS works ?
  • What are different types of engine types in MySQL ?
  • Explain how you will design and implement login feature for a website ?

Javascript Questions

  • Scope of a variable in javascript
  • Explain how this works in JavaScript
  • Define closures and give us an example
  • How do you make a variable private in js ?
  • What is an array in javascript
  • What is event delegation ?
  • What is event bubbling ?
  • What is hoisting ?
  • How does JSONP works ?
  • Describe the difference between a cookie, sessionStorage and localStorage
  • == vs ===
  • What is deferred object in jQuery ?
  • What object does $.ajax return ?
  • null vs undefined vs undeclared ?
  • Explain the differences on the usage of foo between function foo() {} and var foo = function() {}

Algorithms

Arrays

  • Find count of smaller element on right side
  • Find a key in a infintely large sized array
  • How do you find floor / ceil of value in a sorted array ?
  • Find number occuring odd number of times in an array
  • Search for a key in sorted array which is rotated
  • What is the maximum continous subarray sum ?
  • How do you find a subarray for a given sum in an array ?
  • How do you check whether elements are consecutive in an array ?
  • Given two sorted arrays such the arrays may have some common elements. Find the sum of the maximum sum path to reach from beginning of any array to end of any of the two arrays. We can switch from one array to another array only at common elements.
  • Given an array of distinct elements, rearrange the elements of array in zig-zag fashion in O(n) time. The converted array should be in form a < b > c < d > e < f.
  • How do you find the equilibrium index in an array ? (sum of elements at lower indexes is equal to the sum of elements at higher indexes)

Trees

  • Serialize and deserialize a binary tree and also for n-ary tree ?
  • What are various traversals and how do you implement them ?
  • How do you find out whether a tree is BST or not ?
  • How do you delete a tree ?
  • How do you evaluate expression tree ?
  • How do you find lowest common ancestors in BST ?
  • How do you find whether trees are identical or not ?
  • How do you link all the leaves as doubly linked lists and detaching them from tree ?
  • How do you convert a tree to its mirror image ?
  • Diameter of a tree ?
  • How do you find shortest distance between two nodes in a binary tree ?
  • How do you print a tree in spiral order in a binary tree starting from root ?
  • Convert a tree to doubly linked list
  • Top , bottom , left ,right view for a tree ?
  • Print common nodes in two binary search trees
  • Predecessor and successor for a key in a BST
  • How do you find out floor and ceil value for a key in a BST ?
  • How do you build a BST using a sorted array ?
  • Total possible number of binary serach trees for given N keys

Linked Lists

  • Reverse a linked list using recursion only
  • How do you delete a node which has only pointer to the node ?
  • How do find whether two linked lists intersect or not ?
  • Find the intersection point for two single linked lists
  • How do you search a key in sorted 2d array row wise ?
  • Find nth node from end in a single linked lists

Queues

  • Implement BFS of a graph
  • Implement LRU cache

Stacks

  • How do you find the next greater element in an array ?
  • Reverse a stack using recursion
  • How do you implement two stacks/queues using a single array ?
  • Stocks span problem

Heaps

  • Median in a large continous array ?
  • Print 2d array in a sorted order where all the values are sorted row wise
  • Find N largest/smallest element in an array
  • Given N arrays which are sorted how do you find the smallest range such that atleast one element is present in each array
  • Kth largest/smallest element for infintely larged sized array

Strings

  • Reverse words in a given string
  • Given a string find first non repeating character
  • How do you check whether two strings are rotations of each other
  • Run length encoding
  • Print all permutations
  • Check whether two strings are anagrams to each other
  • Given a sequence of words print all words together which are anagrams to each other
  • Generate permutations of a string

BITS related

  • Reverse bits in a int variable

Dynamic Programming

  • How do you find largest sum for a subarray of any size ?
  • How do you find largest sum in a 2d array of all the rectangles that can be formed ?
  • How do you find whether a number is ugly or not ? (Divisible by 2 ,3 or 5)
  • Find the maximum length of increasing sub sequence in an array ?
  • Edit distance problem
  • Transform a given word to another word with minimum transformation where each transformation can change one charater and intermediate word must be a given dictionary of words

Graphs

  • DFS and BFS implementation ?
  • Is undirected graph connected ?
  • Find total number of connected components ?
  • Find the shortest path between two nodes in undirected graph where edge lengths are equal ?

Misc

  • How do you find LCM of n numbers ?
  • How do you find whether a number is Ugly number or not ? (whose only prime factors are 2, 3 or 5 ?)
  • How do you find whether a number is fibonacci number or not ?
  • How do you evaluate a infix expression ?
  • ASCII to INT vice versa conversion
  • Implement multi threaded logger

HR

  • Why our company ?
  • Why you are leaving your present company ?
  • Have you had an argument with your manager in your previous company?
  • What is your strength and weakness ?
  • Describe an incident where you have failed completely and how did you recover ?
  • Have you ever missed your deadlines ?
  • What is the most difficult situation you have ever faced in your life? How did you handle it?
  • What is the angle between hour hand and minute hand in an analog clock?

Design interview references

References