
PayPal


30+ PayPal Interview Questions and Answers for Freshers
Q1. 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.
Q2. Cycle Detection in Undirected Graph Problem Statement
You are provided with an undirected graph containing 'N' vertices and 'M' edges. The vertices are numbered from 1 to 'N'. Your objective is to determine whe...read more
Detect cycles in an undirected graph with given vertices and edges.
Use Depth First Search (DFS) to traverse the graph and detect cycles.
Maintain a visited array to keep track of visited vertices and a parent array to keep track of the parent of each vertex.
If while traversing, you encounter a visited vertex that is not the parent of the current vertex, then a cycle exists.
Consider edge cases like disconnected graphs and self-loops.
Q3. 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
Implement Merge Sort algorithm to sort a sequence of numbers in non-descending order.
Implement the Merge Sort algorithm using a Divide and Conquer approach
Recursively divide the input array into two halves until the size of each array is 1
Merge the sorted halves to produce a completely sorted array
Ensure the output is in non-descending order
Q4. Palindrome Partitioning II Problem Statement
Given a string ‘str’, find the minimum number of partitions needed such that every segment of the string is a palindrome.
The task is to make cuts in the string to p...read more
Find the minimum number of partitions needed in a string such that every segment is a palindrome.
Iterate through the string and check for palindromes at each possible partition point.
Use dynamic programming to keep track of the minimum cuts needed.
Consider edge cases where the string is already a palindrome or consists of different characters only.
Q5. Maximum Difference Problem Statement
Given an array ARR
of N
elements, your task is to find the maximum difference between any two elements in ARR
.
If the maximum difference is even, print EVEN; if it is odd, p...read more
Find the maximum difference between any two elements in an array and determine if it is even or odd.
Iterate through the array to find the maximum and minimum elements
Calculate the difference between the maximum and minimum elements
Check if the difference is even or odd and return the result
Q6. DFS Traversal Problem Statement
Given an undirected and disconnected graph G(V, E)
, where V
is the number of vertices and E
is the number of edges, the connections between vertices are provided in the 'GRAPH' m...read more
DFS traversal problem on an undirected and disconnected graph to find connected components.
Perform Depth First Search (DFS) on each vertex to find connected components
Use a visited array to keep track of visited vertices
Print the number of connected components and list vertices in ascending order for each component
Hashing is a process of converting input data into a fixed-size string of bytes using a hash function.
Hashing is used to securely store passwords by converting them into a hash value before storing in a database.
Hashing is used in data structures like hash tables to quickly retrieve data based on a key.
Common hash functions include MD5, SHA-1, and SHA-256.
Hashing can be implemented in programming languages like Python using libraries like hashlib.
Q8. find the and return if the given file path existing in the given file hierarcy(file system).
Check if a given file path exists in the file system hierarchy and return the result.
Use file system APIs to check if the given file path exists in the hierarchy.
Traverse the file system hierarchy starting from the root directory to find the given file path.
Return true if the file path exists, false otherwise.
Q9. How is MongoDB scalable?
MongoDB is scalable due to its ability to horizontally partition data across multiple servers.
MongoDB uses sharding to distribute data across multiple servers.
Sharding allows for horizontal scaling by adding more servers to the cluster.
MongoDB also supports replica sets for high availability and fault tolerance.
Indexes can be created on any field in a MongoDB document, allowing for efficient querying of large datasets.
Q10. Kth Largest Element Problem
Given an array containing N
distinct positive integers and a number K
, determine the Kth largest element in the array.
Example:
Input:
N = 6, K = 3, array = [2, 1, 5, 6, 3, 8]
Output...read more
Find the Kth largest element in an array of distinct positive integers.
Sort the array in non-increasing order and return the Kth element.
Handle multiple test cases efficiently.
Ensure all elements in the array are distinct.
Q11. Delete a Node from a Linked List
You are provided with a linked list of integers. Your task is to implement a function that deletes a node located at a specified position 'POS'.
Input:
The first line contains a...read more
Implement a function to delete a node from a linked list at a specified position.
Traverse the linked list to find the node at the specified position.
Update the pointers of the previous and next nodes to skip the node to be deleted.
Handle edge cases such as deleting the head or tail of the linked list.
Ensure to free the memory of the deleted node to avoid memory leaks.
Q12. Reverse the String Problem Statement
You are given a string STR
which contains alphabets, numbers, and special characters. Your task is to reverse the string.
Example:
Input:
STR = "abcde"
Output:
"edcba"
Input...read more
Reverse a given string containing alphabets, numbers, and special characters.
Iterate through the string from the end to the beginning and append each character to a new string.
Use built-in functions like reverse() or slicing to reverse the string.
Handle special characters and numbers while reversing the string.
Ensure to consider the constraints on the input string length and number of test cases.
Q13. One Away Transformation Problem
Given two strings, A
and B
, determine whether A
can be transformed into B
by performing at most one of the following operations (including zero operations):
1. Delete a character...read more
Determine if one string can be transformed into another by performing at most one operation (insert, delete, replace).
Iterate through both strings simultaneously and check for differences.
Handle cases where a character needs to be inserted, deleted, or replaced.
Keep track of the number of operations performed and ensure it does not exceed one.
You can find a defective ball among 10 given balls in 2 attempts using a two-pan balance scale.
Divide the 10 balls into two groups of 5 each.
Weigh the two groups on the balance scale.
If one group is heavier, it contains the defective ball. If they are equal, the defective ball is in the remaining 5 balls.
Divide the group of 5 balls with the defective one into two groups of 2 and 3 balls.
Weigh the two groups on the balance scale.
If one group is heavier, it contains the defecti...read more
Q15. Remove Duplicates from String Problem Statement
You are provided a string STR
of length N
, consisting solely of lowercase English letters.
Your task is to remove all duplicate occurrences of characters in the s...read more
Remove duplicate occurrences of characters in a given string.
Use a hash set to keep track of characters seen so far.
Iterate through the string and add non-duplicate characters to a new string.
Return the new string without duplicate characters.
OOP is a programming paradigm based on the concept of objects, which can contain data in the form of fields and code in the form of procedures.
OOP focuses on creating objects that interact with each other to solve problems.
Key concepts include encapsulation, inheritance, and polymorphism.
Encapsulation involves bundling data and methods that operate on the data into a single unit.
Inheritance allows classes to inherit attributes and methods from other classes.
Polymorphism enabl...read more
Q17. Dijkstra's Shortest Path Problem
Given an undirected graph with ‘V’ vertices (labeled 0, 1, ... , V-1) and ‘E’ edges, where each edge has a weight representing the distance between two connected nodes (X, Y).
Y...read more
Dijkstra's algorithm is used to find the shortest path from a source node to all other nodes in a graph with weighted edges.
Implement Dijkstra's algorithm to find the shortest path distances from the source node to all other nodes.
Use a priority queue to efficiently select the next node with the shortest distance.
Update the distances of neighboring nodes based on the current node's distance and edge weights.
Handle disconnected vertices by assigning a large value (e.g., 214748...read more
Q18. How many A4 sheets are sold in India per day?
It is impossible to accurately determine the number of A4 sheets sold in India per day.
There is no centralized data on the sales of A4 sheets in India.
The number of A4 sheets sold can vary greatly depending on the region and industry.
Factors such as digitalization and environmental concerns may also impact sales.
Estimates or projections may be available from specific companies or industries.
Market research firms may have data on the overall paper market in India.
SQL query to find the nth highest salary
Use the ORDER BY clause to sort salaries in descending order
Use the LIMIT and OFFSET clauses to skip the first n-1 highest salaries
Combine the above steps in a single query to find the nth highest salary
Design a Cinema Ticket Reservation System
Use a database to store movie information, showtimes, and seat availability
Allow users to search for movies, select showtimes, and choose seats
Implement a payment system for ticket purchases
Send confirmation emails with QR codes for ticket validation
Virtual functions are functions in a base class that are overridden in derived classes to achieve runtime polymorphism.
Virtual functions are declared in a base class with the 'virtual' keyword.
They are overridden in derived classes using the 'override' keyword.
They allow a function to be called based on the runtime type of an object.
Virtual functions enable dynamic binding and late binding in C++.
Example: virtual void display() = 0; in base class and void display() override {...read more
Stack is used for static memory allocation and stores local variables, while Heap is used for dynamic memory allocation and stores objects.
Stack is faster than Heap as it has a fixed size and memory allocation is done at compile time.
Heap is slower than Stack as memory allocation is done at runtime and requires more complex management.
Stack memory is limited and typically smaller in size, while Heap memory is larger and can grow as needed.
Objects in OOP are typically stored i...read more
To measure exactly 15 minutes using two hourglasses of 7 and 11 minutes, start both hourglasses together and then flip the 7-minute hourglass when it runs out.
Start both hourglasses at the same time.
When the 7-minute hourglass runs out, flip it immediately.
When the 11-minute hourglass runs out, 4 minutes will have passed on the 7-minute hourglass. This gives a total of 15 minutes.
Q24. A recursive program to print numbers in ascending order
A recursive program to print numbers in ascending order
Use a recursive function that takes a starting number and an ending number as parameters
Print the starting number and recursively call the function with starting number + 1 and the same ending number
Base case: stop recursion when starting number is greater than ending number
Query to find the nth highest salary from a database
Use the ORDER BY clause to sort salaries in descending order
Use the LIMIT clause to select the nth highest salary
Consider handling cases where there may be ties for the nth highest salary
malloc is a function in C for dynamic memory allocation, while new is an operator in C++ for dynamic memory allocation and object creation.
malloc is a function in C, while new is an operator in C++.
malloc returns a void pointer, while new returns a pointer to the type being allocated.
malloc does not call constructors, while new calls constructors for object initialization.
malloc requires manual memory deallocation with free, while new automatically calls the destructor and de...read more
C is a procedural programming language while C++ is an object-oriented programming language with features like classes and inheritance.
C is a procedural programming language, while C++ is a multi-paradigm language with support for object-oriented programming.
C does not support classes and objects, while C++ does.
C does not have features like inheritance and polymorphism, which are present in C++.
C is a subset of C++, meaning that C++ includes all of C's features and adds new ...read more
A virtual function is a function in a base class that is declared using the keyword 'virtual' and can be overridden by a function with the same signature in a derived class.
Virtual functions allow for dynamic polymorphism in C++
They are used in inheritance to achieve runtime polymorphism
Example: virtual void display() = 0; in a base class and void display() override in a derived class
Q29. Any suggestions for Paypal or Ebay website?
Q30. Projects in CS
Projects in computer science involve developing software applications, algorithms, databases, and systems to solve various problems.
Developing software applications for specific purposes
Creating algorithms to optimize processes or solve complex problems
Designing databases to store and manage large amounts of data
Building systems to automate tasks or improve efficiency
Top HR Questions asked in PayPal for Freshers
Interview Process at PayPal for Freshers

Top Interview Questions from Similar Companies








Reviews
Interviews
Salaries
Users/Month

