Top 60 Zoho Coding Questions and Answers (2025)
Zoho Corporation is a leading software company known for its cloud-based business solutions, CRM software, and enterprise tools. With a strong focus on innovation, Zoho hires skilled developers through a structured coding interview process. Candidates must demonstrate expertise in data structures, algorithms, SQL, and problem-solving to secure a role at Zoho. In this blog, we will cover Zoho coding questions and answers, categorized by experience level, to help you prepare for Zoho’s interview rounds with confidence.
Zoho Coding Interview Questions and Answers for Freshers
Zoho hires freshers for roles such as software developers, system engineers, and product engineers. For this level, candidates are expected to have a strong foundation in data structures, algorithms, and problem-solving techniques. The salary for entry-level job positions typically ranges from ₹6 LPA to ₹10 LPA, depending on skills and interview performance. Basic programming questions on arrays, strings, and recursion are common in fresher-level interviews. Here are the Zoho coding interview questions and answers for freshers:
Zoho Python-Based Coding Questions and Answers for Freshers
Here are the most commonly asked Python-based Zoho coding interview questions and answers for freshers, which test problem-solving skills, data structures, and algorithmic thinking.
Q1. How to reverse a string in Python?
Sample Answer: Reversing a string is a common operation in programming. In Python, we can achieve this efficiently using slicing. The method below takes a string as input and returns its reverse.
def reverse_string(s):
return s[::-1]
# Example usage:
input_str = "hello"
print(reverse_string(input_str)) # Output: "olleh"


Q2. How to check if a given string is a palindrome in Python?
Sample Answer: A palindrome is a word, phrase, or sequence that reads the same forward and backward. This function checks if a string is a palindrome by comparing it to its reverse:
def is_palindrome(s):
return s == s[::-1]
# Example usage:
input_str = "radar"
print(is_palindrome(input_str)) # Output: True
Q3. How to find the factorial of a number in Python?
Sample Answer: The factorial of a number is the product of all positive integers from 1 to that number. The function below uses recursion to compute the factorial.
def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n - 1)
# Example usage:
num = 5
print(factorial(num)) # Output: 120
Pro Tip: If you’re preparing for Zoho’s coding interview, enroll in a Python course to master OOP, data structures, and algorithms. The right practice, including Zoho’s past coding questions, can significantly boost your chances!
Q4. How to generate a Fibonacci sequence up to a given number of terms in Python?
Sample Answer: The Fibonacci sequence is a series of numbers where each number is the sum of the two preceding ones. This function generates the first n terms of the sequence.
def fibonacci(n):
sequence = [0, 1]
while len(sequence) < n:
sequence.append(sequence[-1] + sequence[-2])
return sequence[:n]
# Example usage:
num_terms = 7
print(fibonacci(num_terms)) # Output: [0, 1, 1, 2, 3, 5, 8]
Q5. How to check if a number is an Armstrong number in Python?
Sample Answer: An Armstrong number is a number that is equal to the sum of its own digits, each raised to the power of the number of digits. This function verifies if a given number is an Armstrong number.
def is_armstrong_number(n):
num_str = str(n)
num_len = len(num_str)
sum_of_powers = sum(int(digit) ** num_len for digit in num_str)
return n == sum_of_powers
# Example usage:
num = 153
print(is_armstrong_number(num)) # Output: True
Zoho Java-Based Coding Questions and Answers for Freshers
Here are essential Java Zoho coding interview questions and answers for freshers that focus on object-oriented programming in Java, data handling, and algorithmic problem-solving in the Zoho interview question and answer round.
Q6. How to reverse a string in Java?
Sample Answer: String reversal is a basic operation that can be performed using StringBuilder in Java. The method below reverses a given string.
public class ReverseString {
public static String reverse(String s) {
return new StringBuilder(s).reverse().toString();
}
public static void main(String[] args) {
String input = "hello";
System.out.println(reverse(input)); // Output: "olleh"
}
}
Q7. How to check if a string is a palindrome in Java?
Sample Answer: A palindrome is a word that remains the same when reversed. This Java method checks if a given string is a palindrome.
public class PalindromeCheck {
public static boolean isPalindrome(String s) {
String reversed = new StringBuilder(s).reverse().toString();
return s.equals(reversed);
}
public static void main(String[] args) {
String input = "radar";
System.out.println(isPalindrome(input)); // Output: true
}
}
Q8. How to find the factorial of a number using recursion in Java?
Sample Answer: Factorial calculation is commonly used in mathematical computations. The recursive function below calculates the factorial of a given number.
public class Factorial {
public static int factorial(int n) {
if (n == 0) {
return 1;
} else {
return n * factorial(n - 1);
}
}
public static void main(String[] args) {
int num = 5;
System.out.println(factorial(num)); // Output: 120
}
}
Pro Tip: Enroll in a Java course to master OOP, multithreading, and exception handling. Strengthen your grasp of data structures and algorithms and practice Zoho’s past coding questions to boost your chances in the interview round.
Q9. How to generate a Fibonacci sequence in Java?
Sample Answer: The Fibonacci sequence is generated by summing the last two numbers in the series. The method below generates the sequence up to n terms.
import java.util.ArrayList;
import java.util.List;
public class FibonacciSequence {
public static List<Integer> fibonacci(int n) {
List<Integer> sequence = new ArrayList<>();
sequence.add(0);
sequence.add(1);
for (int i = 2; i < n; i++) {
sequence.add(sequence.get(i - 1) + sequence.get(i - 2));
}
return sequence.subList(0, n);
}
public static void main(String[] args) {
int numTerms = 7;
System.out.println(fibonacci(numTerms)); // Output: [0, 1, 1, 2, 3, 5, 8]
}
}
Q10. How to check if a number is an Armstrong number in Java?
Sample Answer: An Armstrong number is a number that equals the sum of its digits, each raised to the power of the total number of digits. This function determines whether a number is an Armstrong number.
public class ArmstrongNumber {
public static boolean isArmstrongNumber(int n) {
String numStr = Integer.toString(n);
int numLen = numStr.length();
int sumOfPowers = 0;
for (char c : numStr.toCharArray()) {
sumOfPowers += Math.pow(Character.getNumericValue(c), numLen);
}
return n == sumOfPowers;
}
public static void main(String[] args) {
int num = 153;
System.out.println(isArmstrongNumber(num)); // Output: true
}
}
Zoho C and C++ Coding Questions and Answers for Freshers
Here are key C and C++ coding questions asked in Zoho interviews for freshers, assessing memory management, pointers, and efficient algorithm design.
Q11. How to reverse a string in C?
Sample Answer: String reversal is a common operation in text processing. Since C does not have built-in string manipulation functions like Python or Java, we use a manual swapping approach. The function below reverses a given string by swapping characters from both ends.
#include <stdio.h>
#include <string.h>
void reverseString(char *str) {
int len = strlen(str);
for (int i = 0; i < len / 2; i++) {
char temp = str[i];
str[i] = str[len - i - 1];
str[len - i - 1] = temp;
}
}
int main() {
char str[] = "hello";
reverseString(str);
printf("%s", str); // Output: "olleh"
return 0;
}
Q12. How to check if a string is a palindrome in C?
Sample Answer: A palindrome is a word or number that remains unchanged when reversed. In C, we check for palindromes by comparing characters from both ends of the string. The function below performs this check efficiently.
#include <stdio.h>
#include <string.h>
int isPalindrome(char *str) {
int len = strlen(str);
for (int i = 0; i < len / 2; i++) {
if (str[i] != str[len - i - 1]) {
return 0;
}
}
return 1;
}
int main() {
char str[] = "radar";
printf("%s", isPalindrome(str) ? "True" : "False"); // Output: True
return 0;
}
Q13. How to find the factorial of a number in C?
Sample Answer: Factorial calculation is used in mathematical computations and combinatorics. The factorial of n is the product of all numbers from 1 to n. This function uses recursion to compute it.
#include <stdio.h>
int factorial(int n) {
return (n == 0) ? 1 : n * factorial(n - 1);
}
int main() {
int num = 5;
printf("%d", factorial(num)); // Output: 120
return 0;
}
Q14. How to generate a Fibonacci sequence in C?
Sample Answer: The Fibonacci sequence starts with 0 and 1, and each subsequent number is the sum of the previous two. This function prints the sequence up to n terms.
#include <stdio.h>
void fibonacci(int n) {
int a = 0, b = 1, next;
for (int i = 0; i < n; i++) {
printf("%d ", a);
next = a + b;
a = b;
b = next;
}
}
int main() {
int num_terms = 7;
fibonacci(num_terms); // Output: 0 1 1 2 3 5 8
return 0;
}
Q15. How to check if a number is an Armstrong number in C?
Sample Answer: An Armstrong number equals the sum of its digits raised to the power of the number of digits. The function below checks if a number is Armstrong.
#include <stdio.h>
#include <math.h>
int isArmstrong(int n) {
int temp = n, sum = 0, digits = 0;
while (temp > 0) {
digits++;
temp /= 10;
}
temp = n;
while (temp > 0) {
int digit = temp % 10;
sum += pow(digit, digits);
temp /= 10;
}
return sum == n;
}
int main() {
int num = 153;
printf("%s", isArmstrong(num) ? "True" : "False"); // Output: True
return 0;
}
Pro Tip: If you’re preparing for Zoho’s coding interview, enroll in a C and C++ course to master OOP, data structures, and algorithms. The right practice, including Zoho’s past coding questions, can give you an edge.
Zoho SQL-Based Coding Interview Questions and Answers for Freshers
Here are frequently asked SQL-based Zoho coding questions and answers for freshers, covering database queries, joins, subqueries, and data optimization techniques.
Q16. How do you select the top 3 highest salaries from an Employee table in SQL?
Sample Answer: Finding the top 3 salaries helps in analyzing the highest-paid employees. The query below retrieves the top 3 salaries from the Employee table.
SELECT DISTINCT salary
FROM Employee
ORDER BY salary DESC
LIMIT 3;
Q17. How do you find duplicate records in a SQL table?
Sample Answer: Duplicate records can cause inconsistencies in data. The query below identifies duplicate rows based on a specific column.
SELECT column_name, COUNT(*)
FROM Table_Name
GROUP BY column_name
HAVING COUNT(*) > 1;
Q18. How to retrieve the second highest salary from an Employee table in SQL?
Sample Answer: Getting the second-highest salary requires using LIMIT and OFFSET. The query below fetches the second-highest salary.
SELECT DISTINCT salary
FROM Employee
ORDER BY salary DESC
LIMIT 1 OFFSET 1;
Q19. How do you find employees who have the same salary as another employee?
Sample Answer: To find employees earning the same salary as another, we use a self-join, which compares salary values within the same table. Here is a code implementation:
SELECT e1.name, e1.salary
FROM Employee e1, Employee e2
WHERE e1.salary = e2.salary AND e1.id <> e2.id;
Q20. How do you find the nth highest salary from an Employee table?
Sample Answer: To dynamically fetch the nth highest salary, we use the LIMIT and OFFSET clauses. The (n-1) ensures we retrieve the correct rank. Here is a code implementation:
SELECT DISTINCT salary
FROM Employee
ORDER BY salary DESC
LIMIT 1 OFFSET (n-1);
Pro Tip: Check out our recommended how to ace coding interviews course to enhance your problem-solving skills, master data structures, and confidently tackle Zoho’s coding challenges with optimized solutions.
Zoho Coding Interview Questions and Answers for Intermediate-Level Candidates
For candidates with 2 to 5 years of experience, Zoho offers roles like senior software engineer, backend developer, and full stack developer. The salary for these positions ranges from ₹10 LPA to ₹20 LPA, depending on expertise and specialization. Intermediate-level candidates are expected to have strong skills in object-oriented programming, database management, system design, and optimized coding. The questions in this category focus on graph algorithms, dynamic programming, and database queries. Here are the Zoho coding interview questions and answers for intermediate-level candidates:
Zoho Python-Based Coding Questions and Answers for Mid Level Candidates
Below are important Zoho Python based coding interview questions with answers for intermediate candidates, focusing on problem-solving, data structures, and algorithmic efficiency.
Q21. How to check if a given linked list is a palindrome in Python?
Sample Answer: A palindrome is a sequence that reads the same forward and backward. We can check this in a linked list by storing values in an array and comparing them.
Here is the coding solution for this problem:
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
def is_palindrome(head):
vals = []
while head:
vals.append(head.val)
head = head.next
return vals == vals[::-1]
# Example usage:
head = ListNode(1, ListNode(2, ListNode(2, ListNode(1))))
print(is_palindrome(head)) # Output: True
Q22. How to find the longest consecutive sequence in an unsorted array?
Sample Answer: The task is to find the longest sequence of consecutive numbers in an unsorted array. We can use a set for quick lookups and iterate through the array efficiently. Here’s how to find it:
def longest_consecutive(nums):
num_set = set(nums)
max_length = 0
for num in num_set:
if num - 1 not in num_set:
length = 1
while num + length in num_set:
length += 1
max_length = max(max_length, length)
return max_length
# Example usage:
print(longest_consecutive([100, 4, 200, 1, 3, 2])) # Output: 4
Q23. How to implement a queue using two stacks in Python?
Sample Answer: A queue follows the FIFO principle, but implementing it using stacks (LIFO) requires handling push and pop operations correctly. Here’s how to do it:
class QueueUsingStacks:
def __init__(self):
self.stack1 = []
self.stack2 = []
def enqueue(self, item):
self.stack1.append(item)
def dequeue(self):
if not self.stack2:
while self.stack1:
self.stack2.append(self.stack1.pop())
return self.stack2.pop() if self.stack2 else None
# Example usage:
q = QueueUsingStacks()
q.enqueue(1)
q.enqueue(2)
print(q.dequeue()) # Output: 1
Q24. How to check if a given binary tree is balanced?
Sample Answer: A balanced binary tree has a height difference of at most 1 between left and right subtrees. We use recursion to verify this. Here’s how to check it:
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
def is_balanced(root):
def check_height(node):
if not node:
return 0
left_height = check_height(node.left)
right_height = check_height(node.right)
if abs(left_height - right_height) > 1:
return -1
return max(left_height, right_height) + 1
return check_height(root) != -1
Q25. How to implement an LRU (Least Recently Used) Cache in Python?
Sample Answer: An LRU cache removes the least recently used item when full. This can be implemented using OrderedDict to maintain the order of usage. Here’s how to implement an LRU cache in Python:
from collections import OrderedDict
class LRUCache:
def __init__(self, capacity: int):
self.cache = OrderedDict()
self.capacity = capacity
def get(self, key: int):
if key not in self.cache:
return -1
self.cache.move_to_end(key)
return self.cache[key]
def put(self, key: int, value: int):
if key in self.cache:
self.cache.move_to_end(key)
self.cache[key] = value
if len(self.cache) > self.capacity:
self.cache.popitem(last=False)
# Example usage:
cache = LRUCache(2)
cache.put(1, 10)
cache.put(2, 20)
print(cache.get(1)) # Output: 10
Zoho Java-Based Coding Questions and Answers for Mid Level Candidates
Here are commonly asked Java Zoho coding interview questions and answers for intermediate candidates, covering object-oriented concepts, data handling, and algorithm implementation.
Q26. How to reverse a linked list in Java?
Sample Answer: Reversing a singly linked list means changing the direction of pointers so that the last node becomes the head, and the head becomes the tail. This is commonly asked in interviews to test knowledge of pointers and iteration.
Here is the Java implementation:
class ListNode {
int val;
ListNode next;
ListNode(int x) { val = x; next = null; }
}
public class ReverseLinkedList {
public static ListNode reverse(ListNode head) {
ListNode prev = null, curr = head;
while (curr != null) {
ListNode next = curr.next;
curr.next = prev;
prev = curr;
curr = next;
}
return prev;
}
public static void printList(ListNode head) {
while (head != null) {
System.out.print(head.val + " ");
head = head.next;
}
}
public static void main(String[] args) {
ListNode head = new ListNode(1);
head.next = new ListNode(2);
head.next.next = new ListNode(3);
head.next.next.next = new ListNode(4);
head = reverse(head);
printList(head); // Output: 4 3 2 1
}
}
Q27. How to check if a binary tree is a BST (Binary Search Tree) in Java?
Sample Answer: A binary search tree (BST) follows the rule where left nodes are smaller than the root and right nodes are greater. We can use inorder traversal to check if the tree is sorted.
Here is the Java implementation:
class TreeNode {
int val;
TreeNode left, right;
TreeNode(int val) { this.val = val; }
}
public class ValidateBST {
public static boolean isValidBST(TreeNode root) {
return validate(root, Long.MIN_VALUE, Long.MAX_VALUE);
}
private static boolean validate(TreeNode node, long min, long max) {
if (node == null) return true;
if (node.val <= min || node.val >= max) return false;
return validate(node.left, min, node.val) && validate(node.right, node.val, max);
}
public static void main(String[] args) {
TreeNode root = new TreeNode(2);
root.left = new TreeNode(1);
root.right = new TreeNode(3);
System.out.println(isValidBST(root)); // Output: true
}
}
Q28. How to implement a stack using a queue in Java?
Sample Answer: A stack (LIFO) can be implemented using a queue (FIFO) by using two queues or one queue with costly push or pop operations. Here, we use a single queue and rearrange elements.
Here is the Java implementation:
import java.util.LinkedList;
import java.util.Queue;
class StackUsingQueue {
private Queue<Integer> queue = new LinkedList<>();
public void push(int x) {
queue.add(x);
for (int i = 0; i < queue.size() - 1; i++) {
queue.add(queue.remove());
}
}
public int pop() {
return queue.remove();
}
public int top() {
return queue.peek();
}
public boolean isEmpty() {
return queue.isEmpty();
}
public static void main(String[] args) {
StackUsingQueue stack = new StackUsingQueue();
stack.push(1);
stack.push(2);
stack.push(3);
System.out.println(stack.pop()); // Output: 3
}
}
Q29. How to find the first non-repeating character in a string in Java?
Sample Answer: In this problem, we need to find the first character in a string that does not repeat. We can use a HashMap to count occurrences and return the first unique character.
Here is the Java implementation:
import java.util.HashMap;
public class FirstNonRepeatingChar {
public static char firstNonRepeating(String s) {
HashMap<Character, Integer> count = new HashMap<>();
for (char c : s.toCharArray()) {
count.put(c, count.getOrDefault(c, 0) + 1);
}
for (char c : s.toCharArray()) {
if (count.get(c) == 1) return c;
}
return '_'; // If no unique character is found
}
public static void main(String[] args) {
System.out.println(firstNonRepeating("swiss")); // Output: 'w'
}
}
Q30. How to merge two sorted linked lists in Java?
Sample Answer: Merging two sorted linked lists means creating a single sorted list by comparing node values. We can use recursion or iteration to solve this problem efficiently.
Here is the Java implementation:
class ListNode {
int val;
ListNode next;
ListNode(int x) { val = x; next = null; }
}
public class MergeSortedLists {
public static ListNode merge(ListNode l1, ListNode l2) {
if (l1 == null) return l2;
if (l2 == null) return l1;
if (l1.val < l2.val) {
l1.next = merge(l1.next, l2);
return l1;
} else {
l2.next = merge(l1, l2.next);
return l2;
}
}
public static void printList(ListNode head) {
while (head != null) {
System.out.print(head.val + " ");
head = head.next;
}
}
public static void main(String[] args) {
ListNode l1 = new ListNode(1);
l1.next = new ListNode(3);
l1.next.next = new ListNode(5);
ListNode l2 = new ListNode(2);
l2.next = new ListNode(4);
l2.next.next = new ListNode(6);
ListNode merged = merge(l1, l2);
printList(merged); // Output: 1 2 3 4 5 6
}
}
Pro Tip: If you’re preparing for a Java developer role at Zoho, focus on mastering Java concepts and problem-solving techniques. If you’re also exploring opportunities at IBM, check out our blog on IBM Java developer job interview questions.
Zoho C and C++ Coding Questions and Answers for Intermediate Candidates
Find key C and C++ Zoho programming questions and answers for mid level candidates that test memory management, pointers, and efficient coding techniques in Zoho interviews.
Q31. How to reverse a string without using extra space in C++?
Sample Answer: Reversing a string in-place means swapping characters without using extra memory. This can be done using a two-pointer approach, where we swap characters from both ends.
Here is the C++ implementation:
#include <iostream>
#include <algorithm>
void reverseString(std::string &s) {
int left = 0, right = s.length() - 1;
while (left < right) {
std::swap(s[left], s[right]);
left++;
right--;
}
}
int main() {
std::string str = "Zoho";
reverseString(str);
std::cout << str; // Output: "ohoZ"
return 0;
}
Q32. How to check if a number is prime in C?
Sample Answer: A prime number is a number greater than 1 that is only divisible by 1, itself. To check for primality, we iterate up to √n and check for factors.
Here is the C implementation:
#include <stdio.h>
#include <math.h>
int isPrime(int num) {
if (num < 2) return 0;
for (int i = 2; i <= sqrt(num); i++) {
if (num % i == 0) return 0;
}
return 1;
}
int main() {
int num = 29;
if (isPrime(num)) {
printf("%d is a prime number\n", num);
} else {
printf("%d is not a prime number\n", num);
}
return 0;
}
Q33. How to implement a min heap in C++?
Sample Answer: A min heap is a binary tree where each parent node is smaller than its children. We can implement it using a priority queue in C++.
Here is the C++ implementation:
#include <iostream>
#include <queue>
int main() {
std::priority_queue<int, std::vector<int>, std::greater<int>> minHeap;
minHeap.push(10);
minHeap.push(5);
minHeap.push(15);
minHeap.push(20);
std::cout << "Min Heap top: " << minHeap.top() << std::endl; // Output: 5
minHeap.pop();
std::cout << "Min Heap top after pop: " << minHeap.top() << std::endl; // Output: 10
return 0;
}
Q34. How to find the missing number in an array of size N-1 in C?
Sample Answer: Given an array of size N-1 containing numbers from 1 to N with one missing, we can find the missing number using the sum formula:
Sum=N×(N+1)2\text{Sum} = \frac{N \times (N + 1)}{2}Sum=2N×(N+1)
Here is the C implementation:
#include <stdio.h>
int findMissingNumber(int arr[], int n) {
int total = (n * (n + 1)) / 2;
int sum = 0;
for (int i = 0; i < n - 1; i++) {
sum += arr[i];
}
return total - sum;
}
int main() {
int arr[] = {1, 2, 4, 5, 6}; // Missing number is 3
int n = 6;
printf("Missing number: %d\n", findMissingNumber(arr, n)); // Output: 3
return 0;
}
Q35. How to detect a cycle in a linked list using Floyd’s Cycle Detection Algorithm in C++?
Sample Answer: A cycle in a linked list means a node’s next pointer points back to a previous node. Floyd’s Cycle Detection Algorithm (Tortoise and Hare) detects cycles using two pointers moving at different speeds.
Here is the C++ implementation:
#include <iostream>
class ListNode {
public:
int val;
ListNode* next;
ListNode(int x) : val(x), next(nullptr) {}
};
bool hasCycle(ListNode* head) {
ListNode *slow = head, *fast = head;
while (fast && fast->next) {
slow = slow->next;
fast = fast->next->next;
if (slow == fast) return true;
}
return false;
}
int main() {
ListNode* head = new ListNode(1);
head->next = new ListNode(2);
head->next->next = new ListNode(3);
head->next->next->next = head->next; // Creates a cycle
std::cout << (hasCycle(head) ? "Cycle detected" : "No cycle") << std::endl; // Output: Cycle detected
return 0;
}
Pro Tip: Preparing for a Zoho web developer role? Focus on front-end and back-end technologies, problem-solving, and coding efficiency. Check out our blog on Zoho web developer interview questions to boost your preparation.
Zoho SQL-Based Coding Interview Questions and Answers for Intermediate Candidates
Explore crucial SQL-based coding questions in Zoho interviews, assessing database queries, indexing, joins, and optimization strategies.
Q36. How to find the second highest salary from an Employee table in SQL?
Sample Answer: Finding the second-highest salary is a common SQL question that tests knowledge of ORDER BY, LIMIT, and subqueries. One way to achieve this is by using a subquery to exclude the maximum salary and retrieve the second highest.
Here is the SQL query:
SELECT MAX(salary) AS SecondHighestSalary
FROM Employee
WHERE salary < (SELECT MAX(salary) FROM Employee);
Another method using LIMIT and OFFSET (works in MySQL, PostgreSQL):
SELECT salary
FROM Employee
ORDER BY salary DESC
LIMIT 1 OFFSET 1;
Q37. How to find duplicate records in a table in SQL?
Sample Answer: Finding duplicate records in a table is important for data cleaning and integrity. We can use GROUP BY with HAVING COUNT > 1 to identify duplicates in a column.
Here is the SQL query:
SELECT name, COUNT(*) AS count
FROM Employee
GROUP BY name
HAVING COUNT(*) > 1;
If we need to delete duplicates while keeping only one occurrence:
DELETE FROM Employee
WHERE id NOT IN (
SELECT MIN(id)
FROM Employee
GROUP BY name
);
Q38. How to retrieve employees who joined in the last 6 months?
Sample Answer: To fetch employees who joined in the last 6 months, we use DATE_SUB() (MySQL) or INTERVAL (PostgreSQL, SQL Server) along with WHERE conditions.
Here is the SQL query:
SELECT * FROM Employee
WHERE joining_date >= DATE_SUB(CURDATE(), INTERVAL 6 MONTH);
For SQL Server, we use DATEADD():
SELECT * FROM Employee
WHERE joining_date >= DATEADD(MONTH, -6, GETDATE());
Q39. How to find the department with the highest number of employees?
Sample Answer: To determine which department has the highest number of employees, we count the number of employees per department and retrieve the one with the maximum count.
Here is the SQL query:
SELECT department, COUNT(*) AS employee_count
FROM Employee
GROUP BY department
ORDER BY employee_count DESC
LIMIT 1;
For SQL Server, use TOP 1 instead of LIMIT:
SELECT TOP 1 department, COUNT(*) AS employee_count
FROM Employee
GROUP BY department
ORDER BY employee_count DESC;
Pro Tip: If you’re preparing for Zoho’s coding interview, enroll in a SQL course to master database queries, joins, and optimization techniques. Practicing SQL-based problem-solving and Zoho’s past questions can give you a strong advantage.
Q40. How to get cumulative salary per department using a window function?
Sample Answer: A cumulative sum (running total) helps in financial and analytical queries. The SUM() window function with PARTITION BY calculates cumulative salary per department.
Here is the SQL query:
SELECT
department,
employee_name,
salary,
SUM(salary) OVER (PARTITION BY department ORDER BY salary) AS cumulative_salary
FROM Employee;
Pro Tip: Strong SQL skills are essential for database-related roles. Focus on queries, optimization, and data manipulation. Check out our blog on SQL coding interview questions and answers to master key concepts and ace your interview.
Zoho Coding Interview Questions and Answers for Experienced Level Candidates
Experienced professionals with 5+ years in the industry can apply for senior roles such as technical lead, software architect, and engineering manager at Zoho. The salary for these positions can go beyond ₹25 LPA, depending on experience and leadership skills. At this level, candidates must demonstrate expertise in scalable architecture, high-level system design, and performance optimization. The interview questions focus on distributed systems, advanced algorithmic concepts, and designing real-world applications. Here are the Zoho programming questions and answers for experienced-level candidates:
Zoho Python-Based Coding Questions and Answers for Experiencied Candidates
These Python coding questions are frequently asked in Zoho interviews for experienced level candidates, testing programming logic, algorithmic thinking, and problem-solving skills.
Q41. How to find all anagrams of a word from a given list of words?
Sample Answer: An anagram is a word formed by rearranging the letters of another word. To find all anagrams of a given word from a list, we can use sorting or character frequency comparison.
Here is the Python implementation using sorting:
from collections import defaultdict
def find_anagrams(word_list, target_word):
target_sorted = sorted(target_word)
return [word for word in word_list if sorted(word) == target_sorted]
# Example Usage
words = ["listen", "silent", "enlist", "google", "tinsel", "banana"]
target = "listen"
print(find_anagrams(words, target)) # Output: ['silent', 'enlist', 'tinsel']
Q42. How to merge overlapping intervals in a list?
Sample Answer: Given a list of intervals, we need to merge overlapping intervals. This is useful in scheduling and computational geometry problems.
Here is the Python implementation:
def merge_intervals(intervals):
intervals.sort(key=lambda x: x[0])
merged = []
for interval in intervals:
if not merged or merged[-1][1] < interval[0]:
merged.append(interval)
else:
merged[-1][1] = max(merged[-1][1], interval[1])
return merged
# Example Usage
intervals = [[1, 3], [2, 6], [8, 10], [15, 18]]
print(merge_intervals(intervals)) # Output: [[1, 6], [8, 10], [15, 18]]
Q43. How to implement a custom memory-efficient data structure in Python?
Sample Answer: To create a memory-efficient data structure, we can use slots in Python, which reduce memory usage by preventing the creation of a dynamic dictionary.
Here is the Python implementation:
class EfficientNode:
__slots__ = ['value', 'next']
def __init__(self, value=None):
self.value = value
self.next = None
# Example Usage
node1 = EfficientNode(10)
node2 = EfficientNode(20)
node1.next = node2
print(node1.value, node1.next.value) # Output: 10 20
Q44. How to implement a max stack with O(1) retrieval of the maximum element?
Sample Answer: A max stack allows push, pop, and retrieving the maximum element in O(1) time complexity. We use an additional stack to track the maximum values.
Here is the Python implementation:
class EfficientNode:
__slots__ = ['value', 'next']
def __init__(self, value=None):
self.value = value
self.next = None
# Example Usage
node1 = EfficientNode(10)
node2 = EfficientNode(20)
node1.next = node2
print(node1.value, node1.next.value) # Output: 10 20
Q45. How to check if two strings are anagrams of each other?
Sample Answer: An anagram is a word or phrase formed by rearranging the letters of another, using all the original letters exactly once. To approach this, you need to sort both strings and compare them. If the sorted strings are equal, they are anagrams.
Here is the Python implementation:
def are_anagrams(str1, str2):
return sorted(str1) == sorted(str2)
# Example Usage
if __name__ == "__main__":
str1 = "listen"
str2 = "silent"
print(f"Are '{str1}' and '{str2}' anagrams? {are_anagrams(str1, str2)}")
# Output:
# Are 'listen' and 'silent' anagrams? True
Zoho Java-Based Coding Interview Questions and Answers for Experienced Candidates
Here are essential Zoho Java programming questions with answers for experienced candidates designed to evaluate object-oriented programming and algorithms in the interview.
Q46. How to implement a custom thread-safe Singleton in Java?
Sample Answer: A singleton ensures that only one instance of a class is created. To make it thread-safe, we can use double-checked locking with volatile to ensure correct memory handling.
Here is the Java implementation:
class Singleton { private static volatile Singleton instance; private Singleton() {} // Private constructor public static Singleton getInstance() { if (instance == null) { synchronized (Singleton.class) { if (instance == null) { instance = new Singleton(); } } } return instance; }}// Example Usagepublic class Main { public static void main(String[] args) { Singleton s1 = Singleton.getInstance(); Singleton s2 = Singleton.getInstance(); System.out.println(s1 == s2); // Output: true (Same instance) }}
Q47. How to find the longest increasing subsequence in an array?
Sample Answer: The longest increasing subsequence (LIS) problem requires finding the longest subsequence where elements appear in increasing order. This can be solved using dynamic programming with O(n²) complexity or binary search with O(n log n).
Here is the Java implementation using dynamic programming:
import java.util.Arrays;
public class LIS {
public static int longestIncreasingSubsequence(int[] nums) {
int n = nums.length;
int[] dp = new int[n];
Arrays.fill(dp, 1);
int maxLIS = 1;
for (int i = 1; i < n; i++) {
for (int j = 0; j < i; j++) {
if (nums[i] > nums[j]) {
dp[i] = Math.max(dp[i], dp[j] + 1);
}
}
maxLIS = Math.max(maxLIS, dp[i]);
}
return maxLIS;
}
public static void main(String[] args) {
int[] nums = {10, 22, 9, 33, 21, 50, 41, 60};
System.out.println(longestIncreasingSubsequence(nums)); // Output: 5
}
}
Q48. How to implement a min-heap in Java?
Sample Answer: A min-heap is a binary tree where the parent node is always smaller than its children. It helps in priority queues and heap sort. Java provides a built-in PriorityQueue, but we can also implement a min-heap manually using an array-based approach.
Here is the Java implementation:
import java.util.PriorityQueue;
public class MinHeapExample {
public static void main(String[] args) {
PriorityQueue<Integer> minHeap = new PriorityQueue<>();
minHeap.add(10);
minHeap.add(20);
minHeap.add(5);
minHeap.add(15);
while (!minHeap.isEmpty()) {
System.out.print(minHeap.poll() + " "); // Output: 5 10 15 20
}
}
}
Q49. How to detect a cycle in a directed graph using BFS?
Sample Answer: Detecting cycles in a directed graph is important for deadlock detection and dependency resolution. Unlike DFS-based cycle detection, Kahn’s Algorithm (BFS-based Topological Sorting) can be used to detect cycles in O(V + E) time complexity.
Here is the Java implementation using Kahn’s Algorithm:
import java.util.*;
public class GraphCycle {
public static boolean hasCycle(int V, List<List<Integer>> adj) {
int[] inDegree = new int[V];
for (List<Integer> neighbors : adj) {
for (int neighbor : neighbors) {
inDegree[neighbor]++;
}
}
Queue<Integer> queue = new LinkedList<>();
for (int i = 0; i < V; i++) {
if (inDegree[i] == 0) queue.add(i);
}
int count = 0;
while (!queue.isEmpty()) {
int node = queue.poll();
count++;
for (int neighbor : adj.get(node)) {
if (--inDegree[neighbor] == 0) queue.add(neighbor);
}
}
return count != V; // If count != V, there's a cycle
}
public static void main(String[] args) {
int V = 4;
List<List<Integer>> adj = Arrays.asList(
Arrays.asList(1),
Arrays.asList(2),
Arrays.asList(3),
Arrays.asList(1) // Creates a cycle
);
System.out.println(hasCycle(V, adj)); // Output: true
}
}
Q50. How to implement a custom blocking queue in Java?
Sample Answer: A blocking queue is used in multi-threading to handle producer-consumer problems. It allows safe concurrent access with synchronization.
Here is the Java implementation:
import java.util.LinkedList;
import java.util.Queue;
class BlockingQueue<T> {
private Queue<T> queue = new LinkedList<>();
private int capacity;
public BlockingQueue(int capacity) {
this.capacity = capacity;
}
public synchronized void enqueue(T item) throws InterruptedException {
while (queue.size() == capacity) {
wait();
}
queue.add(item);
notifyAll();
}
public synchronized T dequeue() throws InterruptedException {
while (queue.isEmpty()) {
wait();
}
T item = queue.poll();
notifyAll();
return item;
}
}
// Example Usage
public class Main {
public static void main(String[] args) throws InterruptedException {
BlockingQueue<Integer> queue = new BlockingQueue<>(2);
new Thread(() -> {
try {
queue.enqueue(10);
queue.enqueue(20);
System.out.println("Enqueued items.");
} catch (InterruptedException e) {}
}).start();
Thread.sleep(1000);
new Thread(() -> {
try {
System.out.println("Dequeued: " + queue.dequeue());
System.out.println("Dequeued: " + queue.dequeue());
} catch (InterruptedException e) {}
}).start();
}
}
Zoho C and C++ Coding Questions and Answers for Experienced Candidates
Check out these C and C++ Zoho coding questions and answers for experienced candidates that interviewers commonly ask to assess efficiency, memory usage, and low-level programming concepts.
Q51. How to implement an LRU (Least Recently Used) Cache in C++?
Sample Answer: An LRU Cache evicts the least recently used item when the cache reaches its capacity. We can implement it using hashmaps and doubly linked lists to achieve O(1) time complexity for both get and put operations.
Here is the C++ implementation:
#include <iostream>
#include <unordered_map>
#include <list>
using namespace std;
class LRUCache {
int capacity;
list<int> keys;
unordered_map<int, pair<int, list<int>::iterator>> cache;
public:
LRUCache(int cap) : capacity(cap) {}
int get(int key) {
if (cache.find(key) == cache.end()) return -1;
keys.erase(cache[key].second);
keys.push_front(key);
cache[key].second = keys.begin();
return cache[key].first;
}
void put(int key, int value) {
if (cache.find(key) != cache.end()) {
keys.erase(cache[key].second);
} else if (keys.size() == capacity) {
int oldKey = keys.back();
keys.pop_back();
cache.erase(oldKey);
}
keys.push_front(key);
cache[key] = {value, keys.begin()};
}
};
// Example Usage
int main() {
LRUCache cache(2);
cache.put(1, 10);
cache.put(2, 20);
cout << cache.get(1) << endl; // Output: 10
cache.put(3, 30); // Removes key 2
cout << cache.get(2) << endl; // Output: -1
return 0;
}
Q52. How to reverse a linked list in C?
Sample Answer: Reversing a singly linked list involves changing the pointers of each node to point to the previous node instead of the next one. We can achieve this in O(n) time complexity using an iterative approach.
Here is the C implementation:
#include <stdio.h>
#include <stdlib.h>
// Definition of a linked list node
struct Node {
int data;
struct Node* next;
};
// Function to reverse the linked list
struct Node* reverseList(struct Node* head) {
struct Node* prev = NULL;
struct Node* current = head;
struct Node* next = NULL;
while (current != NULL) {
next = current->next; // Store next node
current->next = prev; // Reverse current node's pointer
prev = current; // Move prev to current
current = next; // Move current to next
}
return prev; // New head of the reversed list
}
// Function to insert a node at the beginning
void push(struct Node** head_ref, int new_data) {
struct Node* new_node = (struct Node*)malloc(sizeof(struct Node));
new_node->data = new_data;
new_node->next = (*head_ref);
(*head_ref) = new_node;
}
// Function to print the linked list
void printList(struct Node* head) {
struct Node* temp = head;
while (temp != NULL) {
printf("%d -> ", temp->data);
temp = temp->next;
}
printf("NULL\n");
}
// Main function to test the reversal
int main() {
struct Node* head = NULL;
// Creating the linked list 1->2->3->4->5->NULL
push(&head, 5);
push(&head, 4);
push(&head, 3);
push(&head, 2);
push(&head, 1);
printf("Original linked list:\n");
printList(head);
head = reverseList(head);
printf("Reversed linked list:\n");
printList(head);
return 0;
}
Q53. How to detect a loop in a linked list using Floyd’s Cycle Detection Algorithm?
Sample Answer: A loop in a linked list occurs when a node points back to a previous node, causing an infinite cycle. We can use Floyd’s Cycle Detection Algorithm (Tortoise and Hare Method) to detect a loop in O(n) time complexity.
Here is the C++ implementation:
#include <iostream>
using namespace std;
struct Node {
int data;
Node* next;
};
bool detectLoop(Node* head) {
Node *slow = head, *fast = head;
while (fast && fast->next) {
slow = slow->next;
fast = fast->next->next;
if (slow == fast) return true;
}
return false;
}
// Helper functions
void push(Node** head, int data) {
Node* newNode = new Node();
newNode->data = data;
newNode->next = *head;
*head = newNode;
}
int main() {
Node* head = NULL;
push(&head, 10);
push(&head, 20);
push(&head, 30);
head->next->next->next = head; // Creates a loop
cout << (detectLoop(head) ? "Loop detected" : "No loop detected") << endl;
return 0;
}
Q54. How to implement a trie (prefix tree) in C++?
Sample Answer: A Trie (prefix tree) is a special type of tree used to store strings efficiently. It is useful for autocomplete, spell checking, and word searching.
Here is the C++ implementation:
#include <iostream>
using namespace std;
struct TrieNode {
TrieNode* children[26];
bool isEndOfWord;
TrieNode() {
isEndOfWord = false;
for (int i = 0; i < 26; i++)
children[i] = NULL;
}
};
class Trie {
public:
TrieNode* root;
Trie() { root = new TrieNode(); }
void insert(string word) {
TrieNode* node = root;
for (char ch : word) {
if (!node->children[ch - 'a'])
node->children[ch - 'a'] = new TrieNode();
node = node->children[ch - 'a'];
}
node->isEndOfWord = true;
}
bool search(string word) {
TrieNode* node = root;
for (char ch : word) {
if (!node->children[ch - 'a'])
return false;
node = node->children[ch - 'a'];
}
return node->isEndOfWord;
}
};
// Example Usage
int main() {
Trie trie;
trie.insert("hello");
cout << (trie.search("hello") ? "Found" : "Not found") << endl; // Output: Found
cout << (trie.search("world") ? "Found" : "Not found") << endl; // Output: Not found
return 0;
}
Q55. How to implement a circular queue using an array in C?
Sample Answer: A circular queue is a queue where the last position connects back to the first, making efficient use of memory. We implement it using front and rear pointers with modulo arithmetic.
Here is the C implementation:
#include <stdio.h>
#define SIZE 5
struct CircularQueue {
int items[SIZE];
int front, rear;
};
void enqueue(struct CircularQueue* q, int value) {
if ((q->rear + 1) % SIZE == q->front) {
printf("Queue is full\n");
return;
}
if (q->front == -1) q->front = 0;
q->rear = (q->rear + 1) % SIZE;
q->items[q->rear] = value;
}
int dequeue(struct CircularQueue* q) {
if (q->front == -1) {
printf("Queue is empty\n");
return -1;
}
int data = q->items[q->front];
if (q->front == q->rear) q->front = q->rear = -1;
else q->front = (q->front + 1) % SIZE;
return data;
}
int main() {
struct CircularQueue q = { .front = -1, .rear = -1 };
enqueue(&q, 10);
enqueue(&q, 20);
printf("Dequeued: %d\n", dequeue(&q)); // Output: Dequeued: 10
return 0;
}
Zoho SQL-Based Coding Questions and Answers for Experienced Candidates
These SQL Zoho programming questions will help you prepare for Zoho interviews by covering database management, complex queries, and data manipulation techniques.
Q56. How to find employees who have the same salary as their department’s average salary?
Sample Answer: Matching an employee’s salary with the average salary of their department can help in identifying fair salary distributions. We achieve this using the AVG() function combined with HAVING.
Here is the SQL query:
SELECT e.employee_name, e.salary, e.department_id
FROM employees e
JOIN (SELECT department_id, AVG(salary) AS avg_salary
FROM employees
GROUP BY department_id) dept_avg
ON e.department_id = dept_avg.department_id
WHERE e.salary = dept_avg.avg_salary;
Q57. How to find the total number of employees hired each month, including cumulative counts?
Sample Answer: Tracking employee hiring trends requires both monthly hiring counts and cumulative totals. We use COUNT() with the OVER() window function for this.
Here is the SQL query:
SELECT DATE_FORMAT(join_date, '%Y-%m') AS hire_month,
COUNT(*) AS monthly_hires,
SUM(COUNT(*)) OVER (ORDER BY DATE_FORMAT(join_date, '%Y-%m')) AS cumulative_hires
FROM employees
GROUP BY hire_month;
Q58. How to retrieve the department with the highest number of employees?
Sample Answer: Finding the department with the highest employee count is a common query in business analytics. We use COUNT() to count employees per department and ORDER BY to sort them. Here’s how to do it:
SELECT department_id, COUNT(*) AS total_employees
FROM employees
GROUP BY department_id
ORDER BY total_employees DESC
LIMIT 1;
Q59. How to find employees who have a higher salary than their manager?
Sample Answer: Comparing employee salaries to their manager’s salary is useful in salary structure analysis. We use self-joins to compare employee and manager salaries. Here’s how to do it:
SELECT e.employee_name, e.salary, m.employee_name AS manager_name, m.salary AS manager_salary
FROM employees e
JOIN employees m
ON e.manager_id = m.employee_id
WHERE e.salary > m.salary;
Q60. How to find employees who have worked in more than one department?
Sample Answer: Employees who switch departments over time need to be identified using GROUP BY and HAVING COUNT().
Here is the SQL query:
SELECT employee_id, employee_name, COUNT(DISTINCT department_id) AS dept_count
FROM employee_department_history
GROUP BY employee_id, employee_name
HAVING dept_count > 1;


Conclusion
We have covered in this blog Zoho coding questions and answers across different experience levels, helping you prepare for Zoho’s technical interviews. These questions focus on Python, Java, C, C++, and SQL, ensuring a well-rounded understanding of problem-solving, data structures, and algorithms. Mastering these concepts will improve your chances of clearing Zoho’s hiring process. If you’re seeking a software development role specifically, check out our blog on Zoho software developer interview questions to strengthen your interview preparation.
FAQs
Answer: Zoho allows candidates to code in multiple programming languages, including Python, Java, C, C++, and SQL. While there is no strict language requirement, candidates should use a language they are proficient in. Zoho focuses on logic, efficiency, and problem-solving rather than specific syntax.
Answer: Zoho conducts three coding rounds: a basic programming test, an advanced programming round, and a technical interview. Each stage tests logical thinking, coding efficiency, and problem-solving skills. Some roles may also require a system design or SQL-based problem-solving round.
Answer: Yes, freshers can crack Zoho coding interviews by demonstrating strong problem-solving skills and coding proficiency. Zoho evaluates candidates based on logical thinking, programming fundamentals, and algorithmic efficiency rather than prior work experience. Regular practice with coding problems can also help to improve your success rates.
Answer: To prepare for Zoho coding interviews, focus on mastering data structures, algorithms, and problem-solving skills. Practice coding questions in Python, Java, C, C++, and SQL, as Zoho tests proficiency across these languages. Key topics include arrays, strings, linked lists, trees, dynamic programming, and database queries. Additionally, familiarize yourself with Zoho’s recruitment process, which includes written, programming, advanced programming, and HR rounds. Regular practice on platforms like LeetCode or HackerRank can significantly improve your chances of success.