Performing well anywhere is all about practice, and technical interviews are no exceptions to that. The more you practice, the more confident you will be to face interviews and, most importantly, perform well and grab your dream job interviews. That being said, technical job interviews follow a pattern . Once you understand that, you will know what kind of technical interview questions to expect & how to attempt them in a manner that your interviewer expects. It’s a mind game you have to master with skills and knowing how to articulate your knowledge and experiences into a conversation or work snippet that gives the person on the other side of the table all the information they are looking for. You must remember that it’s a tough process for both parties but going for Java training is a lift-up for the candidates. The hiring teams go through plenty of resumes and pick only a handful that suits the job requirements. They spend considerable amounts of time deciding what and how to judge the candidate in an hour’s span. It is only then; they can extract suitable insights into whether the candidate will be able to handle the job’s responsibilities. After multiple iterations, they come to a decision. Let us walk you through some common, the most expected set of technical interview questions that will give you some vivid flavors into real interviews based on real-life experiences. Staying prepared, and doing homework, has only done good. Let’s get started with well-known technical interview questions for software engineers, as seen over the years.
I prefer programming using Python. There are multi-factor reasons for my choice. I gathered some know-how about Natural Language Processing during my early days as a student and started learning Python for my NLP-based pet projects and recommendation engines. Additionally, I understand what a powerful analytics tool Python libraries are, and it has helped me skim through some public datasets and build beautiful dashboards. In my previous projects, I have used Python and its powerful libraries to build automation that has done a lot of tedious jobs into one-click executions. Moreover, I loved how easy it is to learn the language, and such a big open-source community supports it.
The Agile methodology comes with many benefits. In a nutshell, it’s an iterative approach to modern project management and software development. Instead of focusing on the product’s launch, the teams deliver tangible product value in each iteration. It ensures benefits like:
An Agile environment is also deeply based on feedback and collaboration, and this also applies to developer-developer communication. This setting enables the team to find and fix bugs quickly and optimize the code throughout the development process, improving the product’s quality in real-time.
Almost daily, at least, I try to. I have an hour on my calendar I spend technical reading blogs and gathering what is ongoing and upcoming. On weekends, I participate in weekly programming challenges.
This is a frequently asked question in Technical interview questions.
Some cost-cutting initiatives were taken around our vertical, and I actively looked into the low-hanging fruits and major contributors to our costs. I presented a final report where we could optimize our annual managed cloud services’ costs (we were using AWS). Per my suggestions, we moved to the most effective infra elements. Additionally, I suggested moving to an open-source-houses solution for logging and dashboarding. There was an overall 30% reduction in AWS monthly bills.
Always expect programming to be a part of your technical interview questions deck, and they will exclusively judge how your problem-solving approach. Try something like this. Read out loud (not loud, though) what is stated and gather all the variables you have been provided. Explain what you understand and ask questions about it. Note the possible test and edge cases and verify with your interviewer. Always write up some pseudo code, get your approach checked and then code it up bug-free. You will always get extra points for using good indentations, meaningful variable names and writing modular and bug-free code.
Working with humans is more difficult than working with machines. As colleagues, it is often difficult to understand someone very personally; hence, we might not be on the best of terms. In situations like this, I choose to look at what positive things the person brings to the table and revolve our interactions around them. Once, this new guy on our team was a college dropout and a self-taught software developer. He had spent most of his time at home and hardly got to explore a place outside his hometown. While he was very good at what he did, he would not talk past that and often was agitated, which made it difficult for me to work with him. I started talking to him about his interests and how he taught himself and gathered all these skills. Once he became comfortable around me, we started working more in sync.
Expect to come across this popular question in Technical interview questions.
Some of the common technical interview questions will always touch on your time management skills.
This is one of those classic COVID-19 times that I was put in this situation. Working from home just made things tougher for me. I started following the 80-20 rule for prioritizing work. Paired it with Eisenhower's metric, and unlike the first week, my next weeks and months became relatively breezy. One important takeaway I had during this phase was learning to trust others and make them responsible too. You grow more together. I started offloading less important work to a couple of interns working under me. They were presented with important learning opportunities, while I could focus on items that needed more/exclusively my attention. A favorable byproduct was my mentoring taking a leap.
One of my top weaknesses is I expect the quality of work from myself more than others. It disappoints me when I do not produce something close to what I had imagined. As difficult as it is to admit I messed up, I do that before the final call & seek help from others if I am unable to mend things myself.
I love feedback. I love working on them. In one of my previous organizations, there was no review system, so I would set up some time once a month with my reporting manager and take notes to work on. Some of my best work has been motivated by peer feedback.
A must-know for anyone heading into a Technical interview, this question is frequently asked in Technical interview questions for freshers.
I would not say I am great under pressure. It does scare me, but I do not let it overpower me. I plan out what has to be done in the given scenario and go ahead with it.
It's no surprise that this one pops up often in Technical round questions.
My one rule in these situations is to ‘Divide and Conquer.’ We were two people assigned to support a team of 23 engineers onboard a product we had developed. The journey involved demoing, educating, bug-fixing, and feature additions as and when more people started onboarding. We divided the product’s modules between ourselves and created internal forums where some who were learning it now could help those doing it later. The most important tool that came in handy was user-owned documentation. We made them responsible for putting together what they learned and enhancing it as and when we matured.
Personally, I’ve been fortunate enough never to be put in this position. Hypothetically, I would keep them not directly involved as much as possible. If that option is out of the window, I’m going to sit down with them individually and together and outline how the project takes priority over their personal differences, and we can keep personal biases for someplace outside work & maintain workplace decorum.
I can only understand so much of your products and services from my consumer's point of view. From what I have gathered, I believe my skill sets can help you launch X, Y and Z projects, and I would want to see them to completion. (This is something you must do your homework on. Understand the product, its competition and based on the job role you’re interviewing for, find what it is that you can do).
A common question in Technical interview questions, don't miss this one.
I have trained and guided a team of five interns and guided them through their six six-month stays with us. Four of them made it as full-time employees into teams across the organization. I would definitely want to take up more than that in projects of a larger scale.
One of the most frequently posed Tech interview questions, be ready for it.
I think I do. There have been instances I have faced these situations. Often teams have product and program managers from non-technical backgrounds. It is tough to explain why a feature that sounds pretty simple in theory would be difficult to implement, adapt and roll out. I turn to slides at these hours and draw up flow diagrams to visualize the challenges. Up until now, this has worked quite well for me.
You are working on a team developing a new software application. The team has difficulty meeting the deadline because of a bottleneck in the development process. How do you approach this problem, and what steps do you take to solve it?
I feel the best way to deal with bottlenecks is to find alternatives. Especially if it's a POC stage, I suggest my team find a way around it rather than spending immense amounts of time and energy over something that is blocking the entire team. Come back to it later, or move on forever. Also, today’s date there’s hardly any monopoly in technology. [Often asked technical questions for software engineer]
Find someone who knows the piece better. When it’s something new to our team, I religiously turn to Stackoverflow and the open-source community of that product. We can always go to their support teams if it's a paid product. Never feel shy asking for help. It will only allow me to learn and grow. Having a fresh pair of eyes and experienced eyes always gives a valuable perspective that can fast-track the problem-solving process.
Rules, and in this case, we should swap work and complete it and reconvene on it later.
You are asked to work on a project that you have little experience with. How do you approach learning about this new technology and completing the project successfully?
Learning from experience is always easier than reinventing the wheel ourselves. I will understand the project from the contributors and people already on the project, and based on those notes, I’ll go about reading pieces I am new to and try something small to understand the nitty gritty. [Very common for technical questions for freshers]
You are asked to work on a project that requires you to use a technology that you are unfamiliar with. How do you approach learning about this new technology and completing the project successfully?
Ideally, I’d like to take a week’s time to grasp the technology and, as soon as possible, get my hands dirty with the actual project. I will face tons of problems, but that is where real learning will happen. Reading documents and online guides will only make me familiar with the terminologies and architecture of the tech.
You are asked to review the code of a colleague who is more senior than you. How do you approach this task and provide constructive feedback?
It should be no different from any other code review. Being assigned as a reviewer implies that I have more or equal fluency with the code piece, and I will respectfully go about my review per the protocol and expect the colleague to enable me to. This is also an opportunity for me to showcase my skills and work quality, which means in the future, he/she will pick me for important projects and know me as someone who is a powerful addition to the team. [Often asked technical questions for software engineer]
You are working on a project and realize that the original design will not work for the current requirements. How do you approach this situation, and what steps do you take to redesign the system?
A staple in Technical interview questions for freshers, be prepared to answer this one.
First, my opinions on the design not fitting well should be presented by the team and design experts. More opinions are good in these cases to remove bias. Based on the delivery timelines, we have to develop a plan of action that can be adopted, if not immediately, from the next iterations while we continue developing the Minimal Viable Product(MVP).
You are working on a project and realize that the deadline will not be met. How do you approach this situation, and what steps do you take to meet the deadline?
We should always keep periodic checks to track progress. During one of these meets, if the team realizes that deadlines will not be met, we should go either of the two ways. Trimming down the delivery by removing some non-essential or good-to-have items and focusing on more important items. Two, work with the delivery lead and see if the deadlines can be extended to a more achievable date. We could get more hands on the project, but it is seldom possible to free up people from other projects and commitments.
You are working on a project, and you realize that the project is going over budget. How do you approach this situation, and what steps do you take to try to bring the project back on a budget?
Activate Sherlock mode. Go down recent history and check what was misestimated and what shot past the budget. The straight answer is to attack the cause, but that is often not feasible. In that case, we should find a balance and trim things all over without compromising the quality of delivery.
You are working on a project and realize that the scope has changed significantly since it was originally defined. How do you approach this situation, and what steps do you take to redefine the project scope?
This question is a regular feature in Technical interview questions, be ready to tackle it.
We should all take a small break and re-orient ourselves. List down all the items that are deviating us from our initial north star and decide what is essential. The idea is to get closer to the decided scope. We will have to come up with a compromise.
Describe a situation where you had to deal with a technical failure that impacted hundreds of customers.
This is a frequently asked question in Technical interview questions for software engineers.
One of our Linux machines underwent a security breach, which compromised our entire stack. It was one of those situations where we had to get all hands-on deck. Our team worked for approximately 24 hours at a stretch to bring up the entire stack from scratch. Although there was not much we could do at that point, our product faced a major outage in its history. We took away important learnings, and once the stack was stable, we developed a Python-based automation service that would bring up a stack in a matter of minutes.
I have loved programming and gaming since I was in school. I just followed my passion. It was a no-brainer for me. [asked in technical interview questions for freshers]
What technical skills or knowledge do you feel are most important for a successful career in technology?
That’s quite difficult to answer because something comes every five years, rather than every other year, and something else becomes a legacy. In an environment like this., knowing your fundamentals well is what will always help you sail through whatever technology is the talk of the town then.
What technical courses or certifications have you completed, and how have they benefited you in your career?
State your certifications and some that you plan to cover. Certifications should be relevant to your job role or some interest you’d like to highlight. Also, having projects to show for and talk about always makes a better impression. Shows you take the extra step.
This is a basic technical interview question, and you should express how tech is a part of your interests like this: I read. Every day from what I gather, I try to learn and implement some. I like blogging, and based on what I’ve learned every week, I pen them down. You can give an example of something in trend and what’s your take on it.
Describe a technical project that you worked on as part of your education. What did you learn from the experience?
A must-know for anyone heading into a Technical interview, this question is frequently asked in Technical interview questions for freshers.
Walk through your best college project. Companies have many great people who can code up something and build the sassiest products in town. What they are always short of are people who can explain their work well enough to anyone, not themselves. Portrait how you will bring something unique and valuable to the team. I was responsible for preparing the design documents, and I took charge of writing meaningful comments and function descriptions which makes me someone who understands the codebase better than the individual people who put it together.
Education taught me so much more than the course curriculum. I understood values around discipline and time management. I was exposed to a cohort of like-minded technology-savvy people in my batchmates and professors who pushed me towards learning more and establishing myself as an industry fit.
You can choose to take it either way. List some advance level certificates relevant to the role that you’d like to pursue. Tread carefully if you want to mention that you’d want to pursue higher studies because, in some cases, they will see you as someone who gradually leaves, making you not a candidate worth investing further in. Although you can mention something like: I plan to pursue an executive business program meant for working professionals so I can advance to the product management vertical and grow there.
It's no surprise that this one pops up often in Technical interview questions.
Without exception, pick something relevant to the company’s needs. State a rough timeline you have in mind and what you plan to do after learning it.
How do you think your technical education and experience have contributed to your success in your current role?
You can choose to answer this in a different way. Not all answers should be: yes, I have done this before and know it really well. You could mention that since your professional journey, you came across something irrelevant to your degree and took a keen interest in it. Now you really enjoy working in this niche. You will come as someone who is honest, shows interest and is not just some random talker with multiple items listed in the hobbies section.
Speak from experience. Pick a challenge you faced, talk about it and give the mitigation as a solution. I was not sure if I should go with front-end or backend development for my final year project and ended up learning very little of both. It does not matter what you pick. The best way is to work iteratively. Pick one realm, become confident with it and keep adding to it.
A common question in Technical interview questions, don't miss this one.
One of the most frequently posed Technical interview questions, be ready for it.
A synchronous process is one that runs in real-time, meaning that it is executed in a step-by-step fashion, and each step must be completed before the next one can begin. This means that a synchronous process is blocking, meaning that it will stop all other processes from running until it has completed its execution.
An asynchronous process, on the other hand, is one that does not run in real-time. It can be started and run independently of other processes, and it does not need to wait for other processes to complete before it begins. This means that an asynchronous process is non-blocking, meaning that it will not prevent other processes from running while it is executing.
An example of an asynchronous process is an email client. When you send an email, the email client does not need to wait for the email to be delivered before allowing you to continue working on other tasks. The email will be sent in the background, asynchronously, while you continue to use the email client for other tasks.
To handle exceptions in Python, you can use a try-except block. The try block contains the code that may throw an exception, and the except block contains the code that will handle the exception if it occurs.
# code that may throw an exception result = some_function() except SomeException: # code to handle SomeException result = None except AnotherException: # code to handle AnotherException result = None
A staple in Technical round interview questions, be prepared to answer this one.
TCP/IP (Transmission Control Protocol/Internet Protocol) is the standard communication protocol used for transmitting data over the internet. It defines how devices on a network can communicate with each other, and it is responsible for routing data between devices.
TCP is responsible for breaking up data into small packets and sending them to their destination. It ensures that the packets are delivered reliably by retransmitting any packets that are lost or damaged during transmission.
IP is responsible for routing packets from their source to their destination. It does this by using the IP address of each device on the network. Each device on the network has a unique IP address, and the IP layer uses this address to route the packet to its destination.
Together, TCP and IP form a reliable and efficient way for devices to communicate with each other over the internet. When you send a message over the internet, it is broken up into small packets by TCP and then routed to its destination by IP. The recipient device then reassembles the packets and reads the message.
This question is a regular feature in IT Technical interview questions, be ready to tackle it.
One of the main differences between static and dynamic IP addresses is that static addresses remain the same, while dynamic addresses can change over time. This means that if you have a device with a static IP address, you can always connect to it using the same address. With a dynamic IP address, however, you might need to use a different address each time you connect to the device, depending on which address has been assigned to it.
This is a frequently asked question in basic Technical interview questions.
This is one of the very popular IT technical interview questions.
Expect to come across this popular question in Tech interview questions.
Here is an example of how a RESTful API might work:
Describe the process you would follow to deploy a new version of a software application to production.
A must-know for anyone heading into a technical interview, this question is frequently asked in Technical interview questions.
A stack is a data structure that allows you to store and retrieve items in a Last In, First Out (LIFO) order. You can implement a stack using an array by creating an array that stores the stack items and using two variables to track the top of the stack.
Here is an example of how you might implement a stack using an array in Python:
# Initialize an empty array to store the stack items stack =  # Initialize a variable to track the top of the stack top = -1 # Define a function to push an item onto the stack def push(item): global top top += 1 stack.append(item) # Define a function to pop an item off the stack def pop(): global top if top < 0: return None item = stack[top] top -= 1 return item
A hash table is a data structure that stores key-value pairs and allows you to quickly retrieve values based on their associated keys. To implement a hash table, you will need to define a hash function that takes a key as input and returns an integer, which is used to index into an array of buckets where the key-value pair will be stored.
Here is an example of how you might implement a hash table in Python:
class HashTable: def __init__(self, size): # Initialize an array of size "size" to store the hash table self.table = [None] * size def hash_function(self, key): # Define a simple hash function that adds up the ASCII values of the characters in the key hash = 0 for c in key: hash += ord(c) return hash % len(self.table) def add(self, key, value): # Calculate the hash of the key and use it to find the index in the table index = self.hash_function(key) # If the bucket at the index is empty, create a new linked list to store the key-value pair if self.table[index] is None: self.table[index] = LinkedList() # Add the key-value pair to the linked list at the index self.table[index].add((key, value)) def get(self, key): # Calculate the hash of the key and use it to find the index in the table index = self.hash_function(key) # If the bucket at the index is empty, return None if self.table[index] is None: return None # Otherwise, search the linked list at the index for the key-value pair return self.table[index].find(key)
It's no surprise that this one pops up often in Technical interview questions.
Depth-first search (DFS) and breadth-first search (BFS) are two algorithms for traversing a graph or tree data structure.
In a depth-first search, the algorithm starts at the root node and explores as far as possible along each branch before backtracking. This means that the algorithm will visit all the nodes in one branch of the tree before moving on to the next branch.
In a breadth-first search, the algorithm starts at the root node and explores all the nodes at the current level before moving on to the next level. This means that the algorithm will visit all the nodes at the shallowest level of the tree before moving on to the deeper levels.
One of the main differences between DFS and BFS is the order in which they visit the nodes in the tree. DFS visits nodes in a depth-first order, while BFS visits nodes in a breadth-first order. This can affect the performance of the algorithm and the way that it processes the data.
Another difference between DFS and BFS is the way that they handle traversing the tree. DFS uses a stack to keep track of the nodes that it needs to visit, while BFS uses a queue. This can affect the space complexity of the algorithm, as DFS uses a fixed amount of space regardless of the size of the tree, while BFS uses space proportional to the size of the tree.
Overall, DFS and BFS are useful algorithms for traversing a tree or graph, and the choice of which one to use will depend on the specific needs of your application.
Dynamic programming is a method of solving problems by breaking them down into smaller subproblems and storing the results of these subproblems to avoid recalculating them. This can be an efficient way to solve problems that have overlapping subproblems, as it allows you to reuse the solutions to these subproblems rather than recomputing them.
To use dynamic programming, you typically define a function that takes the input to the problem as an argument and returns the solution. You can then break the problem down into smaller subproblems and use the function to solve these subproblems recursively. As you solve the subproblems, you store the results in a table or array, which you can use to avoid recalculating the subproblems.
Here is an example of how you might use dynamic programming to solve the Fibonacci sequence problem in Python:
# Initialize an array to store the Fibonacci numbers fib =  * (n + 1) # Base case: fib(0) = 0, fib(1) = 1 fib = 0 fib = 1 # Iterate over the range 2 to n for i in range(2, n + 1): # Calculate the next Fibonacci number using the previous two fib[i] = fib[i - 1] + fib[i - 2] # Return the nth Fibonacci number return fib[n]
In this example, the function uses an array to store the Fibonacci numbers and calculates them using a bottom-up approach, starting from the base cases and building up to the desired result. This allows the function to avoid recalculating the same subproblems and improve the efficiency of the solution.
Dynamic programming is a useful technique for solving problems that have overlapping subproblems and can be used to solve a wide range of problems in computer science.
A common question in Technical round questions, don't miss this one.
A stack is a data structure that allows you to store and retrieve items in a Last In, First Out (LIFO) order. A linked list is a data structure that consists of a sequence of nodes, where each node contains a value and a reference to the next node in the list.
One of the main differences between a stack and a linked list is the way that they store and access data. A stack uses an array to store data and allows you to access the top element of the stack directly, while a linked list stores data in nodes and requires you to follow the references between nodes to access the data.
Another difference between a stack and a linked list is the way that they grow and shrink. A stack has a fixed size, so you can only push items onto the stack if there is space available. A linked list, on the other hand, can grow and shrink dynamically as you add and remove items.
Overall, both stacks and linked lists are useful data structures with their own strengths and limitations. You can use a stack when you need a simple data structure for storing and accessing items in a LIFO order, and you can use a linked list when you need a more flexible data structure that allows you to easily add and remove items.
One of the most frequently posed basic Technical interview questions, be ready for it.
In a database, a primary key is a field that is used to uniquely identify each row in a table. A foreign key is a field that is used to establish a link between two tables.
A primary key is a column or set of columns that is used to uniquely identify each row in a table. It must contain unique values, and it cannot contain null values. A primary key is often used as an index to help optimize the performance of queries on the table.
A foreign key, on the other hand, is a field in one table that is used to reference the primary key of another table. It is used to establish a link or relationship between the two tables. For example, you might use a foreign key to link a customer table to an orders table so that you can track which customers have placed which orders.
One of the main differences between a primary key and a foreign key is that a primary key is used to identify rows within a single table, while a foreign key is used to establish relationships between tables. Another difference is that a primary key must contain unique values, while a foreign key may contain duplicate values.
NoSQL is a type of database that does not use the traditional SQL relational model for storing and retrieving data. NoSQL databases are designed to handle large amounts of data that may be structured, semi-structured, or unstructured and to scale horizontally across multiple servers.
There are several types of NoSQL databases, including key-value stores, document databases, column-oriented databases, and graph databases. Each type of NoSQL database is designed to handle a specific set of data and use cases, and they differ in the way that they store and retrieve data.
One of the main differences between NoSQL databases and traditional relational databases is the way that they store and structure data. Relational databases use tables to store data, with rows representing individual records and columns representing the data fields. On the other hand, NoSQL databases may use various data models, such as key-value pairs, documents, columns, or graphs, to store data.
Another difference between NoSQL and relational databases is how they scale. Relational databases are typically designed to scale vertically by adding more resources to a single server. In contrast, NoSQL databases are designed to scale horizontally by adding more servers to the database cluster.
Overall, NoSQL databases are useful for handling large amounts of data that may not fit well into the traditional relational model, and they offer a number of benefits, such as horizontal scaling, flexibility, and high availability. However, they may not offer the same level of consistency and transactional support as relational databases.
A staple in Technical interview questions, be prepared to answer this one.
Normalization is the process of organizing a database in a way that reduces redundancy and dependency and helps to improve the integrity and performance of the database. Normalization is typically applied to relational databases, which are organized into tables of rows and columns.
The first normal form (1NF) is the most basic normal form, and it requires that each column in a table contains a single value and that the values in each column be of the same data type. The second normal form (2NF) builds on the first normal form and requires that each non-key column be fully dependent on the primary key. The third normal form (3NF) further reduces redundancy by requiring that non-key columns be independent of one another.
Firewalls work by examining the data packets that are transmitted over a network and comparing them to a set of rules or criteria. If the data packets meet the criteria, the firewall allows them to pass through. If the data packets do not meet the criteria, the firewall blocks them or sends an alert.
The rules or criteria that are used by a firewall can be based on various factors, such as the source and destination of the data packets, the port number, the protocol, or the type of data. For example, a firewall might allow incoming data packets from a trusted source but block data packets from an untrusted source.
This question is a regular feature in Technical interview questions, be ready to tackle it.
def bubble_sort(items): # Set a flag to indicate whether any swaps were made swapped = True # Keep looping until no swaps are made while swapped: # Set the flag to False swapped = False # Iterate over the range of the list up to the second-to-last element for i in range(len(items) - 1): # If the current element is greater than the next element, swap them if items[i] > items[i + 1]: items[i], items[i + 1] = items[i + 1], items[i] # Set the flag to True swapped = True # Return the sorted list return items
This is a frequently asked question in Technical round questions.
Linear search is a simple search algorithm that checks each item in the list in sequence until it finds the target item or determines that the item is not present. Linear search has a time complexity of O(n), meaning that the time it takes to perform the search increases linearly with the list size.
Binary search, on the other hand, is a more efficient search algorithm that divides the list in half at each step and compares the target item to the middle item. If the target item is greater than the middle item, it searches the right half of the list, and if it is less than the middle item, it searches the left half of the list. This process continues until the target item is found or it is determined that the item is not present. Binary search has a time complexity of O(log n), which means that the time it takes to perform the search increases logarithmically with the size of the list.
A binary tree is a data structure that consists of nodes arranged in a tree-like structure, with a maximum of two children for each node. Each node in a binary tree has a value and two children, which are referred to as the left child and the right child.
The diameter of a binary tree is the longest path between any two nodes in the tree. It is not necessarily the same as the height of the tree, which is the maximum distance from the root to a leaf node.
def diameter(node): # Base case: if the node is None, return 0 if node is None: return 0 # Calculate the height of the left and right subtrees left_height = height(node.left) right_height = height(node.right) # Calculate the diameter of the left and right subtrees left_diameter = diameter(node.left) right_diameter = diameter(node.right) # Return the maximum of the following three values: # - The height of the left subtree # - The height of the right subtree # - The sum of the heights of the left and right subtrees, plus 1 return max(left_height + right_height + 1, left_diameter, right_diameter)
Expect to come across this popular question in tech interview questions.
There are several algorithms that you can use to find the shortest distance between two nodes in a graph. Here are two common approaches:
def minimum_swaps(arr): # Initialize a counter to zero counter = 0 # Iterate over the array for i, val in enumerate(arr): # Find the correct position for the element correct_pos = arr[i:].index(min(arr[i:])) + i # If the element is not already in the correct position, increment the counter and swap the element if i != correct_pos: counter += 1 arr[i], arr[correct_pos] = arr[correct_pos], arr[i] # Return the counter return counter
A must-know for anyone heading into a React interview, this question is frequently asked in technical interview questions for software engineer.
Multitasking is the ability of an operating system to run multiple tasks or processes concurrently. This allows the computer to perform multiple tasks at the same time, such as running a web browser and a word processor at the same time.
Multithreading is a technique that allows a single task or process to be divided into multiple threads of execution, which can be run concurrently on a multicore processor. This allows the task to be broken down into smaller pieces that can be run in parallel, which can improve the performance of the task.
One of the main differences between multitasking and multithreading is that multitasking involves running multiple tasks or processes concurrently. In contrast, multithreading involves dividing a single task or process into multiple threads that can be run concurrently.
Another difference is that multitasking is typically handled by the operating system, while the programmer typically implements multithreading.
It's no surprise that this one pops up often in Technical round interview questions.
CPU process scheduling is managing the execution of processes on a computer's central processing unit (CPU). The CPU is a critical resource, as it is responsible for executing the instructions of a process and performing the calculations and operations needed to run a program. To ensure that processes are executed efficiently and fairly, the operating system uses a process scheduler to manage the execution of processes on the CPU. The process scheduler is responsible for determining which process should be executed next and allocating the CPU to that process.
There are many different CPU process scheduling algorithms, each with its own rules and criteria for determining which process should be executed next. Some common types of scheduling algorithms include:
A common question in IT Technical interview questions, don't miss this one.
Unlike the count method, length is the string class in ruby used to return the length of the characters of the mentioned string.
puts "hello".length puts "length example".length
The module is used to group resources and avoid namespace collisions. It can store Ruby resources like classes, functions, data, and others.
It simply resolves naming issues. For example, a Bank module can contain a Model class for Bank. An Employee package can contain a Model class for employees etc.
Ruby supports two types of modules:
Built-in Modules- to use one class in another package, and we can include modules using the include statement.
include Timemachine tm = TimeMachine.new() tm.goBack100Years() tm.goForward100Years()
User-defined Modules- for creating modules we can use the module statement to create modules.
Technical interview questions can be intimidating, but with the right preparation, you can feel confident and will be ready to showcase your skills. The core of your technical interview prep should be through practice. The tech interview questions will help you gain a wholesome insight into the processes. Additionally, you need to delve deep into the job description and prepare the skills in depth for specific interviews. Programming certification courses will be the best study partner for you.