Add office photos
Engaged Employer

SAP

4.2
based on 1.7k Reviews
Video summary
Proud winner of ABECA 2024 - AmbitionBox Employee Choice Awards
Filter interviews by

30+ Servotech Power Systems Interview Questions and Answers

Updated 21 May 2024
Popular Designations

Q1. Duplicate Integer in Array

Given an array ARR of size N, containing each number between 1 and N-1 at least once, identify the single integer that appears twice.

Input:

The first line contains an integer, 'T', r...read more
Ans.

Identify the duplicate integer in an array containing numbers between 1 and N-1.

  • Iterate through the array and keep track of the frequency of each element using a hashmap.

  • Return the element with a frequency greater than 1 as the duplicate integer.

  • Time complexity can be optimized to O(N) using Floyd's Tortoise and Hare algorithm.

  • Example: For input [1, 2, 3, 4, 4], the output should be 4.

Add your answer

Q2. Overlapping Intervals Problem Statement

You are given the start and end times of 'N' intervals. Write a function to determine if any two intervals overlap.

Note:

If an interval ends at time T and another interv...read more

Ans.

Given start and end times of intervals, determine if any two intervals overlap.

  • Iterate through intervals and check if any two intervals overlap by comparing their start and end times

  • Sort intervals based on start times for efficient comparison

  • Consider edge cases where intervals end and start at the same time

Add your answer

Q3. Covid Vaccination Distribution Problem

As the Government ramps up vaccination drives to combat the second wave of Covid-19, you are tasked with helping plan an effective vaccination schedule. Your goal is to ma...read more

Ans.

Maximize the number of vaccines administered on a specific day while adhering to certain rules.

  • Given n days, maxVaccines available, and a specific dayNumber, distribute vaccines to maximize on dayNumber

  • Administer positive number of vaccines each day with a difference of 1 between consecutive days

  • Ensure sum of vaccines distributed does not exceed maxVaccines

  • Output the maximum number of vaccines administered on dayNumber for each test case

Add your answer

Q4. Level Order Traversal Problem Statement

Given a binary tree of integers, return the level order traversal of the binary tree.

Input:

The first line contains an integer 'T', representing the number of test cases...read more
Ans.

The task is to implement a function that returns the level order traversal of a binary tree given in level order.

  • Create a queue to store nodes for level order traversal

  • Start with the root node and enqueue it

  • While the queue is not empty, dequeue a node, print its value, and enqueue its children

  • Repeat until all nodes are traversed

Add your answer
Discover Servotech Power Systems interview dos and don'ts from real experiences

Q5. Longest Increasing Subsequence Problem Statement

Given 'N' students standing in a row with specific heights, your task is to find the length of the longest strictly increasing subsequence of their heights, ensu...read more

Ans.

Find the length of the longest strictly increasing subsequence of heights of students in a row.

  • Iterate through the heights array and for each element, find the length of the longest increasing subsequence ending at that element.

  • Use dynamic programming to keep track of the longest increasing subsequence length for each element.

  • Return the maximum length found as the result.

Add your answer

Q6. Merge Sort Problem Statement

You are given a sequence of numbers, ARR. Your task is to return a sorted sequence of ARR in non-descending order using the Merge Sort algorithm.

Explanation:

The Merge Sort algorit...read more

Ans.

Implement Merge Sort algorithm to sort a sequence of numbers in non-descending order.

  • Divide the input array into two halves recursively until each array has only one element.

  • Merge the sorted halves to produce a completely sorted array.

  • Time complexity of Merge Sort is O(n log n).

  • Example: Input: [3, 1, 4, 1, 5], Output: [1, 1, 3, 4, 5]

Add your answer
Are these interview questions helpful?

Q7. Zig-Zag String Problem Statement

Given a string STR of size N and an integer M representing the number of rows in the zig-zag pattern, return the string formed by concatenating all rows when the string STR is w...read more

Ans.

Arrange a string in zig-zag pattern with given number of rows and concatenate the rows.

  • Iterate through the string and distribute characters to rows based on zig-zag pattern

  • Concatenate the characters in each row to get the final result

  • Handle edge cases like when number of rows is 1 or equal to the length of the string

Add your answer

Q8. Floyd Warshall Algorithm Problem

You are given a directed weighted graph with 'N' vertices, labeled from 1 to 'N', and 'M' edges. Each edge connects two nodes 'u' and 'v' with a weight 'w', representing the dis...read more

Ans.

The Floyd Warshall algorithm is used to find the shortest paths between all pairs of vertices in a graph, including graphs with negative edge weights.

  • The algorithm works by considering all pairs of vertices and all intermediate vertices to find the shortest path.

  • It can handle graphs with negative edge weights, but not negative weight cycles.

  • The time complexity of the algorithm is O(N^3), where N is the number of vertices.

  • Example: Given a graph with 4 vertices and 5 edges, fin...read more

Add your answer
Share interview questions and help millions of jobseekers 🌟

Q9. Longest Unique Substring Problem Statement

Given a string input of length 'n', your task is to determine the length of the longest substring that contains no repeating characters.

Explanation:

A substring is a ...read more

Ans.

Find the length of the longest substring with unique characters in a given string.

  • Use a sliding window approach to keep track of the longest substring without repeating characters.

  • Use a hashmap to store the index of each character in the string.

  • Update the start index of the window when a repeating character is encountered.

  • Calculate the maximum length of the window as you iterate through the string.

Add your answer

Q10. Binary Pattern Problem Statement

Given an input integer N, your task is to print a binary pattern as follows:

Example:

Input:
N = 4
Output:
1111
000
11
0
Explanation:

The first line contains 'N' 1s. The next line ...read more

Ans.

Print a binary pattern based on input integer N in a specific format.

  • Iterate from 1 to N and print N - i + 1 numbers alternatively as 1 or 0 in each line

  • Follow the pattern of increasing 1s and decreasing 0s in each line

  • Handle the number of test cases and constraints as specified

Add your answer
Q11. You have a torch and a bridge that can only hold two people at a time. Four people need to cross the bridge at night, and they have only one torch. Each person walks at a different speed. When two people cross ...read more
Ans.

Two people with torch cross, one returns, two faster people cross, one with torch returns, two slower people cross.

  • Two slower people cross first (A and B), A returns with torch (1 minute)

  • Two faster people cross (C and D), B returns with torch (2 minutes)

  • Two slower people cross last (A and B) (10 minutes)

Add your answer

Q12. Print Permutations - String Problem Statement

Given an input string 'S', you are tasked with finding and returning all possible permutations of the input string.

Input:

The first and only line of input contains...read more
Ans.

Return all possible permutations of a given input string.

  • Use recursion to generate all possible permutations of the input string.

  • Swap characters at different positions to generate permutations.

  • Handle duplicate characters in the input string by using a set to store unique permutations.

Add your answer

Q13. Factorial of a Number Problem Statement

You are provided with an integer 'N'. Your task is to calculate and print the factorial of 'N'. The factorial of a number 'N', denoted as N!, is the product of all positi...read more

Ans.

Calculate and print the factorial of a given integer 'N'.

  • Iterate from 1 to N and multiply each number to calculate factorial

  • Handle edge cases like N=0 or N=1 separately

  • Use recursion to calculate factorial efficiently

Add your answer

Q14. Bubble Sort Problem Statement

Sort the given unsorted array consisting of N non-negative integers in non-decreasing order using the Bubble Sort algorithm.

Input:

The first line contains an integer 'T' represent...read more
Ans.

Bubble Sort algorithm is used to sort an array of non-negative integers in non-decreasing order.

  • Iterate through the array and compare adjacent elements, swapping them if they are in the wrong order.

  • Repeat this process until the array is sorted.

  • Time complexity of Bubble Sort is O(n^2) in worst case.

  • Space complexity of Bubble Sort is O(1) as it is an in-place sorting algorithm.

Add your answer

Q15. Remove Consecutive Duplicates Problem Statement

Given a string S, your task is to recursively remove all consecutive duplicate characters from the string.

Input:

String S

Output:

Output string

Constraints:

  • 1 <...read more
Ans.

Recursively remove consecutive duplicate characters from a string.

  • Use recursion to check if the current character is the same as the next character, if so skip the next character

  • Base case: if the string is empty or has only one character, return the string

  • Example: Input: 'aaabcc', Output: 'abc'

Add your answer
Q16. What is the difference between a primary key and a unique key in a database management system?
Ans.

Primary key uniquely identifies each record in a table, while unique key ensures that all values in a column are distinct.

  • Primary key does not allow NULL values, while unique key allows one NULL value.

  • A table can have only one primary key, but multiple unique keys.

  • Primary key is automatically indexed, while unique key may or may not be indexed.

  • Example: In a table of students, student ID can be a primary key as it uniquely identifies each student, while email address can be a ...read more

Add your answer

Q17. What is polymorphism? Explain using a real life example

Ans.

Polymorphism is the ability of an object to take on many forms. It allows objects of different classes to be treated as the same type.

  • Polymorphism allows a single interface to be used for different types of objects.

  • It enables code reusability and flexibility in object-oriented programming.

  • For example, a parent class 'Animal' can have multiple child classes like 'Dog', 'Cat', and 'Bird'. They can all be treated as 'Animal' objects.

  • Each child class can have its own implementati...read more

Add your answer
Q18. What would be the database design for an ATM system?
Ans.

The database design for an ATM system should include tables for users, accounts, transactions, and ATM machines.

  • Create a table for users with fields like user_id, name, pin, etc.

  • Create a table for accounts with fields like account_id, user_id, balance, etc.

  • Create a table for transactions with fields like transaction_id, account_id, amount, date, etc.

  • Create a table for ATM machines with fields like atm_id, location, status, etc.

Add your answer
Q19. What is the difference between AES and DES ciphers?
Ans.

AES is a more secure and efficient cipher compared to DES.

  • AES has a block size of 128 bits, while DES has a block size of 64 bits.

  • AES supports key sizes of 128, 192, or 256 bits, while DES supports only 56-bit keys.

  • AES is considered more secure and efficient than DES due to its stronger encryption algorithm and larger key sizes.

Add your answer
Q20. What is normalization in the context of database management systems?
Ans.

Normalization is the process of organizing data in a database to reduce redundancy and improve data integrity.

  • Normalization involves breaking down a database into smaller, more manageable tables.

  • It helps in reducing data redundancy by storing data in a structured way.

  • There are different normal forms such as 1NF, 2NF, 3NF, BCNF, etc., each with specific rules to follow.

  • Normalization ensures data integrity and reduces the chances of anomalies like insertion, update, and deletio...read more

Add your answer
Q21. What is the difference between public and private cloud?
Ans.

Public cloud is shared infrastructure available to anyone, while private cloud is dedicated infrastructure for a single organization.

  • Public cloud is accessible to multiple organizations or users, while private cloud is exclusive to a single organization.

  • Public cloud services are provided over the internet, while private cloud services can be hosted on-premises or in a dedicated data center.

  • Public cloud offers cost-effective scalability and flexibility, while private cloud off...read more

Add your answer
Q22. What SQL queries were asked during your interview?
Ans.

Various SQL queries related to data manipulation and retrieval were asked during the interview.

  • Basic SELECT queries to retrieve data from a single table

  • JOIN queries to retrieve data from multiple tables based on a common column

  • Aggregate functions like COUNT, SUM, AVG, etc. to perform calculations on data

  • Subqueries to retrieve data based on the result of another query

  • UPDATE queries to modify existing data in a table

  • DELETE queries to remove specific records from a table

Add your answer
Q23. Write a query to find the nth highest salary in a database.
Ans.

Query to find the nth highest salary in a database

  • Use the ORDER BY clause to sort salaries in descending order

  • Use the LIMIT clause to specify the nth highest salary

  • Consider handling cases where there may be ties for the nth highest salary

Add your answer
Q24. What is the difference between RDBMS and DBMS?
Ans.

RDBMS is a type of DBMS that manages data in a structured format using tables with relationships.

  • RDBMS enforces referential integrity through foreign keys, while DBMS does not.

  • RDBMS supports ACID properties (Atomicity, Consistency, Isolation, Durability), while DBMS may not.

  • RDBMS allows for normalization of data to reduce redundancy, while DBMS does not have this feature.

  • Examples of RDBMS include MySQL, Oracle, SQL Server. Examples of DBMS include Microsoft Access, FoxPro.

Add your answer
Q25. Design an e-commerce website similar to Flipkart or Amazon.
Ans.

Design an e-commerce website similar to Flipkart or Amazon.

  • Implement user-friendly interface for easy navigation

  • Include search functionality with filters for products

  • Incorporate secure payment gateway for transactions

  • Provide personalized recommendations based on user behavior

  • Include customer reviews and ratings for products

  • Implement order tracking and delivery status updates

  • Offer various payment options like credit/debit cards, net banking, and COD

Add your answer

Q26. What is inheritance?

Ans.

Inheritance is a concept in object-oriented programming where a class inherits properties and behaviors from another class.

  • Inheritance allows for code reuse and promotes modularity.

  • The class that is being inherited from is called the superclass or base class.

  • The class that inherits from the superclass is called the subclass or derived class.

  • The subclass can access the public and protected members of the superclass.

  • Inheritance can be single, where a subclass inherits from only...read more

Add your answer
Q27. What is a semaphore?
Ans.

A semaphore is a synchronization construct used to control access to a shared resource by multiple processes or threads.

  • Semaphores can have an integer value representing the number of available resources.

  • They can be used to implement mutual exclusion and synchronization between processes.

  • Examples include binary semaphores (mutexes) and counting semaphores.

  • Operations on semaphores include wait (P) and signal (V).

Add your answer

Q28. Maximum area rectangle of 1s in a binary matrix

Ans.

Find the maximum area rectangle of 1s in a binary matrix.

  • Iterate through each row of the matrix and calculate the maximum area of rectangle with that row as the base.

  • Use a stack to keep track of the indices of the rows with increasing heights.

  • For each row, calculate the area of rectangle with that row as the height and update the maximum area.

Add your answer

Q29. Regular expressions in PhP

Ans.

Regular expressions in PHP are powerful tools for pattern matching and manipulating strings.

  • Regular expressions are defined using the preg_match() function in PHP.

  • They are used to search, replace, and validate strings based on specific patterns.

  • Regex patterns consist of a combination of characters and special symbols.

  • Modifiers can be added to the pattern to control the matching behavior.

  • Common regex functions in PHP include preg_match(), preg_replace(), and preg_split().

Add your answer

Q30. K-reverse a linked list

Ans.

Reverses every k nodes in a linked list

  • Iterate through the linked list in groups of k nodes

  • Reverse each group of k nodes

  • Connect the reversed groups back together

Add your answer

More about working at SAP

Top Rated Large Company - 2024
Top Rated Internet/Product Company - 2024
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos

Interview Process at Servotech Power Systems

based on 1 interviews
1 Interview rounds
Coding Test Round
View more
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Software Developer Interview Questions from Similar Companies

4.0
 • 107 Interview Questions
3.9
 • 35 Interview Questions
4.3
 • 25 Interview Questions
3.7
 • 23 Interview Questions
3.7
 • 21 Interview Questions
3.5
 • 15 Interview Questions
View all
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
75 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter