Skip to main content

General programming/ software development Interview questions

1. Have you worked with design patterns? Which design pattern you have used in your work? How does it work?
 
There are 3 broad types of design patterns:

a. Creational Patterns -
   These patterns provide different strategies to create an object.
b. Structural Patterns -
   These patterns define object structure and its relationship with other objects.
c. Behevorioal Patterns -
   These patterns deal with how objects should interact with each other in a optimum 
and efficient manner.
d. Concurrency Patterns - 
    These design patterns deal with multi threaded programming paradigm.

These design patterns are also called as gang of four (GOF) design patterns.

Following are sub-types of creational design patterns
a. Factory
b. Abstract Factory
c. Singleton
d. Prototype
e. Builder
f. Object Pool

Following are sub-types of Structural design patterns
a. Adapter
b. Bridge
c.Composite
d. Decoreator
e. Facade
f. Flyweight
g. Proxy

Following are sub-types of behavioral design patterns
a. Chain of responsibility
b. Command Pattern
c. Interpreter pattern
d. Iterator Pattern
e. Mediator Pattern
f. Memento Pattern
g. Observer Pattern
h. State Pattern
i. Strategy Pattern
j. Template Pattern

2. What is difference between inheritance and Association?
A. Inheritance is IS-A relationship. Association is HAS-A relationship. Association can be one-to-one, one-to-many, many-to-one, many-to-many.
 
3. What are types of association?
A. Composition and Aggregation. Composition is strong association, ie. the associated object cannot exist independent of its owner (House has a room) while aggregation is weak association, where entities can exist independent of each other (school has teachers).
 
4. What is important consideration while designing any software?
A. Most important considerations during designing a software are how the system will tackle worst case scenarios.
 
5. Security short comings of jwt?
A. JWT can spoofed. Solution to this is to append the hash of JWT at the tail of JWT. This way if the JWT is tampered its hash will no longer verify and masquerading attacks can be checked
 
6. What is SOLID programming principle, with example.
A.
  • S - Single-responsibility Principle. - Each class must be accountable for single responsibility
  • O - Open-closed Principle. - A class must be open to extention but closed for modification
  • L - Liskov Substitution Principle. - A child class must be substitutable in place of a parent class
  • I - Interface Segregation Principle. - Interface must address only specific functionality so that user is not forced to implement methods not used by them.
  • D - Dependency Inversion Principle. - High level classes and low level classes must not depend on each other, instead the both must depend on abstractions.
7. Overview of architecture/flow of request of current project?
A. Answer will vary according to your project. Make sure you prepare your answer well and practice it before the interview. Also, learn to draw the correct architecture diagram for senior positions.
 
8. How is security handled in your current project?
A. This is very frequently asked question especially in L2 round. Make sure you prepare the answer for this question well as per your project.
 
9. How is caching implemented in your current project?
A. There are various ways caches are implemented in production code. It varies from project to project. In-memory caches such as hashmaps are sufficient in some scenarios while other applications might use elaborate caching libraries like Redis and Memcached. It really depends on your caching needs and caching strategy you choose.

10. How is multithreading implemented in your application?
A. This question aims to understand how well aware you are with multi-threaded programming. You must be aware of runnable and callable interfaces and executors.

Comments

Popular posts from this blog

Intercommunication in the world of micro services

I always wondered what can be the different ways in which the microservices can commmunicate with each other. Like majority of us I almost instintively thought of REST or SOAP as two prominant ways of passing data over internet, but are there other better ways of making the different components of an enterprise systen talk to each other? If yes what is the purpose of their existance, lets address these and other related queries in this article. The manner in which micro services talk to each other can be classified in four major categories: Synchronous Communication Asynchronous Communication Database Level Communication Hybrid Lets explore them one by one -  Synchronous Communication In this style of inter service communication a sender service requests some resource from its counterpart and then waits for the response before proceeding ahead. This is also called blocking mode because the caller is blocked till it gets wahat it had requested. Lets explore some protocols which use ...

Spark Checkpointing,Union, Lineage And Partioning

I have been working on apache spark lately and wanted to consolidated my learnings at one place so that I can refer later and make it available to other developers as well. While working with spark you will often run into situations where the way you write code normally results in most inefficient results. You can visualise spark plan executions but it is very tedious to navigate and make sense of in terms of what exactly is cause of the problem. In such case having basic knowledge of how spark manages tasks can help arrive at solutions to improve compute efficiency. Below are a set of techniques I have used to improve compute efficiency of spark applications. SparkContext with a Checkpoint Directory In  Apache Spark , the  SparkContext  is the entry point to interact with the Spark framework. It manages the execution of jobs, resource allocation, and coordination across clusters. A  checkpoint directory  in Spark is used to store  checkpointed RDDs or stre...

Java 21: 1 Hour Crash Course

Let’s embark on a  journey to discover the most important parts of Java 21 . I’ll cover the essentials, highlight new features in Java 21, and provide code samples and explanations. At the end of this article you’ll get a solid foundation and pointers for deeper study. Let's get started! Java 21: 1 Hour Crash Course 1. Introduction Java  is a powerful, object-oriented programming language. Java 21, released in September 2023, brings performance improvements and new features. Prerequisites: Basic programming concepts (variables, loops, functions). Java installed (JDK 21). 2. Your First Program public class HelloWorld { public static void main ( String [ ] args ) { System . out . println ( "Hello, Java 21!" ) ; } } public class HelloWorld  — Defines a class. public static void main  — Entry point. System.out.println  — Prints to console. 3. Variables and Data Types int age = 25 ; double price = 19.99 ; boolean isJavaFun = true ...