
Persistent Systems

40+ Persistent Systems Interview Questions and Answers for Freshers
Q1. Index of First Occurrence Problem Statement
Given two strings A
and B
, determine the index of the first occurrence of A
in B
. If A
is not present in B
, return -1.
Example:
Input:
A = "bc", B = "abcddbc"
Output:...read more
Find the index of the first occurrence of string A in string B.
Iterate through string B and check if a substring of length equal to A matches A.
Return the index of the first occurrence of A in B, or -1 if not found.
Q2. LCA in a Binary Search Tree
You are given a binary search tree (BST) containing N nodes. Additionally, you have references to two nodes, P and Q, within this BST.
Your task is to determine the Lowest Common Anc...read more
The task is to find the Lowest Common Ancestor (LCA) of two nodes in a Binary Search Tree (BST).
Traverse the BST from the root to find the LCA of nodes P and Q.
Compare the values of nodes P and Q with the current node's value to determine the LCA.
If both nodes are on the same side of the current node, move to that side; otherwise, the current node is the LCA.
Example: For input 2 3 and BST 1 2 3 4 -1 5 6 -1 7 -1 -1 -1 -1 -1 -1, the LCA is node 1.
Q3. Cycle Detection in a Singly Linked List
Determine if a given singly linked list of integers forms a cycle or not.
A cycle in a linked list occurs when a node's next
points back to a previous node in the list. T...read more
Detect if a singly linked list forms a cycle by checking if a node's next points back to a previous node.
Traverse the linked list using two pointers, one moving one step at a time and the other moving two steps at a time.
If the two pointers meet at any point, it indicates the presence of a cycle in the linked list.
If one of the pointers reaches the end of the list (null), it means there is no cycle.
Q4. Subarray With Given Sum Problem Statement
Given an array ARR
of N integers and an integer S, determine if there exists a contiguous subarray within the array with a sum equal to S. If such a subarray exists, re...read more
Given an array of integers and a target sum, find a contiguous subarray with the sum equal to the target.
Iterate through the array while keeping track of the current sum and start index.
Use a hashmap to store the cumulative sum and its corresponding index.
If the difference between the current sum and the target is found in the hashmap, return the indices.
Handle edge cases like when the target sum is 0 or when no subarray is found.
Q5. First Non-Repeating Character Problem Statement
You are given a string consisting of English alphabet characters. Your task is to identify and return the first character in the string that does not repeat. If e...read more
The task is to find the first non-repeating character in a string, or return the first character if all characters repeat.
Iterate through the string to count the frequency of each character.
Find the first character with a frequency of 1 and return it.
If no such character exists, return the first character of the string.
Q6. 7. what is public and private IP. how are they different
Public and private IP addresses are used in computer networks. Public IPs are globally unique and accessible from the internet, while private IPs are used within a local network.
Public IP is assigned by the Internet Service Provider (ISP) and is used to identify a device on the internet.
Private IP is assigned by a local network administrator and is used to identify a device within a local network.
Public IPs are globally unique, allowing devices to communicate with each other ...read more
Q7. Write a program for reversing a string without using string function
Program to reverse a string without using string function
Iterate through the string from end to start and append each character to a new string
Use a loop to swap the first and last characters, then move towards the middle until the entire string is reversed
Convert the string to a character array, then swap the first and last elements until the entire array is reversed
Q8. what is basic difference between c and cpp. explain on memory levels
C is a procedural programming language while C++ is an object-oriented programming language.
C is a procedural programming language, meaning it focuses on procedures or functions.
C++ is an extension of C and adds object-oriented features like classes and inheritance.
C++ supports polymorphism, encapsulation, and abstraction, which C lacks.
C++ allows the use of standard template library (STL) for data structures and algorithms.
C++ has exception handling mechanisms, whereas C doe...read more
Q9. What are keys in database and why do we use them?
Keys in a database are unique identifiers used to establish relationships between tables and ensure data integrity.
Keys are used to uniquely identify records in a database table.
Primary keys are used to uniquely identify each record in a table.
Foreign keys establish relationships between tables.
Keys help enforce data integrity and maintain consistency in the database.
Examples of keys include primary keys, foreign keys, and unique keys.
Q10. explain what is deadloacks and ways to prevent them
Deadlocks are situations where two or more processes are unable to proceed because each is waiting for the other to release a resource.
Deadlocks occur when multiple processes are stuck in a circular waiting state.
Prevention techniques include resource allocation strategies, deadlock detection, and avoidance algorithms.
Examples of prevention techniques are using a resource allocation graph, implementing a banker's algorithm, and employing timeouts and resource preemption.
Q11. 8. Explain how a message is transferred in OSI layer
A message is transferred in OSI layer through a process called encapsulation and decapsulation.
The message is divided into smaller chunks called packets at the transport layer.
Each packet is then encapsulated with headers containing necessary information.
The encapsulated packets are then passed down to the network layer.
At the network layer, the packets are further encapsulated with network layer headers.
The encapsulated packets are then passed down to the data link layer.
At ...read more
Q12. what is Polymorphism. what are its 3 conditions
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 is achieved through method overriding and method overloading.
It allows for code reusability and flexibility in object-oriented programming.
Three conditions for polymorphism are inheritance, method overriding, and a common interface or base class.
Q13. 2. Explain how does Prediction works
Prediction uses data analysis and statistical models to forecast future outcomes.
Prediction involves collecting and analyzing data to identify patterns and trends.
Statistical models are then used to make predictions based on the identified patterns.
Predictions can be made for a wide range of applications, such as weather forecasting, stock market trends, and customer behavior.
Accuracy of predictions can be improved by using machine learning algorithms and incorporating new da...read more
Q14. Do you know about My Passion Challenge test?
Yes, My Passion Challenge test is a coding competition for software engineers.
My Passion Challenge test is a coding competition that evaluates the coding skills of software engineers.
It is designed to test problem-solving abilities, algorithmic thinking, and coding proficiency.
Participants are given a set of coding challenges to solve within a specified time limit.
The challenges can range from simple to complex, covering various programming languages and concepts.
The test ass...read more
Q15. 3. Draw flow Chart of classification algorithms
Classification algorithms can be represented using flow charts.
Classification algorithms are used to categorize data into different classes.
Flow charts can be used to represent the decision-making process of classification algorithms.
Examples of classification algorithms include decision trees, k-nearest neighbors, and support vector machines.
Q16. Why do we normalise our database?
Normalisation reduces data redundancy and improves data integrity in a database.
Prevents data duplication and inconsistencies
Simplifies database maintenance and updates
Improves query performance
Enforces data integrity and consistency
Follows best practices for database design
Examples: breaking down a customer table into separate tables for orders, addresses, and payments
Examples: creating a separate table for product categories instead of repeating the category name in each pr...read more
Q17. 1. what is Machine Learning
Machine learning is a subset of artificial intelligence that enables machines to learn from data without being explicitly programmed.
It involves training algorithms on large datasets to make predictions or decisions.
It can be supervised, unsupervised, or semi-supervised.
Examples include image recognition, natural language processing, and recommendation systems.
Q18. basic important difference between java and cpp
Java is platform independent while C++ is not.
Java code is compiled into bytecode which can run on any platform with a JVM, while C++ code needs to be compiled separately for each platform.
Java has automatic memory management through garbage collection, while C++ requires manual memory management.
Java has built-in support for multithreading, while C++ requires external libraries.
Java has a simpler syntax and is easier to learn than C++.
C++ allows for low-level memory manipula...read more
Q19. 3. Write a query to demonstrate outer join on given tables.
Demonstrate outer join using SQL query
Use LEFT OUTER JOIN or RIGHT OUTER JOIN to include all records from one table and matching records from another table
Use the ON keyword to specify the join condition
Use COALESCE function to handle NULL values in the result set
Q20. 5. what is Banker's algorithm
Banker's algorithm is a resource allocation and deadlock avoidance algorithm used in operating systems.
It is used to prevent deadlocks by ensuring that the system never enters an unsafe state.
It works by simulating the allocation of resources and checking if the system will remain in a safe state.
It requires knowledge of the maximum resource needs of each process and the currently available resources.
If a request for resources would result in an unsafe state, the request is d...read more
Q21. Interoperability in Inheritance and polymorphism
Interoperability in inheritance and polymorphism allows objects of different classes to be used interchangeably.
Inheritance allows a subclass to inherit properties and methods from a superclass.
Polymorphism allows objects of different classes to be treated as if they are of the same class.
Interoperability between inheritance and polymorphism allows objects of different classes to be used interchangeably.
For example, a subclass can be used wherever a superclass is expected, an...read more
Q22. What are features of C++?
C++ is a high-level programming language with features like object-oriented programming, templates, and memory management.
C++ supports object-oriented programming concepts like encapsulation, inheritance, and polymorphism.
Templates allow generic programming and code reusability.
C++ provides low-level memory manipulation through pointers.
Standard Template Library (STL) provides a collection of classes and functions for data structures and algorithms.
C++ supports operator overl...read more
Q23. What are issues in cloud?
Issues in cloud include security, downtime, vendor lock-in, and data privacy.
Security concerns such as data breaches and unauthorized access
Downtime and service interruptions affecting business operations
Vendor lock-in and limited flexibility in choosing cloud providers
Data privacy and compliance with regulations such as GDPR and HIPAA
Q24. What data structure has implemented in a elevator.
The data structure implemented in an elevator is a queue.
Elevator requests are added to the queue in the order they are received.
The elevator serves requests in a first-come, first-served manner.
Once a request is completed, it is removed from the queue.
Example: If someone on the 5th floor requests the elevator, their request is added to the queue and the elevator will serve it after completing any previous requests.
Q25. implement binary search on linked list
Implementing binary search on a linked list
Find the middle element of the linked list
Compare the middle element with the search key
If the middle element is greater than the search key, search in the left half of the linked list
If the middle element is less than the search key, search in the right half of the linked list
Repeat until the search key is found or the entire linked list is traversed
Q26. Flow diagram of final year project
The flow diagram of my final year project showcases the step-by-step process of its execution.
The flow diagram illustrates the sequence of activities and their dependencies.
It helps in understanding the overall structure and logic of the project.
Each step in the diagram represents a specific task or action.
Arrows indicate the flow of control or data between different steps.
Decision points are represented by diamond-shaped symbols.
Example: Start -> Input Data -> Process Data -...read more
Q27. What is Big Data?
Big Data refers to large and complex data sets that cannot be processed using traditional data processing methods.
Big Data is characterized by the 3Vs - Volume, Velocity, and Variety.
It requires specialized tools and technologies such as Hadoop, Spark, and NoSQL databases.
Examples of Big Data include social media data, sensor data, and financial market data.
Q28. What are transaction logs
Transaction logs are records of all the changes made to a database or file system.
They help in recovering data in case of system failure or errors.
They provide a history of all the transactions made to the database or file system.
They are used for auditing and compliance purposes.
Examples include SQL Server transaction logs, file system transaction logs, etc.
Q29. Hands on SQL quesries to create and manipulate table and table elements.
Hands-on experience with SQL queries for creating and manipulating tables and table elements.
Use CREATE TABLE statement to create a new table
Use ALTER TABLE statement to add, modify, or delete columns in a table
Use INSERT INTO statement to add new rows of data into a table
Use UPDATE statement to modify existing data in a table
Use DELETE statement to remove rows from a table
Q30. what is thrashing
Thrashing is a phenomenon in computer systems where excessive swapping of data between RAM and virtual memory occurs.
Occurs when a computer spends more time swapping data between RAM and virtual memory than executing actual tasks
Can be caused by insufficient RAM or poorly optimized programs
Can lead to a significant decrease in system performance
Example: A computer running multiple memory-intensive programs simultaneously may experience thrashing
Q31. Oops concepts , difference between encapsulation and abstract and Polymorphism
Encapsulation is bundling data and methods together, abstraction is hiding implementation details, and polymorphism allows objects to be treated as instances of their parent class.
Encapsulation involves bundling data and methods within a class to restrict access from outside.
Abstraction involves hiding the implementation details of a class and only showing the necessary features.
Polymorphism allows objects to be treated as instances of their parent class, enabling flexibility...read more
Q32. Write a code for half pyramid using numbers
Code for half pyramid using numbers
Use nested loops to print the numbers in each row
The number of columns in each row should be equal to the row number
Start the loop from 1 and go up to the desired number of rows
Q33. 1. Pattern Printing Program
A program to print patterns using arrays of strings.
Create an array of strings to hold the pattern
Use loops to fill the array with the desired pattern
Print the array to display the pattern
Q34. Four pillars of OOPs
Encapsulation, Inheritance, Polymorphism, Abstraction
Encapsulation: Bundling data and methods that operate on the data into a single unit
Inheritance: Ability to create a new class that inherits attributes and methods from an existing class
Polymorphism: Ability to present the same interface for different data types
Abstraction: Hiding the complex implementation details and showing only the necessary features
Q35. write a star program
A star program prints a pattern of stars in a specific shape.
Use nested loops to control the number of rows and columns
Use if-else statements to determine when to print a star or a space
Example: Print a pyramid of stars with 5 rows
Q36. datatypes in java
Java has various datatypes like int, double, boolean, etc. to store different types of values.
Primitive datatypes include int, double, boolean, char, etc.
Reference datatypes include classes, interfaces, arrays, etc.
Examples: int num = 10; double price = 19.99; boolean isTrue = true;
Q37. What is Oopps? Concept of polmorphism.
OOPs stands for Object-Oriented Programming. Polymorphism is the ability of an object to take on many forms.
OOPs is a programming paradigm that focuses on objects and their interactions.
Polymorphism allows objects of different classes to be treated as if they are of the same class.
There are two types of polymorphism: compile-time and runtime.
Compile-time polymorphism is achieved through method overloading.
Runtime polymorphism is achieved through method overriding.
Example of p...read more
Q38. Puzzle- You have a 3 gallon and 5 gallon jug, how would you fill a 4 gallon jug?
Fill the 3 gallon jug, pour it into the 5 gallon jug, fill the 3 gallon jug again, pour it into the 5 gallon jug until it is full, leaving 1 gallon in the 3 gallon jug.
Fill the 3 gallon jug
Pour the 3 gallon jug into the 5 gallon jug
Fill the 3 gallon jug again
Pour the 3 gallon jug into the 5 gallon jug until it is full
The 4 gallon jug will have 1 gallon of water
Q39. Write a query to find the second highest salary in a table.
Query to find the second highest salary in a table.
Use the MAX() function to find the highest salary.
Use the WHERE clause to exclude the highest salary from the result.
Use the MAX() function again to find the second highest salary.
Q40. Write a program to find the reverse of a string
A program to reverse a string
Iterate through the characters of the string from the last to the first
Append each character to a new string
Return the reversed string
Q41. What is infrastructure ?
Infrastructure refers to the basic physical and organizational structures needed for the operation of a society or enterprise.
Infrastructure includes roads, bridges, buildings, power grids, water supply systems, and communication networks.
It is essential for the functioning of a society or enterprise.
Infrastructure can be public or private.
Examples of public infrastructure include highways, airports, and public transportation systems.
Examples of private infrastructure include...read more
Top HR Questions asked in Persistent Systems for Freshers
Interview Process at Persistent Systems for Freshers

Top Interview Questions from Similar Companies








Reviews
Interviews
Salaries
Users/Month

