Now that you have made a quality JD, it can still be tricky to evaluate the skills of your applicants when you hire Backend developers. To help you with that, we have created a pool of questions that a good Backend developer should be comfortable with.
It is important to note that the ability to answer these questions doesn't imply that you have a top quality candidate. But it definitely is a big step in that direction. You can check out some related interview questions on these pages: MySQL, Rest API
It is important to note that the ability to answer these questions doesn't imply that you have a top quality candidate. But it definitely is a big step in that direction.
To help you navigate through these questions, we’ve categorized the interview questions in 3 parts:
A. Basic concepts: Includes all basic concepts used across languages. This section will give you an understanding of how strong their programming foundation is.
B. Advanced concepts: Includes all concepts that someone with higher expertise should know.
C. DS/Algorithm questions: To test the logical capability of the candidate.
A. Basic concepts
A session is used to establish and maintain the connection between the application and the database. Sessions are designed to be lightweight and only instantiated whenever data is required from the database.
Session objects are not thread-safe and hence it is not a good practice to have them always opened. Additionally, Session can be used to retrieve, store or delete data from the database.
What is YAML in Spring Boot? Why is it used?
Spring boot YAML can also be used to define properties and is an alternative to the application.properties file. Whenever the SnakeYAML library is in your classpath, the SpringApplication class automatically supports YAML as an alternative to properties.
B. Advanced concepts
What are the different types of classes in C#?
Classes are used widely while working with C#. It comes with 4 different types of classes.
- Static Class: Static classes contain static members, methods, and constructors. Static classes do not allow new objects to be created. Static classes are sealed, hence you cannot inherit a static class from another class.
- Partial Class: A partial class allows users to split the functionality of a class across the same file or even multiple files. During compilation, all instances are combined and treated as one. Partial classes are defined using the partial keyword. Splitting a class allows multiple developers to work with the same class simultaneously. However, keep in mind that if any instance of the class is declared sealed, abstract, or base, the whole class is declared with the same type.
- Abstract Class: Abstract classes are restricted classes that cannot be used to create objects. However, an abstract class must contain at least one abstract method. These methods do not have a body and are declared inside the class only. The abstract keyword is used to define an abstract class. The purpose of an abstract class is to provide a blueprint for derived classes and set some rules on what the derived classes must implement when they inherit an abstract class.
- Sealed Class: Sealed classes restrict users from using inheritance, preventing the user from inheriting another class from it. Sealed classes are defined using the sealed keyword. Given the inheritance attribute has been taken away, sealed classes work best when used with a class inheriting static members.
What does the forEach() method in Java do? Explain with an example.
forEach() is a method that is used to iterate over objects in Java. However, unlike other loops, a loop counter is not declared or initialized but rather a variable is passed as an iterable.
Hence, forEach() is commonly used with arrays or collection classes.
Syntax
for (type var : array)
{
statements using var;
}
Example Using forEach():
class ExampleForEach
{
public static void main(String[] arg)
{
{
int[] scores = { 10, 13, 9, 11, 11};
int highest_score = maximum(scores);
System.out.println(highest_scores);
}
}
public static int maximum(int[] numbers)
{
int max = numbers[0];
// for each loop
for (int n : numbers)
{
if (n > max)
{
max = n;
}
}
return max;
}
}
C. Data Structure/ Algorithm
1. Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: Open brackets must be closed by the same type of brackets. Open brackets must be closed in the correct order. Note that an empty string is also considered valid.
class ValidParenthesesFunc {
func isValid(_ s: String) -> Bool {
var stc = [Character]()
for char in s {
if char == "(" || char == "[" || char == "{" {
stc.append(char)
} else if char == ")" {
guard stc.count != 0 && stc.removeLast() == "(" else {
return false
}
} else if char == "]" {
guard stc.count != 0 && stc.removeLast() == "[" else {
return false
}
} else if char == "}" {
guard stc.count != 0 && stc.removeLast() == "{" else {
return false
}
}
}
return stc.isEmpty
}
}
The above code will input 0(false).
2. Write a program to find whether a string or number is palindrome or not.
function palindrome(myString){
var removeChar = myString.replace(/[^A-Z0-9]/ig, "").toLowerCase();
var checkPalindrome = removeChar.split('').reverse().join('');
if(removeChar === checkPalindrome){
document.write("<div>"+ myString + " is a Palindrome<div>");
}else{
document.write("<div>" + myString + " is not a Palindrome <div>");
}
}
palindrome('"Oh who was it I saw, oh who?"')
palindrome('"Madam"')
palindrome('"Star Wars"')
palindrome('"7,10,7,8,9"')
The output of the above code will be:
"Oh who was it I saw, oh who?" is a Palindrome
"Madam" is a Palindrome
"Star Wars" is not a Palindrome.
"7,10,7,8,9" is not a Palindrome.
3. What will the output of the following code be?
var x = 10;
var y = 5;
var z = 3;
if (x / y / z)
document.write("hi");
else
document.write("hello");
a) hi
b) hello
c) error
d) no output
The answer is A, the floating-point division in JS returns a non zero value = 0.66 which evaluates to
true and outputs ‘hi’.