Extended Technical, SQL & Case Study Interview
Preparation
This guide contains additional coding challenges with C++ solutions, SQL interview problems, and
case study scenarios with structured answers. It serves as a comprehensive mock interview
preparation resource.
Q1. Check if a String is a Palindrome
Input: madam
Output: True
C++ Solution:
#include
using namespace std;
bool isPalindrome(string s) {
int l=0, r=s.size()-1;
while(l if(s[l]!=s[r]) return false;
l++; r--;
}
return true;
}
int main() {
cout << (isPalindrome("madam") ? "True" : "False"); // Output: True
}
Q2. Find the Missing Number in an Array (1 to n)
Input: [1,2,4,5]
Output: 3
C++ Solution:
#include
using namespace std;
int missingNumber(vector& arr, int n){
int sum = n*(n+1)/2;
int actual = accumulate(arr.begin(), arr.end(), 0);
return sum-actual;
}
int main(){
vector arr={1,2,4,5};
cout<}
Q3. Implement Binary Search
Input: [1,3,5,7,9], key=7
Output: Found at index 3
C++ Solution:
#include
using namespace std;
int binarySearch(vector& arr, int key){
int l=0, r=arr.size()-1;
while(l<=r){
int mid=(l+r)/2;
if(arr[mid]==key) return mid;
else if(arr[mid] else r=mid-1;
}
return -1;
}
int main(){
vector arr={1,3,5,7,9};
cout<}
Q4. Retrieve the Top 3 Highest Salaries from Employee Table
SQL Solution:
SELECT DISTINCT salary
FROM Employee e1
WHERE 3 > (SELECT COUNT(DISTINCT salary) FROM Employee e2 WHERE e2.salary >
e1.salary)
ORDER BY salary DESC;
Q5. Find Employees who joined in the last 6 months
SQL Solution:
SELECT employee_name, joining_date
FROM Employee
WHERE joining_date >= DATEADD(MONTH, -6, GETDATE());
Q6. Count number of employees in each department
SQL Solution:
SELECT d.department_name, COUNT(e.employee_id) as total_employees
FROM Department d
LEFT JOIN Employee e ON d.id = e.department_id
GROUP BY d.department_name;
Q7. Get Employees with Salary greater than Department Average
SQL Solution:
SELECT e.employee_name, e.salary, d.department_name
FROM Employee e
JOIN Department d ON e.department_id = d.id
WHERE e.salary > (SELECT AVG(salary) FROM Employee WHERE department_id =
e.department_id);
Case Study 1: Bank Transaction Fraud Detection
Problem: A bank wants to improve transaction speed & reduce fraud. Solution Approach: - Use
cloud-native databases for high-speed transactions. - Apply AI/ML for anomaly detection in real
time. - Deploy serverless functions for fraud alerts within milliseconds. - Provide dashboards for
compliance and monitoring.
Case Study 2: University Online Exam Portal (50k+ users)
Problem: University needs an online exam platform handling 50k concurrent users. Solution
Approach: - Use auto-scaling cloud servers to handle traffic spikes. - Store exam data in secure,
encrypted databases. - Implement CDN for faster content delivery. - Add multi-factor authentication
for student logins.
Case Study 3: Healthcare Patient Records Security
Problem: Healthcare company wants secure patient record storage. Solution Approach: - Adopt
Private/Hybrid Cloud to meet HIPAA/GDPR compliance. - Encrypt sensitive data both in transit and
at rest. - Implement role-based access controls for doctors/nurses/admins. - Use automated
backups with disaster recovery planning.
Case Study 4: Retail Chain Cloud Cost Optimization
Problem: A retail chain has rising cloud costs after migration. Solution Approach: - Right-size
resources by analyzing workloads. - Use reserved instances for predictable demand. - Apply
auto-scaling and serverless architecture for peak traffic. - Monitor bills with cost management tools
(AWS Cost Explorer).