0% found this document useful (0 votes)
445 views49 pages

Backend Development Test 1

The document contains a practice test for backend development with 15 multiple choice questions. The questions cover topics like IP addressing, CIDR, variable length subnet masking, functional dependency in databases, data normalization, race conditions, copy constructors, operator overloading, and inheritance. Sample code is provided to demonstrate inheritance and calling functions from base and derived classes.

Uploaded by

tera baap
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
445 views49 pages

Backend Development Test 1

The document contains a practice test for backend development with 15 multiple choice questions. The questions cover topics like IP addressing, CIDR, variable length subnet masking, functional dependency in databases, data normalization, race conditions, copy constructors, operator overloading, and inheritance. Sample code is provided to demonstrate inheritance and calling functions from base and derived classes.

Uploaded by

tera baap
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 49

Backend

Development
Test 1
Backend Development
Practice Questions

Round 1
Question 1 Single choice

In Notation of classless addressing , that is a.b.c.d/n(IPv4) what does N represent among


the following?

A. Network ID

B. Host ID

C. Mask

Options
A A and B B Only C

C A and C D B and C

Question 2 Single choice

Which data structure property is primarily used in CIDR to allocate IP Addresses?

Options
A Array B Linked List

C Stack
D Queue

Backend Development
Practice Questions

Round 1
Question 3 Single choice

Which of the following is correct about Variable length subnet masking?

A. It can have fixed size of subnets

B. It can have any size of subnets

C. It can’t have any subnet

Options
A Only B B B and C

C A and B D Only A

Question 4 Single choice

Choose the option which best describes the need for functional dependency in a
database.

Options
A Integral to the design of B Database normalization and
databases in a relational model. denormalization.

C Both the options.


D Neither of the options.

Backend Development

Practice Questions

Round 1

Question 5 Single choice

Select the highest form of normalization from the following.

Options

A Third Normal Form (3NF) Sixth Normal Form (6NF)


B

C Boyce–Codd Normal Form Domain-Key Normal Form (DKNF)


D

(BCNF)

Question 6 Single choice

Select the type of data model which allows data specifications at places where the

individual data items of the same type may have different attributes sets.

Options

A Relational Data Model B Entity-Relationship Data Model

C Object-based Data D Semi-structured Data Model

Model

Backend Development
Practice Questions

Round 1

Question 7 Single choice

Which of the following describes a race condition?

Options

A Several processes access and B Several processes access and


manipulate separate data manipulate the same data
concurrently. concurrently.

C Single process accesses and D No process accesses and


manipulates the same data manipulates the same data
concurrently. concurrently

Question 8 Single choice

A condition Variable is a synchronization primitive that allows threads to wait until


particular condition occurs. It includes two operations. What are they?

Options

A signal and exit B hold and wait

C wait and signal


D signal and hold

Backend Development
Practice Questions

Round 1

Question 9 Single choice

What is the disadvantage of invoking the detection algorithm for every request?

Options

A overhead of the detection B considerable overhead in


algorithm due to consumption of computation time
memory

C excessive time consumed in D all of the mentioned


the request to be allocated
memory

Question 10 Single choice

In which of the following situations would you call a copy constructor:

Options

A Whenever an object of a class is B Whenever an object of a class is


returned by value passed by value to a function

C Whenever an object is D All the given situations


constructed based on another
object of same class

Backend Development
Practice Questions

Round 1

Question 11 Single choice

With regards to overloading a destructor, choose the right option.

Options

A Yes, it's possible using friend B No, it's not possible since a class
functions is allowed to have only 1
destructor

C Yes, it's possible even without D Yes, it's possible only when a
using friend functions class is declared as public

Question 12 Single choice

Which of the following statement is correct?

Options

A Both Interpreter and Compiler


B Interpreter translates program
translate one statement at a
one statement at a time;
time to machine code compiler scans the entire
program and translates it as a
whole into machine code.

C Compiler translates program one D None of the options


statement at a time, Interpreter
Scans the entire program and
translates it as a whole into
machine code.

Backend Development

Practice Questions

Round 1

Question 13 Single choice

What will be the output of the following pseudo code:

class A1{

public:

A1(){

print "Constructor \n"

~A1(){

print "Destructor \n"

};

int main(int argc, char const *argv[])

Options

A No output B Segmentation Fault

C "Construtor" is printed 5 times D "Construtor" is printed 1 time and

and "Destructor" 5 times "Destructor" 5 time


Backend Development
Practice Questions

Round 1
Question 14 Single choice

Consider the scenario where Student1 wants to implement the operator overloading for
handling manipulation of a complex number. He broadly knows the components
involved in the process of operator overloading but is having hard time ordering it.
Choose the right order of these statements.

A) Implementing the operator function which will process Real and Imaginary to
implement the required operations.

B) Creating a class “Complex” that defines the data members for Real and Imaginary
that is to be used in the overloading operation.

C) Declaring the operator function complexOpearation() in the public part of the class.

Options
A 1-A, 2-B, 3-C B 1-B, 2-C, 3-A

C 1-B, 2-A, 2-C D 1-C, 2-B, 3-A


Backend Development
Practice Questions

Round 1

Question 15 Single choice

What would be the output of the pseudo code?


class ShapeRectangle: public ShapePolygon, public outputA {


public:

class ShapePolygon
int Area ()

{
{

protected:
return (W * H)

int W, H
}


};

public:

void set_values (int num1, int num2)


class Shapetriangle: public ShapePolygon, public outputA {

{
public:

W = num1
int Area()

H = num2
{

}
return (W * H / 2)

};
};

class outputA
int main ()

{
{

public:
ShapeRectangle RectObject

void output (int k)


Shapetriangle TrgObject

};
RectObject.set_values (3, 4)


TrgObject.set_values (3, 4)

void outputA::output (int k)


RectObject.output (RectObject.Area())

{
TrgObject.output (TrgObject.Area())

print(k)
}

Options
A 12 6 B 34

C 6 12 D 12 12
Backend Development
Practice Questions

Round 1

Question 16 Single choice

What operation does the following pseudo code perform:

Declare an array of string type variable called word

Declare a loopcounter

Store a string in the array word

for loopcounter = (length of the word) – 1 to 0

loopcounter = loopcounter – 1

print arrayword[loopcounter]

endfor

Algorithm end

Options
A It accepts the string B It reverses the string

C It prints the string in same D None of the options


order
Backend Development
Practice Questions

Round 1

Question 17 Single choice

Consider the following function

void swap ( int x, int y )

int tmp

tmp = x

x= y

y = tmp

In order to exchange the values of two variables a and b:

Options
A Call swap (a, b) B Call swap (&a, &b)

C swap(a, b) cannot be used as D swap(a, b) cannot be used as it


the parameters passed by does not return any value
value
Backend Development
Practice Questions

Round 1

Question 18 Single choice

Let a be an array containing n integers in increasing order. The following algorithm


determines whether there are two distinct numbers in the array whose difference is a
specified number S > 0.

i = 0

j = 1

while (j < n )

if (E)

j++

else if (a[j] - a[i] == S)

break

else

i++

if (j < n)

print("yes")

else

print("no");

Choose the correct expression for E.

Options
A a[j] – a[i] > S B a[j] – a[i] < S

C a[i] – a[j] < S D a[i] – a[j] > S


Backend Development
Practice Questions

Round 1

Question 19 Single choice

Consider the following input for the following code snippet

int main ()

int num = 5999, temp, rev = 0

temp = num

while (temp != 0)

r = temp % 10

rev = rev * 10 + r

temp /= 10

print(rev)

return 0

Options
A 5999 B 5999599

C 5995999 D 59995999
Backend Development
Practice Questions

Round 1

Question 20 Single choice

What is the value returned by the function f given below when n=10?

int f (int n)

if (n==0)

return n

else

return n + f(n-2)

Options
A 30 B 20

C 40 D 50
Backend Development
Practice Questions

Round 1

Question 21 Single choice

Analyze the below pseudo-code for arrays and predict the output:

value = Array1[0];

for all elements Array1[1], Array1[2], ... of array Array1 do

if ( Array1[i] < value )

value = Array1[i]; }

print value;

Options
A Minimum value in the array gets
B Maximum value in the array gets
printed printed

C Prints array elements D Prints the maximum value in an


array
Backend Development
Practice Questions

Round 1

Question 22 Single choice

Analyze the below code and predict the output:

public class Class1

public static void main(String[] args)

int[ ] DemoArray = {18, 13, 11, 16, 22, 15};

int info = DemoArray[0];

for (int val : values)

if (val < info)

info = val;

Options
A Value is 11
B Value is 22

C Value is 15
D Value is 16
Backend Development
Practice Questions

Round 1

Question 23 Single choice

Analyze the below pseudo-code for arrays and predict the output:

info = 0;

for all element Array1[1], Array1[2], ... of array a do

if ( Array1[i] < Array1[info] )

info = i; }

print info;

Options
A Minimum value in the array
B Maximum value in the array

gets printed gets printed

C The index of the minimum D Prints array elements


value in an array gets printed
Backend Development
Practice Questions

Round 1

Question 24
25 Single choice

The 5 items: A, B, C, D, and E are pushed during a stack, starting from A. The stack is
popped four times and every element is inserted into a queue. 2 elements are deleted
from the queue and pushed back on the stack. Currently, one item is popped from the
stack and the popped element is ____.

Options
A A B B

C D D C

Question 25 Single choice

Consider a single linked list having a top pointer i.e pointer at the beginning of the list.
Which of the following operations can be performed in O(1) time?

I. Deletion of the last node within the connected list

II. Insertion at the front of the connected list

III. Deletion of the primary node within the connected list

IV. Insertion at the tip of the connected list

Options
A Only II B Both II and III

C Both I and IV D Both I and II


Backend Development
Practice Questions

Round 1

Question 26
25 Single choice

In which
The 5 items:
of the
A, following
B, C, D, and
data
E are
structures
pusheddo during
parent
a stack,
nodesstarting
have values
from A.
greater
The stack
than or
is
popped
equal to four
theirtimes
children?
and every element is inserted into a queue. 2 elements are deleted
from the queue and pushed back on the stack. Currently, one item is popped from the
stack and the popped element is ____.

Options
A min heap B max heap

C heapify D hybrid heap

Question 27 Single choice

If binary trees are delineated in arrays, what formula will be used to locate a left child if
the node has associate index i?

Options
A 2i B 2i+2

C 2i+1 D 4i
Backend Development
Practice Questions

Round 1

Question 28
25 Single choice

A simple
The 5 items:
graph
A, B,
hasC,5D,vertices
and E are
andpushed
10 edges.What
during ashould
stack, starting
be the degree
from A.ofThe
firststack
vertex?
is
popped four times and every element is inserted into a queue. 2 elements are deleted
from the queue and pushed back on the stack. Currently, one item is popped from the
stack and the popped element is ____.

Options
A 2 B 3

C 4 D 5

Question 29 Single choice

An undirected graph G has n nodes. its adjacency matrix is given an n×n matrix whose
diagonal components area unit 0’s non-diagonal components area unit 1’s. Which of the
following is true?

Options
A Graph G has no minimum
B Graph G has a unique MST

spanning tree (MST) of cost n−1

C Graph G has multiple distinct D Graph G has multiple spanning


MSTs, each of cost n−1 trees of different costs
Backend Development
Practice Questions

Round 1

Question 30
25 Single choice

The5Preorder
The items: A,traversal of a Ebinary
B, C, D, and tree is 30,
are pushed 20, a10,stack,
during 15, 25, 23, 39,
starting 35, A.
from 42.The
What willisbe
stack
its Inorder
popped traversal?
four times and every element is inserted into a queue. 2 elements are deleted
from the queue and pushed back on the stack. Currently, one item is popped from the
stack and the popped element is ____.

Options
A 10 , 15 , 30 , 20 ,25 , 23 , 39 ,
B 10 , 15 , 20 , 23 , 25 , 30 , 35 ,

35 , 42 39 , 42

C 30 , 20 , 10 , 15 , 25 , 23 , 39 , D 10 , 15 , 20 , 25 , 23 , 30 , 35 ,

35 , 42 39 , 42

Question 31 Single choice

What is the worst case time complexity of the Binary Search algorithm?

Options
A O(sqrt(n)) B O(1)

C O(n) D O(log n)
Backend Development
Practice Questions

Round 1

Question 32
25 Single choice

What5isitems:
The an in-place
A, B, C,sorting
D, andalgorithm?
E are pushed
Choose
during
thea appropriate
stack, starting
option
fromamong
A. The the
stack is
popped four times and every element is inserted into a queue. 2 elements are deleted
following.
from the queue and pushed back on the stack. Currently, one item is popped from the
stack and the popped element is ____.

Options
A It needs O(1) or O(logn) memory
B The input is already sorted

to create auxiliary locations and in-place

C It requires additional storage D None of the mentioned

Question 33 Single choice

Given 2 sorted lists of size 'p' and 'q' respectively. The number of comparisons needed
in the worst case by the Merge Sort algorithm will be?

Options
A pq B max(p,q)

C min(p,q) D p+q-1
Backend Development
Practice Questions

Round 1

Question 34
25 Single choice

W
The an in-A,
hat5isitems: place
B, C,sorting
D, andalgorithm? Choose
E are pushed during
thea appropriate
stack, starting
option
fromamong
A. The the
stack is
following.four times and every element is inserted into a queue. 2 elements are deleted
popped
from the queue and pushed back on the stack. Currently, one item is popped from the
stack and the popped element is ____.

Options
A It needs O(1) or O(logn) memory
B The input is already sorted

to create auxiliary locations and in-place

C It requires additional storage D None of the mentioned

Question 35 Single choice

A two-dimensional array P[i][j] contains N integers which are arranged in a random


sequence. We aim to check if any value is duplicated in the sequence. From the below
statements Which one of the following would be the most efficient algorithm,
asymptotically.

Options
A For each pair of positions i and j,
B Use binary search on the sorted

check if P[i] is equal to P[j]. array to find duplicate1 values

C Sort the array using insertion sort. D Sort the array using merge sort. Scan

When inserting each element into the sorted array from beginning to

the sorted prefix, check if there is end looking for adjacent equal

already a value equal to it in the elements. Sort the array using


prefix. quicksort.
Frontend Development
Practice Questions

Round 1

Answer Key
C 21. A

22. A

23. C

24. C

25. B

26. A

27. C

28. C

29. C

30. A

31. D

32. A

33. D

34. B

35. C

Backend Development
Practice Questions

Round 2

Question 1
Question Name: Balanced performance

Problem Statement

There are two participants in a contest namely P1 and P2.

There are N rounds. You are given an array W of size N where Wi is either 1 or

2.

If Wi is 1, it means P1 won the i-th round. Similarly Wi = 2 means P2 won the i-

th round.

You need to calculate total number of distinct sets of consecutive rounds

where P1 and P2 have won equal number of rounds.

For example: If W = [1, 2, 2, 1], there are three set of consecutive rounds

where P1 and P2 have won equal number of rounds: [1, 2], [2, 1], [1, 2, 2, 1].

Constraints

1 ≤ N ≤ 2*105

1 ≤ Wi ≤ 2

Time Constraint: 1s in C++

Input Format

First line contains an integer N.

Second line contains N spaced integers where i-th integer denotes the winner of

the particular round.

Output Format

An integer denoting the total number of set of rounds.

Sample Input

1 2 2 1 2

Sample Output

Explanation of Sample

Four distinct consecutive sets of required rounds are:

[1, 2]: round 1 and round 2, both P1 and P2 have won one round each.

[1, 2, 2, 1]: round 1, round 2, round 3 and round 4, both P1 and P2 have won

two rounds each.

[2, 1]: round 3 and round 4, both P1 and P2 have won one round each.

[1, 2]: round 4 and round 5, both P1 and P2 have won one round each.
Backend Development
Practice Questions

Round 2

Question 2
Problem Statement

You are given a N x M matrix. Aij denotes the cell in the ith row and jth column. Each

cell consists of an integer. You are at cell (1,1) and want to reach the cell (N,M).

You can move right (i, j) -> (i,j+1) or down (i, j) -> (i+1 , j).

The cost of a group of cells is the greatest common divisor of the happiness value of

these cells. GCD of an empty group is zero.

Consider the cells you visited in your journey from (1,1) to (N,M) as one group.

You have to maximize the cost of the group of not visited cells. Print the maximum

cost you can get of the group of cells you did not visit in your journey from (1,1) to

(N,M).

Constraints

• 1 <= M <= 2 * 10

• 1 <= N <= 2

• 1 <= Aij <= 10

Input Format

• First-line contains two space separated integers N and M.

• Next N lines, each contains M space separated integers denoting Aij

Output Format

• Print a single integer denoting the maximum cost you can get of the group of

cells you did not visit.

Sample Input 1

2 4

2 4 6 3

9 2 10 10

Sample Output 1

Explanation of Sample 1

If you follow the path shown then group of not visited cells will be [ (1,3),(1,4),(2,1) ]

2 4 6 3

9 2 10 10

Cells marked in bolds are cells he visited

GCD of the not visited cells = 3


Backend Development
Practice Questions

Round 2

Question 3
Problem Statement

Jay has received a string as a present on his birthday. The length of the string is N and
contains letters from a-z. He wants to share his gift with his twin brother. To do so, he
can break the string into two non-empty parts, Ai containing 1st, 2nd, ...ith letters and Bi
containing i+1th, i+2th, … nth letters. Jay’s happiness can be defined as :

Hi = (length of common suffix in {Ai, Bi} + length of common prefix in {Ai, Bi}).

You need to find the sum of all Hi for i = 1 to N-1.

Input Format

First line contains a single integer T, the number of test cases.

First line of each test case contains a single integer N.

The following line contains a string of length N.

Output Format

For each of the T testcases :

Print a single line containing an integer, the sum of all Hi for i = 1 to N-1.

Constraints

1 <= T <= 103

1 <= N <= 105

Note :- The sum of N over all testcases does not exceed 107.

Sample Input

abcdabc

Sample Output

Explanation

In the 1st test case, the value of happiness are as follows :

H1 = 0,

H2 = 0,

H3 = 3,

H4 = 3,

H5 = 0,

H6 = 0.

Frontend Development
Practice Questions

Round 1

Answer 1
#include <bits/stdc++.h>

#define ll long long

using namespace std;

int main() {

freopen ("input10.txt","r",stdin);

freopen ("output10.txt","w",stdout);

ll n;

cin>>n;

map<ll,ll> mp;

mp[0]=1;

ll sum = 0, ans = 0;

while(n--)

ll a;cin>>a;

sum += (a==1)?1LL:-1LL;

ans += mp[sum];

mp[sum]++;

cout<<ans;

return 0;

Frontend Development
Practice Questions

Round 2

Answer 2
# include <bits/stdc++.h>

//# include <ext/pb_ds/assoc_container.hpp>

//# include <ext/pb_ds/tree_policy.hpp>

# define ull unsigned long long

# define ll long long

# define double long double

# define pll pair<ll,ll>

# define pb push_back

# define pf push_front

# define fi first

# define se second

# define mp make_pair

# define max3(a,b,c) max(a,max(b,c))

# define min3(a,b,c) min(a,min(b,c))

# define all(x) x.begin(),x.end()

# define fill(a,b) memset(a,b,sizeof(a))

# define gcd(m,n) __gcd(m, n)

# define read(a,s,n) for(ll i = s; i<=n;i++) cin>>a[i]

# define pr_double(x) cout << fixed << setprecision(15) << x

# define PI 3.1415926535897932384626

# define endl '\n'

//using namespace __gnu_pbds;

using namespace std;

//template<typename T>

//using pbds = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

void __print(int x) {cerr << x;}

void __print(long x) {cerr << x;}

void __print(long long x) {cerr << x;}

void __print(unsigned x) {cerr << x;}

void __print(unsigned long x) {cerr << x;}

void __print(unsigned long long x) {cerr << x;}

void __print(float x) {cerr << x;}


Frontend Development
Practice Questions

Round 2

void __print(double x) {cerr << x;}

void __print(char x) {cerr << '\'' << x << '\'';}

void __print(const char *x) {cerr << '\"' << x << '\"';}

void __print(const string &x) {cerr << '\"' << x << '\"';}

void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>

void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr
<< '}';}

template<typename T>

void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
cerr << "}";}

void _print() {cerr << "]\n";}

template <typename T, typename... V>

void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)

struct custom_hash {

static uint64_t splitmix64(uint64_t x) {

x += 0x9e3779b97f4a7c15;

x = (x ^ (x >> 30)) * 0xbf58476d1c e4e5b9;

x = (x ^ (x >> 27)) * 0x94d049bb133111eb;

return x ^ (x >> 31);

size_t operator()(uint64_t x) const {

static const uint64_t FIXED_RANDOM =


std::chrono::steady_clock::now().time_since_epoch().count();

return splitmix64(x + FIXED_RANDOM);

};
Frontend Development
Practice Questions

Round 2

const ll INF = 9223372036854775807;

const ll N = 500005;

const ll mod = 1e9+7; //998244353; //67280421310721

const ll M = 22;

ll a[N],b[N],pre[N],suff[N];

int main() {

ios_base::sync_with_stdio(false);

cin.tie(NULL);

//freopen("input2.txt","r",stdin);

//freopen("output2.txt","w",stdout);

ll n,m; cin>>n>>m;

if(n==1)

ll val;

for(ll i=0;i<m;i++) cin>>val;

cout<<0<<endl; return 0;

read(a,1,m); read(b,1,m);

for(ll i=1;i<=m;i++)

pre[i] = gcd(pre[i-1],b[i]);

for(ll i=m;i>=1;i--) suff[i] = gcd(suff[i+1],a[i]);

ll ans=0;

for(ll i=1;i<=m;i++)

ll g = gcd(suff[i+1],pre[i-1]);

ans = max(ans,g);

cout<<ans<<endl;

Frontend Development
Practice Questions

Round 2

Answer 3
#include <bits/stdc++.h>

using namespace std;

#define int long long

#define quickread \

ios_base::sync_with_stdio(false); \

cin.tie(NULL); \

cout.tie(NULL);

#define pb push_back

#define all(x) x.begin(), x.end()

#define hii cout << "Hii there Sparky! \n"

#define endl '\n'

#define mod 1000000007

//#define mod 998244353

#define maxn 100010 // check the limits, dummy

// Using Z-function on strings for common prefixes and on reversed string for

// common suffixes

vector<int> z_function(string s) {

int n = (int)s.length();

vector<int> z(n);

for (int i = 1, l = 0, r = 0; i < n; ++i) {

if (i <= r) z[i] = min(r - i + 1, z[i - l]);

while (i + z[i] < n && s[z[i]] == s[i + z[i]]) ++z[i];

if (i + z[i] - 1 > r) l = i, r = i + z[i] - 1;

return z;

void solve() {

int n;

cin >> n;

string str;

cin >> str;

assert(str.length() == n && n > 0 && n <= 1e5);

vector<int> fwd = z_function(str);

reverse(all(str));
Frontend Development
Practice Questions

Round 2
vector<int> bkwd = z_function(str);

int ans = 0;

for (int i = 1; i < fwd.size(); i++) {

ans += min(i, fwd[i]);

ans += min(i, bkwd[i]);

cout << ans;

int32_t main() {

quickread;

int test = 1;

cin >> test;

for (int i = 0; i < test; i++) {

solve();

if (i < test - 1) cout << endl;

return 0;

}
Backend Development
Practice Questions

Round 3

Question 1
Problem Statement

Relevel a software engineering firm is looking to design an in-house software product to


facilitate food delivery. You have to design & build the backend for the food delivery
application and the ability for the users to login, search and find restaurants or find the
items.

Your task is to go through below templates/stories and create a Zomato clone for
Relevel.

Please solve the problem(s) given and submit them to us. Your submission must contain:

A link to your code.

A screen recording explaining your app.

Follow the standard naming conventions and comment on the code well, so that it is
easily understandable. We are looking for a basic working prototype so make your
assumptions accordingly and pace yourself.

Problem Setup

Download the code template on your local system.

The candidate should make sure Java, Postman & Intellij/Eclipse are already installed on
their system before starting the development. Install spring-boot-suite from https://
spring.io/projects/spring-boot.

The port number is given in the applications.properties file(9177) and also the
configuration to access the H2 console is already set up.

To Access the H2 Console:

To access h2 console, start the application and launch the following url on the browser

http://localhost:9177/h2-console

The user name is: testdb

password: password

Backend Development
Practice Questions

Please make sure the JDBC url, Driver class are the same as present in the above
picture.

All the required tables and the mock data should be present once the application is
launched to develop the below API.

For all the user stories given below, candidates can choose any of the available data
that is already created. If they wish to add new values they can do so by editing data.sql
file and restarting the server.

How to connect to JDBC: http://www.h2database.com/html/


tutorial.html#connecting_using_jdbc

Download the code to solve the assignment here: Zomato clone code template

User Stories

Problem 1 (Estimated Time to complete ~2 Hours)

The task is to create an API endpoint “/userRegistration” for the registration of the user:

A. Given the table is already present in the in-memory database(h2). Create entity class

for the user with the fields like Name, Email, UserId, Password, Phone, Full Address,

Address type(Home, Office, Others).

B. Apply proper validations for each value, for example, if the input email is of type

“xyz.com”, it should throw a Bad Request response.

C. Use an appropriate HTTPS method out of GET, POST, PUT, DELETE, etc.

D. Display status & response code in the response.

E. The successful request should return 201 response code along with the message

“User is registered successfully”.

Backend Development
Practice Questions

2. Story 2- Search Restaurant API

The task is to create an API endpoint “/search/{cityName}/{restaurant-name}” to search


all the available restaurants in a city with the given name.

A. Given a table with some dummy restaurants already created, create an API to fetch

all restaurants details.

B. The API request should take the city name and the restaurant-name as the path

parameter and return a list off all the restaurants matching the given name(case

insensitive) or part of the given name. (For example, if the user searches with

“bawarchi”, API should return a list of all the restaurants like “green bawarchi”,

“mughalai bawarchi”etc).

C. Each individual restaurant object should have basic details like the full name of

restaurant, full address, and also a flag saying if it’s accepting orders

(isAcceptingOrders: true/false).

D. Use an appropriate HTTPS method out of GET, POST, PUT, DELETE, etc.

E. In case of no restaurants present in the given name in the current city then return a

message “No Restaurants Available”.

F. The successful request should return 200 response code.

Submission Instructions

Code Submission:
Compress the code on the local system in the form of a *.zip file
Upload the code on your personal google drive in a folder titled - “Name_BD_<Round

Name> Code Base”

3.Don’t forget to change the permissions of the folder to ‘Anyone with the link can edit’.

Loom video submission:

1. Create an account on Loom.

2. Go through the quick tutorial on how to record loom videos.

3.Create a Loom video (while screensharing) covering the following points:

A.Show the functionality of the app you have created i.e demo of the working

APIs through a command line. (1 min)

B.Run through the key parts of your code explaining the core logic and how you

organized the code. (2 min)

C. Explain your problem-solving approach (what logic you have used and why).

(2 min)

4. Please keep your explanation to under 5 mins only.

5. Avoid too much jargon and explain your app in a simple and clear manner.

Backend Development
Practice Questions

Round 3

Question 2
Problem Statement

Relevel a software engineering firm is looking to design an in-house software product,


and that is their own content search application just like IMDB. You have to design &
build the backend for the content search application and the ability for the users to
register, log in, search for content.

Your task is to go through below templates/stories and create an IMDB clone for
Relevel.

Please solve the problem(s) mentioned and submit them to us. Your submission must
contain:

A link to your code.

A screen recording explaining your app.

Follow the standard naming conventions and comment on the code well, so that it is
easily understandable. We are looking for a basic working prototype so make your
assumptions accordingly and pace yourself.

Problem Setup

To start the development the zip file of the code is provided to you.

For Window
Download and extract the zipped folder to the local system.
Download and extract the zipped folder to the local system.
Install Virtual Environment: pip install virtualen
virtualenv ven
python3 -m virtualenv ven
Navigate to the folder with the code
Install requirements: pip install requirements.tx
python manage.py migrat
Open myImdb>settings.py and do the following:

A.Change debug to true: DEBUG = True

B.Change allowed hosts: ALLOWED_HOSTS = ['*']

10.manage.py runserver

11.Development starts at: http://127.0.0.1:8000/admin

Backend Development
Practice Questions

For Mac/Linu
Download and extract the zipped folder to the local system.
Install Django: pip install Djang
Install Virtual Environment: pip install virtualen
Run ‘python3 -m virtualenv venv
Run ‘source venv/bin/activate
Navigate to the folder with the extracted code.
Run ‘pip3 install -r requirements.tx
Run ‘python3 manage.py runserver’ to start the development server and start coding.
Search for http://localhost:8000/ in the browser to check for the hosted app.

Download the code to solve the assignment here: Imdb clone code template

User Stories

Problem 1 (Estimated Time to complete ~2 Hours)

A. Story 1 (User model)

The task is to create a User model to store key information of all the users. The

various functionalities to develop under this story are:

1. The user model should be able to store Name, Email/Phone, Password, Username,
Gender & Date of Birth.

2.Appropriate constraints including the primary key, foreign key should be there.

3.No two users should be allowed to use the same Email/Phone and the same username.

B.Story 2 (Registration)

The task is to create an API endpoint “/register” for the registration of the user.

1. The API request should take the User object as input and it should have Name, Email/
Phone, Password, Username, Gender & Date of Birth.

2.Apply proper validations for each value, for example, if the input email is of type
“xyz.com”, it should throw a Bad Request response.

3.Use an appropriate HTTPS method out of GET, POST, PUT, DELETE, etc.

4.Display status & response code in the response.

5.The successful request should return a 201 response code along with the message
“User is registered successfully”.

Submission Instructions

Code Submission:

1.Compress the code on the local system in the form of a *.zip file.

2.Upload the code on your personal google drive in a folder titled - “Name_BD_<Round
Name> Code Base”

3.Don’t forget to change the permissions of the folder to ‘Anyone with the link can edit’.

Backend Development
Practice Questions

Loom video submission:


Create an account on Loom.
Go through the quick tutorial on how to record loom videos.
Create a Loom video (while screensharing) covering the following points:

A. Show the functionality of the app you have created i.e demo of the working APIs

through a command line. (1 min)

B. Run through the key parts of your code explaining the core logic and how you

organized the code. (2 min)

C. Explain your problem-solving approach (what logic you have used and why). (2 min)4.

4.Please keep your explanation to under 5 mins only.

5.Avoid too much jargon and explain your app in a simple and clear manner.

Backend Development
Practice Questions

Round 3

Question 3
Problem statement

Relevel has commissioned you to create a fully functional Booking feature for a Travel
company (aka) xyz.com. xyz.com is a startup company that is into the travel domain and
is looking for backend developers who can create their product (web/application)
backend features with different use cases as specified.

Your task is to go through the problem statement, requirements, and create a travel
company application clone for Relevel.

Please solve the problem(s) mentioned and submit them to us. Your submission must
contain:

A link to your code.

A screen recording explaining your application.

Follow the standard naming conventions and your comment on the code must be easily
understandable. We are looking for a basic working prototype so make your
assumptions accordingly and pace yourself.

Problem setup

To start the development the .zip file of the code is provided to you.

Steps to follow
Install Nodejs on your local system if not already installed. For Windows, follow the
instructions in the link. For Mac, follow the instructions given in the link. For Linux,
follow the instructions here.
Download the code on the local system
Create a .env file and store all the environment variables inside this file
Install all the necessary dependencies by running `npm install`
Run `npm run dev` to start the development server .

Start coding now and to check the hosted application in the browser, you can search for
http://localhost:8080/ in your browser.

Other setup instructions are mentioned here -> ReadME

Download the code to solve the assignment here: Travel Booking Clone template

Backend Development
Practice Questions

Round 3

Question 3
\User stories

Problem 1 (estimated time to complete ~2 hours)

1.User Story -1: (Creating a set of user accounts


You need to add 5-6 sets of mock user accounts into the Database. And for this you
need to create an api endpoint to add a new user as ‘/add-user’
While adding user, you need to add following data as a part of user creation in a api
request payload:

1) name 2) email 3) Role 4) userID (should be index of user’s list +1) 5) addedOn date

3.Your API must validate the data (e.g: valid email and valid date) before storing/saving
into the database, and throw validation errors with status code in case of missing fields.

User Story -2: (authentication)

1. You need to work on the login feature here and perform user authentication, where
you need to pass user email in a request payload and check whether the given user
exists in the user database or not. And for this you need to create an api endpoint as ‘/
login’

2. If the user does not exist or exists, in either of the cases, send back the status code
and message as an api response.

3.Add an extra field to the api response i.e “ROLE”, this field should be sent for the
authenticated user only and must not be sent in case of invalid or non - existent user.

Submission instructions

Code submission:

1. Compress the code on the local system in the form of a *.zip file.

2. Upload the code on your personal google drive in a folder titled - “Name_BD_<Name
of Round> App”.

3.Do not forget to change the permissions of the folder to ‘Anyone with the link can
edit’.

Backend Development
Practice Questions

Round 3

Question 3

Loom video submission:

1. Create a Loom account.

2. Go through the quick tutorial on how to record loom videos.

3.Create a Loom video (while screen sharing) covering the following points:

A.Show the functionality of the application you have created. For example: demo of the
working APIs through a command line. (1 min)

B. Run through the key parts of your code explaining the core logic and how you
organized the code. (2 mins)

C.Explain your problem-solving approach (what logic you have used and why). (2 mins)

4.Keep your explanation to under 5 mins only.

5.Avoid too much jargon and explain your application in a simple and clear manner.

Backend Development
Practice Questions

Round 4

Question 1
Problem Statement

Relevel a software engineering firm is looking to design an in-house software product to


facilitate food delivery. You have to design & build the backend for the food delivery
application and the ability for the users to login, search and find restaurants or find the
items.

Your task is to go through below templates/stories and create a Zomato clone for
Relevel.

Please solve the problem(s) given and submit them to us. Your submission must contain:

-A link to your code.

-A screen recording explaining your app.

Follow the standard naming conventions and comment on the code well, so that it is
easily understandable. We are looking for a basic working prototype so make your
assumptions accordingly and pace yourself.

For this round, you have to use the code template that you have used in the previous
round itself. You will extend the code you have already written.

Problem Setup

You would need to use the same setup as in the previous round. You need to extend the
code written in the previous round.

User Stories

Problem 1 (Estimated Time to complete ~1.5 Hours)

Story 1 - Search Dish API(~45-60 mins).

The task is to create an API endpoint “/search/{cityName}/{dish-name}” to search all the


available restaurants in a city which are currently accepting orders and serving the dish.

A. Given a table with some dummy restaurants already created, create an API to fetch

all dish details along with the restaurants that serve the dish.

B.The API request should take the city name and the dish-name as the path parameter
and return a list of all the dish details along with the restaurants that serve the dish-
name(case insensitive) or part of the given dish-name. (For example, if the user searches
with “biryani”, API should return a list of all the details like “chicken biryani”, “egg
biryani” etc).

Backend Development
Practice Questions

C.Each individual details object should have basic details like the full name of the dish,
full name of the serving restaurant, full address of the restaurant, and price of the dish at
that restaurant(Note: Only return the restaurants that are currently accepting orders).

D.Use an appropriate HTTPS method out of GET, POST, PUT, DELETE, etc.

E.In case of no restaurants present in the given name in the current city that serves the
mentioned dish then return a message “No Restaurants Available”.

F.The successful request should return 200 response code.

Submission Instructions

Code Submission:
Compress the code on the local system in the form of a *.zip file
Upload the code on your personal google drive in a folder titled - “Name_BD_<Round
Name> Code Base
Don’t forget to change the permissions of the folder to ‘Anyone with the link can edit’.

Loom video submission:

1. Create an account on Loom.

2. Go through the quick tutorial on how to record loom videos.

3. Create a Loom video (while screen sharing) covering the following points:

A. Show the functionality of the app you have created i.e demo of the working APIs
through a command line. (1 min)

B. Run through the key parts of your code explaining the core logic and how you
organized the code. (2 min)

C. Explain your problem-solving approach (what logic you have used and why). (2 min)

4.Please keep your explanation to under 5 mins only.

5.Avoid too much jargon and explain your app in a simple and clear manner.

Backend Development
Practice Questions

Round 4

Question 2
Problem Statement

Relevel a software engineering firm is looking to design an in-house software product,


and that is their own content search application just like IMDB. You have to design &
build the backend for the content search application and the ability for the users to
register, log in, search for content.

Your task is to go through below templates/stories and create an IMDB clone for
Relevel.

Please solve both the problems mentioned below and submit them to us. Your
submission must contain
A link to your code
A screen recording explaining your app.

Follow the standard naming conventions and comment on the code well, so that it is
easily understandable. We are looking for a basic working prototype so make your
assumptions accordingly and pace yourself.

For this round, you have to use the code template that you have used in the previous
round itself. You will extend the code you have already written.

Problem Setup

You would need to use the same setup as in the previous round. You would need to
extend the code written in the previous round.

User Stories

Problem 1 (Estimated Time to Complete ~1.5 Hrs)

Story 3 (Update User Information)

The task is to create an API endpoint “/updateUser” for updating the user information.
The API request should take the User object as input and update the user
Apply proper validations for each value, for example, if the input email is of type
“xyz.com”, it should throw a Bad Request response
Use an appropriate HTTPS method out of GET, POST, PUT, DELETE, etc
Display status & response code in the response
The successful request should return a 201 response code along with the message
“User updated successfully”.
Backend Development
Practice Questions

Submission Instructions

Code Submission:
Compress the code on the local system in the form of a *.zip file
Upload the code on your personal google drive in a folder titled - “Name_BD_<Round
Name> Code Base
Don’t forget to change the permissions of the folder to ‘Anyone with the link can edit’.

Loom video submission:

1. Create an account on Loom.

2. Go through the quick tutorial on how to record loom videos.

3. Create a Loom video (while screensharing) covering the following points:

A.Show the functionality of the app you have created i.e demo of the working APIs
through a command line. (1 min)

B. Run through the key parts of your code explaining the core logic and how you
organized the code. (2 min)

C.Explain your problem-solving approach (what logic you have used and why). (2 min)

4.Please keep your explanation to under 5 mins only.

5.Avoid too much jargon and explain your app in a simple and clear manner.

Backend Development
Practice Questions

Round 4

Question 3
Problem statement

Relevel has commissioned you to create a fully functional Booking feature for a Travel
company (aka) xyz.com. xyz.com is a startup company that is into the travel domain and
is looking for backend developers who can create their product (web/application)
backend features with different use cases as specified.

Your task is to go through the problem statement, requirements, and create a Travel
company application clone for Relevel.

Please solve both the problems mentioned below and submit them to us. Your
submission must contain
A link to your code
A screen recording explaining your application.

Follow the standard naming conventions and your comment on the code must be easily
understandable. We are looking for a basic working prototype so make your
assumptions accordingly and pace yourself.

Problem setup

Use the same setup and extend the code written in the previous round.

User stories

Problem 1 (estimated time to complete ~1.5 hours)

User Story -1 : (getting user details with api validation


Now, you have a set of user’s data in the database. So now what you need to do is to
fetch user details using the user's email. For this you need to write an api, which can
be ‘get-user/:email
While querying for getting the user details, if invalid email or empty query param is
given in the api by the end user, you must throw a proper error message to the end
user informing what is being entered by him/her
Send http status code with proper statusMessage on all successful http operations
Send 401 status code for refused authorization (in case)
Send http status code as 500 with statusMessage, in case the server encounters

Backend Development
Practice Questions

Submission instructions

Code submission:
Compress the code on the local system in the form of a *.zip file
Upload the code on your personal google drive in a folder titled - “Name_BD_<Name
of Round> App”
Do not forget to change the permissions of the folder to ‘Anyone with the link can
edit’.

Loom video submission:

1. Create a Loom account.

2. Go through the quick tutorial on how to record loom videos.

3.Create a Loom video (while screen sharing) covering the following points:

A. Show the functionality of the application you have created. For example: demo of the
working APIs through a command line. (1 min)

B. Run through the key parts of your code explaining the core logic and how you
organized the code. (2 mins)

C. Explain your problem-solving approach (what logic you have used and why). (2 mins)

4.Keep your explanation to under 5 mins only.

5.Avoid too much jargon and explain your application in a simple and clear manner.

You might also like