The Talent500 Blog
Backend Developer Interview Questions And Answers Series - Part 2 1

Backend Developer Interview Questions And Answers Series – Part 2

Backend Developer Interview Questions And Answers Series – Part 2

 

Interviewing for a tech job can be intimidating (with remote coding challenges and extensive onsite interviews sometimes). Cracking the technical round can be a lot easier when you understand what to expect during the interview rounds and have invested time smartly into tech interview prep. That’s why we’ve created an epic, encyclopedic series for technical interviews and coding interview preparation for tech newbies!

The previous article discusses the generic questions you might encounter in a technical interview. This part will focus on the two primary backend object-oriented programming languages- Java and Python. 

 

Java

1. What is a constructor?

A constructor function creates an object and initializes its fields. A constructor can be called only once per class. In Java backend development, constructors can be used to initialize an object’s state and values, which can be useful if you need to perform some kind of initialization on the object when it is first created.

2. What are the different types of constructors?

There are three fundamental types of constructors: 

  • No Argument Constructor
  • Default Constructor
  • Parameterized Constructor

3. Why are multiple inheritances not possible in Java?

Java doesn’t support multiple inheritances because it can create ambiguity. Java also does not support multiple inheritances for simplicity and to reduce complexity in the language itself.

A class, such as B, can extend more than one parent class—such as A and C. This is called multiple inheritances. The diamond problem occurs when a subclass inherits from more than one parent class (A & B)

4. How does a HashMap work?

The HashMap class in the Java programming language uses multiple hashing techniques to store entries. First, its static inner class creates buckets using a number of different methods; then, each bucket points to a Singly Linked List that contains the actual entry objects.
In Java 8, HashMap uses a binary tree to store its data—instead of LinkedList—when the number of elements in each bucket reaches a certain threshold. HashMap allows multiple null values and, at most, one null key; however, only one entry per hash can be non-null

5. What are the different types of exceptions in Java?

Java has two main types of exceptions: checked and unchecked exceptions. When a checked exception occurs, the program can handle it by utilizing a try-catch block or rethrowing the exception. An unchecked exception does not have to be handled; its occurrence is expected during the normal operation of some code (for example, IOException).

6. What is a design pattern?

Design patterns are general reusable solutions to common concerns in software design. These patterns describe the interactions and relationships between objects or classes, and they often show different ways of solving those problems by implementing similar features in varying contexts.

7. What is a lambda expression?

Lambda expressions were introduced into Java as a way to support functional programming. A lambda expression consists of multiple formal parameters, separated by commas and enclosed in parentheses.

8. What is the role of JVM?

The Java Virtual Machine (JVM) offers a runtime environment for executing Java programs. It translates the compiled code from a high-level language called “Java” into instructions that the computer can understand and execute.

9. Explain the compilation process of Java source code.

A Java source code undergoes many stages of analysis: lexical analyzer, syntax analyzer, semantic analyzer and bytecode generator.

10. What is the structure of JVM?

The JVM is made up of three primary subsystems:

  • The Class Loader
  • Runtime Data areas
  • Execution Engine

11. Briefly talk about communication methods between threads in Java.

1) Shared memory: volatile keyword, synchronized keyword

2) Wait and notify mechanism: The wait() and notify() methods enable Java programs to interact with other threads. When one thread calls wait(), its execution stops until another thread calls notify().

3) Lock/Condition mechanism: The Lock class in Java limits access to an object. The Condition interface defines methods that are invoked by a lock and which place threads in sleep or wake them up—we use these when we want thread 1 (the server) to wait while another thread (a client) performs some work before continuing on.

12. What are volatile and synchronized keywords?

  • A volatile keyword applies to a field or variable such that even with multiple threads accessing the same variable, data consistency is ensured by forcing main memory instead of cache memory.
  • A synchronized keyword is typically used for a block of code, which enables only one thread to access the resources at any given point in time. When one thread manipulates these resources, others are not allowed to execute until they regain control (this happens when “synchronized” goes out of scope or when another object calls wait() on it).

13. What is the reflection in Java?

Java is a statically-typed language. Reflection in Java enables the program to examine itself at runtime, making it more dynamic. It enables developers to examine or modify the behavior of methods, classes or interfaces during execution time.

 

Python

 

1. What is PEP 8, and why is it important?

PEP stands for Python Enhancement Proposal. A PEP is a formal document describing new features or processes of the language to members of its community.

PEP 8 documents the style guidelines for Python code, and violating them can handicap your credibility as a contributor to the open-source community.

2. What is Scope in Python?

In Python, every object is part of some scope. A scope defines a block of code where an object can be used without qualifying it with the module name or other variables defined in that block. However, namespaces also have their own scopes—where you would use them without prefixes.
Examples of scopes created within the process of running Python code are as follows:

  • Local scope refers to the local variables and functions that are visible within a given function.
  • Global scope applies to all objects that have been created during the execution of a program.
  • A module-level scope refers to the global objects of a particular module.
  • In Python, the outermost scope refers to all names that can be called in the program. These objects are searched last when a name is referenced.

3. What are lists and tuples? What is the primary difference between the two?

Lists are immutable objects that can be added to and accessed in a very explicit manner. Tuples, on the other hand, are mutable objects that can be modified by their contents and accessed as they are. Lists and tuples have similar semantics, but they’re implemented differently. So let’s take a look at how they differ!

4. What is Pass in Python?

The pass keyword is used in Python to signify a null operation. It fills up empty blocks of code that might execute during runtime but has yet to be written.

5. What are modules and packages in Python?

In Python, a module represents a file with the .py extension that contains functions and classes. Modules can be imported into other files by using the import statement to load their contents into memory. Through the use of packages, you can organize your modules into hierarchies using dot notation.

As modules help avoid collisions among global variable names, packages also provide a way to prevent name clashes among modules. The system can use a folder’s inherent file structure to create packages, so all you have to do is stuff modules into the folder and rename it. To import a module or its contents from this package, prefix the name of that module with your package’s name and join them by dots.

6. Explain global, protected and private attributes in Python.

Global variables are public and can be used anywhere in our code. We use the “global” keyword to let Python know that we want a variable to be accessible from other scopes as well.

Protected attributes are defined with an underscore prefixed to their identifier, for example, _sara. However, they can still be accessed and altered from outside the defined class —but it is irresponsible of a developer to do so.
Private attributes, identified by a leading double underscore (e.g. __ansh), may not be accessed or modified directly from outside of the class that defines them and will raise an AttributeError if such attempts are made.

7. What is the importance of Self in Python?

In Python, a self-variable is used to point to your current function. This is a very important concept in programming. It allows you to access any variables that were defined in the current scope.

How to ace your backend engineer interview?

When preparing for a backend technical interview, remember that the most vital elements interviewers look for are your specific work style, creativity, work philosophy, and whether you have a preference to work within a team or independently.

Here is how you can ace your backend developer interview and set yourself apart from other candidates:

  • Have a precise and comprehensive knowledge of the basics of backend development and go through the critical concepts before the interview.
  • Pair your interview questions with good examples, presenting the concepts with a use case.
  • Consider the implementations which you have done in the project.
  • Keep the answer simple. While answering, your delivery and communication skills also carry weight. Remember making the answer exciting and interesting will help engage your interviewer.
  • Here is another useful tip. You can subtly and smartly lead the interviewer to the next interview question based on your response.

 

One of the most suitable ways to prepare for an interview is by reviewing previous questions and practicing answering them. This will help you identify patterns in what kinds of questions are asked – even ace those tricky ones!

0
Debaleena Ghosh

Debaleena Ghosh

Debaleena is a freelance technical writer, and her specialty is absorbing several pieces of data and tech info to articulate them into a simple story. She helps small and large tech enterprises communicate their message clearly across multiple products.

Add comment