Persistent Systems
70+ Interview Questions and Answers
You are given two strings A and B. Find the index of the first occurrence of A in B. If A is not present in B, then return -1.
For Example:
A = “bc”, B = “abcddbc”. String “A” is present at ...read more
You are given a binary search tree of integers with N nodes. You are also given references to two nodes P and Q from this BST.
Your task is to find the lowest common ancestor(LCA) of these two given...read more
You have given a Singly Linked List of integers, determine if it forms a cycle or not.
A cycle occurs when a node's next points back to a previous node in the list. The li...read more
Given an array ARR of N integers and an integer S. The task is to find whether there exists a subarray(positive length) of the given array such that the sum of elements of the subarray eq...read more
Ninja is now bored with numbers and is now playing with characters but hates when he gets repeated characters. Ninja is provided a string, and he wants to return the first unique ch...read more
Write a query from an employee table to find the salaries of the employees having even emp -id number
Explain 2,3- tier architecture and explain vies in DBMS.
Explain serialization
Explain ACID prop...read more
Q7. 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
Q8. 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
Q9. 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
Q10. 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.
Q11. 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.
Q12. 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
Q13. 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.
Q14. 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
Q15. 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
Explain Thrashing .
Explain segmentation
State deadlock detection and prevention methods.
Explain dinning philosopher problem
Explain page fault with example.
Q17. 3 wheels & one scooter, each wheel can travel 5km. What will be the max distance that can be travelled?
The max distance that can be traveled is 15km.
Each wheel can travel 5km, so with 3 wheels, the total distance is 15km.
The scooter itself does not limit the distance that can be traveled, only the wheels do.
Q18. 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.
Q19. 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
Q20. 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.
Q21. How to sort the file in the range (hint provided)
Sorting a file within a range
Use a sorting algorithm like quicksort or mergesort
Read the file and store the data in an array or list
Sort the array or list within the given range
Write the sorted data back to the file
Q22. What is default values of variables?
Default values of variables are the initial values assigned to variables if no value is explicitly provided.
Default value for integer variables is 0
Default value for floating point variables is 0.0
Default value for boolean variables is false
Default value for string variables is null
Default value for arrays is null
Q23. 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
Q24. what is the difference between function overloading and function overriding?
Function overloading is having multiple functions with the same name but different parameters. Function overriding is having a function in a subclass with the same name and parameters as a function in the superclass.
Function overloading is a compile-time polymorphism concept.
Function overriding is a runtime polymorphism concept.
Function overloading is used to provide different implementations of the same function for different input parameters.
Function overriding is used to p...read more
Q25. Find the second largest element from an integer array in a single traversal
Find the second largest element from an integer array in a single traversal
Initialize two variables to store the largest and second largest elements
Traverse the array and update the variables accordingly
Return the second largest element
Q26. 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
Q27. which language was used in rocket launching software?
The language used in rocket launching software is typically Ada.
Ada is a high-level programming language designed for embedded systems and real-time applications.
Ada is known for its strong typing and safety features, making it suitable for critical systems like rocket launching software.
Q28. 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
Q29. 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
Q30. 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
Q31. 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
Q32. 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.
Q33. 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
Q34. Explain encapsulation & abstraction difference.
Encapsulation is bundling data and methods together, while abstraction is hiding the implementation details.
Encapsulation combines data and methods into a single unit (class).
Abstraction hides the complex implementation details and only shows the necessary features.
Encapsulation provides data security by restricting access to certain data members.
Abstraction allows for easier maintenance and modification of code.
Example: Encapsulation - a class with private data members and p...read more
Q35. 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
Q36. What are the recommendation systems you worked on?
I have worked on building recommendation systems for e-commerce websites and streaming platforms.
Implemented collaborative filtering algorithms to recommend products based on user behavior
Utilized content-based filtering to suggest movies or TV shows based on user preferences
Developed hybrid recommendation systems combining collaborative and content-based filtering techniques
Q37. Find 2nd largest element in an array where elements can be repeated. In O(n) complexity
Find 2nd largest element in an array with repeated elements in O(n) complexity.
Traverse the array once and keep track of the largest and second largest elements.
If the current element is greater than the largest element, update both largest and second largest elements.
If the current element is between the largest and second largest elements, update only the second largest element.
Q38. 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.
Q39. 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.
Q40. 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
Q41. What do you mean by cloud computing
Cloud computing refers to the delivery of computing services over the internet.
Cloud computing allows users to access data and applications from anywhere with an internet connection
It eliminates the need for physical servers and hardware, reducing costs and increasing scalability
Examples include Amazon Web Services, Microsoft Azure, and Google Cloud Platform
Q42. what is precompilaion unit?
Precompilation unit is a compiled code that can be reused by multiple source files.
Precompilation unit is created by the compiler from the source code.
It contains the compiled code of header files and other dependencies.
It can be reused by multiple source files, reducing compilation time.
It is also known as precompiled header or PCH.
Example: stdafx.h in Visual Studio is a precompiled header file.
Q43. 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
Q44. SQL - Find duplicate, Order BY Reverse a Linked List Real-life examples for Stack and Queues
SQL query to find duplicates, reversing a linked list, real-life examples of stacks and queues
To find duplicates in SQL, use GROUP BY and HAVING clauses
To reverse a linked list, iterate through the list and change the pointers
Stacks: back button in a web browser, undo feature in text editors
Queues: waiting in line at a grocery store, printer queue for printing documents
Q45. What is closure explain in detail with example
Closure is a function that has access to variables in its outer scope, even after the outer function has returned.
Closure is created when a function is defined inside another function.
The inner function can access variables in the outer function, even after the outer function has returned.
Closure can be used to create private variables and functions in JavaScript.
Example: function outer() { var x = 10; function inner() { console.log(x); } return inner; } var closure = outer()...read more
Q46. implement conditional hierarchical model for java class
Implementing a conditional hierarchical model for a Java class.
Create a Java class with multiple levels of hierarchy
Implement conditional statements to control the behavior of the class based on certain conditions
Use if-else or switch statements to define different actions for different conditions
Consider using interfaces or abstract classes for better abstraction and modularity
Q47. 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
Q48. What is copy assignment operator?
Copy assignment operator is a special member function in C++ that allows one object to be assigned the values of another object of the same class.
Copy assignment operator is denoted by the = operator.
It is used to copy the values of one object into another object of the same class.
It is automatically generated by the compiler if not explicitly defined.
Example: MyClass obj1; MyClass obj2; obj2 = obj1; // Copy assignment operator is called
Q49. explain any one of data structure you know
Binary Search Tree
A binary tree where each node has at most two children
Left child is less than parent, right child is greater
Allows for efficient searching, insertion, and deletion
Q50. What is a constructor in C++?
A constructor in C++ is a special member function that is automatically called when an object is created.
Constructors have the same name as the class and do not have a return type.
They can be used to initialize the object's data members.
Default constructors are automatically generated if no constructor is defined.
Parameterized constructors can be defined to accept arguments during object creation.
Q51. First 50 Prime Number
The first 50 prime numbers are...
Start with 2, the first prime number
Check each odd number greater than 2
Use trial division to check if a number is prime
Stop when you have found 50 prime numbers
Q52. 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
Q53. 2 programming code on any language of your choice
Two programming code examples in any language
Example 1: Python - print('Hello, World!')
Example 2: Java - System.out.println('Hello, World!')
Q54. What is virtualization in C++?
Virtualization in C++ is the process of creating a virtual version of a class or function to allow for polymorphism and dynamic binding.
Virtualization in C++ is achieved through the use of virtual functions and inheritance.
Virtual functions are declared in a base class and overridden in derived classes to provide different implementations.
Virtualization allows for polymorphism, where a pointer to a base class can point to objects of derived classes.
Dynamic binding is used to ...read more
Q55. What is smart pointers?
Smart pointers are objects that act like pointers but provide automatic memory management.
Smart pointers help prevent memory leaks by automatically deallocating memory when no longer needed.
Examples include unique_ptr, shared_ptr, and weak_ptr in C++.
They provide better memory safety compared to raw pointers.
Q56. Implement tree or queue data structure
A tree is a hierarchical data structure with nodes connected by edges. A queue is a linear data structure that follows the FIFO principle.
A tree can be implemented using linked lists or arrays.
A queue can be implemented using arrays or linked lists.
In a tree, each node can have multiple child nodes.
In a queue, elements are added at the rear and removed from the front.
Both data structures are commonly used in computer science and have various applications.
Q57. Gave two pattern codes to solve
I can provide solutions for pattern codes in software engineering interviews.
Understand the pattern and break it down into smaller components
Use loops and conditional statements to generate the desired pattern
Test the code with different inputs to ensure it works correctly
Q58. 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
Q59. Find count of each characters in string
The task is to count the occurrences of each character in a given string.
Iterate through the string and use a hashmap to store the count of each character
Convert the string to an array of characters for easier manipulation
Handle edge cases like empty string or null input
Consider using built-in functions like HashMap in Java or Counter in Python
Q60. Find Freq of words in a sentence
Use a hashmap to store word frequencies in a sentence.
Split the sentence into words using a space delimiter.
Create a hashmap to store word frequencies.
Iterate through the words and update the frequencies in the hashmap.
Return the hashmap with word frequencies.
Q61. difference between http and https.
HTTP is unsecured while HTTPS is secured with SSL/TLS encryption.
HTTP stands for Hypertext Transfer Protocol while HTTPS stands for Hypertext Transfer Protocol Secure.
HTTP operates on port 80 while HTTPS operates on port 443.
HTTP is vulnerable to attacks while HTTPS is secure due to SSL/TLS encryption.
HTTPS is indicated by a padlock icon in the browser's address bar.
HTTPS is used for secure online transactions such as online banking, e-commerce, etc.
Q62. What is array in. Python
An array in Python is a data structure that can hold multiple values of the same data type.
Arrays in Python are created using square brackets []
Elements in an array can be accessed using their index starting from 0
Example: names = ['Alice', 'Bob', 'Charlie']
Q63. Scenarios to implement code.
Scenarios for implementing code
Implementing a new feature
Fixing a bug
Optimizing code for performance
Refactoring existing code
Integrating with third-party APIs
Handling errors and exceptions
Writing unit tests
Adding new functionality to an existing system
Q64. Regex matcher problem
Regex matcher problem involves matching patterns in strings using regular expressions.
Understand the requirements of the regex pattern to be matched
Use tools like regex101.com to test and validate the regex pattern
Consider special characters and escape sequences in the regex pattern
Q65. Explain Data structures
Data structures are ways of organizing and storing data in a computer so that it can be accessed and used efficiently.
Data structures are used to manage and manipulate data in programs.
They can be implemented using arrays, linked lists, trees, graphs, and other techniques.
Examples include stacks, queues, hash tables, and binary search trees.
Choosing the right data structure for a particular problem can greatly improve program efficiency.
Q66. explain dml, ddl, tcl...
DML, DDL, and TCL are types of SQL commands used to manipulate databases.
DML (Data Manipulation Language) is used to manipulate data in a database, such as inserting, updating, and deleting records.
DDL (Data Definition Language) is used to define the structure of a database, such as creating tables, indexes, and constraints.
TCL (Transaction Control Language) is used to manage transactions in a database, such as committing or rolling back changes.
Examples of DML commands inclu...read more
Q67. Implement String class
Implement a custom String class in a programming language.
Define a class with necessary properties and methods to manipulate strings.
Include methods for concatenation, substring, length, etc.
Handle memory allocation and deallocation properly.
Example: class MyString { // implementation }
Q68. Difference between tuple,list
Tuple is immutable and ordered while list is mutable and ordered.
Tuple is defined using () while list is defined using []
Tuple cannot be modified while list can be modified
Tuple is faster than list for accessing elements
Tuple is used for fixed data while list is used for dynamic data
Example: tuple = (1, 2, 3) and list = [1, 2, 3]
Q69. OOPS concepts with examples
OOPS concepts are fundamental principles in object-oriented programming.
Encapsulation: bundling data and methods together in a class
Inheritance: creating new classes from existing ones
Polymorphism: using a single interface to represent different types
Abstraction: hiding complex implementation details
Example: A class 'Car' with properties like 'color' and methods like 'startEngine'
Q70. Internal Working of HashMap
HashMap is a data structure that stores key-value pairs and uses hashing to quickly retrieve values based on keys.
HashMap internally uses an array of linked lists to store key-value pairs.
When a key-value pair is added, the key is hashed to determine the index in the array where it will be stored.
If multiple keys hash to the same index, a linked list is used to handle collisions.
To retrieve a value, the key is hashed again to find the corresponding index and then the linked l...read more
Q71. Joins in SQL ?
Joins in SQL are used to combine rows from two or more tables based on a related column between them.
Joins are used to retrieve data from multiple tables based on a related column
Common types of joins include INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL JOIN
INNER JOIN returns rows when there is at least one match in both tables
LEFT JOIN returns all rows from the left table and the matched rows from the right table
RIGHT JOIN returns all rows from the right table and the matched...read more
Q72. Pillars of OOP ?
Pillars of OOP are Inheritance, Encapsulation, Abstraction, and Polymorphism.
Inheritance allows a class to inherit properties and behavior from another class.
Encapsulation restricts access to certain components of an object, protecting its integrity.
Abstraction hides complex implementation details and only shows the necessary features.
Polymorphism allows objects to be treated as instances of their parent class or their own class.
Q73. 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
Q74. 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
Q75. 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;
Top HR Questions asked in null
Interview Process at null
Top Software Engineer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month