Salesforce
20+ GEM Hospital And Research Center Interview Questions and Answers
Q1. How will you handle cases with customers of bad temeament?
I will remain calm, empathetic, and professional while actively listening to the customer's concerns and finding a solution.
Remain calm and composed
Listen actively to understand the customer's concerns
Show empathy towards the customer's frustrations
Maintain a professional demeanor throughout the interaction
Focus on finding a solution to the customer's issue
Avoid taking the customer's behavior personally
Q2. Ajax and asynchronous functions in JavaScript
Ajax allows for asynchronous communication between the client and server in JavaScript.
Ajax stands for Asynchronous JavaScript and XML.
It allows for making requests to the server without reloading the entire page.
Asynchronous functions in JavaScript allow for non-blocking code execution.
Examples of asynchronous functions include setTimeout, setInterval, and fetch API.
Q3. Buy and Sell Stock Problem Statement
Imagine you are Harshad Mehta's friend, and you have been given the stock prices of a particular company for the next 'N' days. You can perform up to two buy-and-sell transa...read more
The task is to determine the maximum profit that can be achieved by performing up to two buy-and-sell transactions on a given set of stock prices.
Iterate through the array of stock prices to find the maximum profit that can be achieved by buying and selling stocks at different points.
Keep track of the maximum profit that can be achieved by considering all possible combinations of buy and sell transactions.
Ensure that you sell the stock before buying again to adhere to the con...read more
Q4. Optimal Strategy for a Coin Game
You are playing a coin game with your friend Ninjax. There are N
coins placed in a straight line.
Here are the rules of the game:
1. Each coin has a value associated with it.
2....read more
The problem involves finding the optimal strategy to accumulate the maximum amount in a coin game with specific rules.
Start by considering the base cases where there are only 1 or 2 coins.
Use dynamic programming to keep track of the maximum amount that can be won at each step.
Consider the different scenarios when choosing a coin from either end of the line.
Keep track of the total winnings for both players and choose the optimal strategy to maximize your winnings.
Implement a r...read more
Q5. Spiral Matrix Problem Statement
You are given a N x M
matrix of integers. Your task is to return the spiral path of the matrix elements.
Input
The first line contains an integer 'T' which denotes the number of ...read more
The task is to return the spiral path of elements in a given matrix.
Iterate through the matrix in a spiral path by keeping track of boundaries.
Print elements in the order of top row, right column, bottom row, and left column.
Continue the spiral path until all elements are printed.
Q6. 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 pointer 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, there is a cycle in the linked list.
Use Floyd's Cycle Detection Algorithm for efficient detection of cycles in linked lists.
Q7. Minimum Swaps to Sort Array Problem Statement
Given an array arr
of size N
, determine the minimum number of swaps required to sort the array in ascending order. The array consists of distinct elements only.
Exa...read more
The minimum number of swaps required to sort an array of distinct elements in ascending order.
Use a hashmap to store the index of each element in the array.
Iterate through the array and swap elements to their correct positions.
Count the number of swaps needed to sort the array.
Q8. Factorial Trailing Zeros Problem
You are provided with a positive integer N. Your goal is to determine the smallest number whose factorial has at least N trailing zeros.
Example:
Input:
N = 1
Output:
5
Explanat...read more
Find the smallest number whose factorial has at least N trailing zeros.
Calculate the number of 5's in the prime factorization of the factorial to determine the trailing zeros.
Use binary search to find the smallest number with at least N trailing zeros.
Consider edge cases like N = 0 or N = 1 for factorial trailing zeros problem.
Q9. Combination Sum Problem Statement
Given three integers X
, Y
, and Z
, calculate the sum of all numbers that can be formed using the digits 3, 4, and 5. Each digit can be used up to a maximum of X
, Y
, and Z
times ...read more
Calculate the sum of all numbers that can be formed using the digits 3, 4, and 5 with given constraints.
Iterate through all possible combinations of 3, 4, and 5 based on the given constraints.
Calculate the sum of each combination and add them up.
Return the final sum modulo 10^9 + 7.
Q10. Reverse Linked List Problem Statement
Given a singly linked list of integers, your task is to return the head of the reversed linked list.
Example:
Input:
The given linked list is 1 -> 2 -> 3 -> 4 -> NULL.
Outp...read more
To reverse a singly linked list of integers, return the head of the reversed linked list.
Iterate through the linked list, reversing the pointers to point to the previous node instead of the next node.
Keep track of the previous, current, and next nodes while traversing the list.
Update the head of the reversed linked list to be the last element of the original list.
Q11. Longest Path In Directed Graph Problem Statement
Given a Weighted Directed Acyclic Graph (DAG) comprising 'N' nodes and 'E' directed edges, where nodes are numbered from 0 to N-1, and a source node 'Src'. Your ...read more
The task is to find the longest distances from a source node to all nodes in a weighted directed acyclic graph.
Implement a function that takes the number of nodes, edges, source node, and edge weights as input.
Use a topological sorting algorithm to traverse the graph and calculate the longest distances.
Return an array of integers where each element represents the longest distance from the source node to the corresponding node.
Q12. Largest BST Subtree Problem
Given a binary tree with 'N' nodes, determine the size of the largest subtree that is also a BST (Binary Search Tree).
Input:
The first line contains an integer 'T', representing the...read more
The problem involves finding the size of the largest subtree that is also a Binary Search Tree in a given binary tree.
Traverse the binary tree in a bottom-up manner to check if each subtree is a BST.
Keep track of the size of the largest BST subtree encountered so far.
Use recursion to solve the problem efficiently.
Consider edge cases like empty tree or single node tree.
Example: For input 1 2 3 4 -1 5 6 -1 7 -1 -1 -1 -1 -1 -1, the largest BST subtree has size 3.
Q13. Implementing a Priority Queue Using Heap
Ninja has been tasked with implementing a priority queue using a heap data structure. However, he is currently busy preparing for a tournament and has requested your ass...read more
Implement a priority queue using a heap data structure by completing the provided functions: push(), pop(), getMaxElement(), and isEmpty().
Understand the operations: push() to insert element, pop() to remove largest element, getMaxElement() to return largest element, and isEmpty() to check if queue is empty.
Implement a heap data structure to maintain the priority queue.
Handle different types of queries based on the input provided.
Ensure correct output for each type 3 query.
Te...read more
Q14. Ninja and Chocolates Problem Statement
Ninja is hungry and wants to eat his favorite chocolates, but his mother won't let him because he has already eaten enough. There are 'N' jars filled with chocolates. His ...read more
Find the minimum eating speed required for a ninja to consume all chocolates within a given time limit.
Iterate through possible eating speeds to find the minimum speed that allows the ninja to consume all chocolates within the given time limit.
Calculate the total number of chocolates to be consumed and divide it by the time limit to get the minimum eating speed.
Handle cases where a jar has fewer chocolates than the eating speed by consuming all available chocolates from that ...read more
Q15. Construct the Lexicographically Largest Valid Sequence
You are provided with a positive integer N. The goal is to generate the lexicographically largest sequence of length 2*N - 1, containing integers ranging f...read more
Generate lexicographically largest valid sequence of length 2*N - 1 with specific constraints.
Start with the largest numbers and place them at the ends to maximize lexicographical order.
Place the number 1 in the middle to satisfy the condition of appearing exactly once.
Determine the positions of other numbers based on their distance requirements.
Iterate through the sequence and fill in the numbers based on the constraints.
Ensure that each number from 2 to N appears exactly tw...read more
Q16. Zuma Game Problem Statement
You have a string of balls on the table called BOARD
and several balls in your hand represented by the string hand
. The balls can be of the colors red(R), blue(B), green(G), white(W)...read more
Determine the minimum number of insertions required to empty the board in Zuma game problem.
Check if it's possible to empty the board by trying all possible combinations of inserting balls from hand.
Use backtracking algorithm to simulate the game and find the minimum number of insertions required.
Handle edge cases like when the board cannot be emptied or when the hand is empty.
Consider optimizing the algorithm by pruning branches that cannot lead to a solution.
Example: For BO...read more
Virtual functions can be overridden in derived classes, while abstract classes cannot be instantiated directly.
Virtual functions are declared using the 'virtual' keyword and can be overridden in derived classes.
Abstract classes cannot be instantiated and may contain one or more pure virtual functions.
An abstract class can have virtual functions, but a virtual function does not make a class abstract.
Example: Shape is an abstract class with a pure virtual function 'calculateAre...read more
Design a platform similar to LinkedIn with key features and architecture
Key Features: user profiles, connections, job postings, messaging, news feed, groups
Architecture: microservices, cloud storage, scalable database, AI for recommendations
Security: encryption, secure authentication, data privacy controls
User Experience: intuitive UI/UX, mobile app support, notifications
Monetization: premium subscriptions, advertising, job posting fees
Design a system similar to Splitwise and suggest three features for improvement.
Implement a real-time notification system for updates on shared expenses
Integrate a feature for automatic currency conversion for international transactions
Enhance the user interface with data visualization tools for better expense tracking
Q20. Tell me about Asynchronous Apex? Difference between Batch Apex and Queueable Apex
Asynchronous Apex allows you to run processes in the background, without user interaction. Batch Apex and Queueable Apex are two types of Asynchronous Apex.
Asynchronous Apex allows you to process large amounts of data asynchronously, without impacting the user interface.
Batch Apex is used to process large data sets that can be divided into smaller batches for processing.
Queueable Apex allows you to submit jobs for asynchronous processing, similar to future methods but with mo...read more
Q21. Explain Future method? and why we need (Callout= true) along with that annotation?
Future method is used to run code asynchronously. Callout=true is needed to make HTTP callouts from future methods.
Future methods are used to run code asynchronously in Salesforce.
They are annotated with @future annotation.
Callout=true is needed to make HTTP callouts from future methods.
Without Callout=true, making HTTP callouts from future methods is not allowed.
HTML5 elements that support media content include <audio>, <video>, and <source>.
<audio> element for audio content
<video> element for video content
<source> element for specifying multiple media resources for <video> and <audio> elements
Q23. Can you explain about Platform Events?
Platform Events are a feature in Salesforce that allow developers to deliver secure, scalable, and customizable event notifications.
Platform Events are based on the publish-subscribe model, where publishers send events and subscribers receive them.
They are used to communicate changes in Salesforce data or custom events within an organization.
Developers can define custom event objects and trigger events using Apex or declaratively through Process Builder or Flow.
Subscribers ca...read more
To reduce page loading time, optimize images, minify CSS and JS files, enable browser caching, use a content delivery network (CDN), and reduce server response time.
Optimize images by reducing file size without compromising quality
Minify CSS and JS files to reduce their size and improve loading speed
Enable browser caching to store static resources locally for faster access
Use a content delivery network (CDN) to distribute content across multiple servers closer to the user
Redu...read more
Q25. Data Security in Salesforce and types in it.
Data security in Salesforce involves various types of security measures to protect sensitive information.
Salesforce provides various security features such as user authentication, data encryption, and access controls.
Types of data security in Salesforce include object-level security, field-level security, and record-level security.
Salesforce also offers tools like Salesforce Shield for enhanced data security and compliance.
Regular security audits and monitoring help ensure da...read more
More about working at Salesforce
Top HR Questions asked in GEM Hospital And Research Center
Interview Process at GEM Hospital And Research Center
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month