Zoho 2025 C Output Questions
Complete collection of 2025 C output prediction questions with detailed explanations
Access free Zoho placement papers 2025, latest C programming questions with solutions, detailed exam pattern, interview questions, and complete preparation guide. Download Zoho 2025 placement papers PDF.
This page contains Zoho placement papers from 2025 with the latest questions, solutions, and exam patterns. Use these current year papers to prepare effectively for Zoho placement process and interviews.
Zoho 2025 C Output Questions
Complete collection of 2025 C output prediction questions with detailed explanations
Zoho 2025 Coding Problems
All coding problems from 2025 placement papers with solutions
Zoho 2025 Aptitude Questions
Quantitative aptitude questions from 2025 Zoho placement papers
Zoho 2025 Interview Experience
Real interview experiences from candidates who cleared 2025 Zoho placement
| Section | Questions | Time | Difficulty | Focus Areas |
|---|---|---|---|---|
| Quantitative Aptitude | 10-15 | 30-40 min | Easy-Medium | Percentages, ratios, basic math |
| C Output Prediction | 10-15 | 40-50 min | Medium-Hard | Pointers, arrays, loops, recursion |
| C Coding | 2-3 | 20-30 min | Medium | Pattern printing, array logic |
Total: 25-35 questions, 90-120 minutes (pen-paper or online)
Key Changes in 2025:
This section contains real questions from Zoho placement papers 2025 based on candidate experiences and actual exam patterns.
Problem: Find the missing number in the series: 2, 6, 12, 20, ?
Solution: Pattern: Differences are 4, 6, 8, 10… 2 + 4 = 6 6 + 6 = 12 12 + 8 = 20 20 + 10 = 30
Answer: 30
Problem: If the sum of the ages of a father and his son is 60 years, and the father’s age is four times that of his son, what are their ages?
Solution: Let son’s age = x years Father’s age = 4x years x + 4x = 60 5x = 60 x = 12
Son’s age = 12 years Father’s age = 48 years
Answer: Son: 12 years, Father: 48 years
Problem: A person sells a pen at a 25% profit. If the cost price is ₹40, what is the selling price?
Solution: Profit = 25% of ₹40 = ₹10 Selling Price = Cost Price + Profit = ₹40 + ₹10 = ₹50
Answer: ₹50
Problem: If a number is reversed (e.g., 1234 → 4321), and the difference between the original and reversed number is 3087, what is the original number?
Solution: Let original number = 1000a + 100b + 10c + d Reversed = 1000d + 100c + 10b + a Difference = 999(a-d) + 90(b-c) = 3087
Testing: If a=4, d=1: 999(3) = 2997 Remaining: 3087 - 2997 = 90 So b-c = 1, possible values b=3, c=2
Answer: 4321 (original), 1234 (reversed)
Problem: A shopkeeper marks his goods 20% above the cost price and allows a discount of 10%. Find his gain percent.
Solution: Let CP = ₹100 MP = ₹100 + 20% = ₹120 Discount = 10% of ₹120 = ₹12 SP = ₹120 - ₹12 = ₹108 Gain = ₹108 - ₹100 = ₹8 Gain % = (8/100) × 100 = 8%
Answer: 8%
Problem: If the difference between the simple interest and compound interest on a certain sum for 2 years at 5% per annum is ₹25, find the sum.
Solution: CI - SI = P[(1+R/100)² - 1] - (P×R×T/100) = P[(1.05)² - 1] - (P×5×2/100) = P[1.1025 - 1] - 0.1P = 0.1025P - 0.1P = 0.0025P 0.0025P = 25 P = ₹10,000
Answer: ₹10,000
Problem: A man can do a piece of work in 10 days, and another man can do it in 15 days. How long will they take to complete the work together?
Solution: First man’s 1 day work = 1/10 Second man’s 1 day work = 1/15 Combined 1 day work = 1/10 + 1/15 = (3+2)/30 = 5/30 = 1/6 Time taken together = 6 days
Answer: 6 days
Problem: If the perimeter of a rectangle is 60 cm and its length is twice its breadth, find the area of the rectangle.
Solution: Let breadth = x cm, length = 2x cm Perimeter = 2(length + breadth) = 2(2x + x) = 6x = 60 x = 10 cm Length = 20 cm, Breadth = 10 cm Area = 20 × 10 = 200 cm²
Answer: 200 cm²
Problem: A person travels 3/8 of a journey by train, 1/4 by bus, and the remaining 120 km by car. Find the total distance of the journey.
Solution: Let total distance = D km By train = 3D/8 By bus = D/4 = 2D/8 By car = 120 km Total: 3D/8 + 2D/8 + 120 = D 5D/8 + 120 = D 120 = D - 5D/8 = 3D/8 D = 120 × 8/3 = 320 km
Answer: 320 km
Problem: A sum of money triples itself in 12 years at simple interest. What is the annual rate of interest?
Solution: Let Principal = P, Amount = 3P Interest = 3P - P = 2P SI = P × R × T / 100 2P = P × R × 12 / 100 2 = 12R / 100 R = 200/12 = 16.67%
Answer: 16.67% per annum
Problem: A person covers a certain distance at a speed of 50 km/h and returns at 30 km/h. What is the average speed for the entire journey?
Solution: Let distance = D km Time forward = D/50 hours Time return = D/30 hours Total time = D/50 + D/30 = D(3+5)/150 = 8D/150 = 4D/75 hours Total distance = 2D km Average speed = 2D / (4D/75) = 2D × 75/4D = 37.5 km/h
Answer: 37.5 km/h
Problem: If the cost price of 20 articles is equal to the selling price of 15 articles, find the profit percentage.
Solution: Let CP of 1 article = ₹1 CP of 20 articles = ₹20 SP of 15 articles = ₹20 (given) SP of 1 article = ₹20/15 = ₹4/3 Profit = ₹4/3 - ₹1 = ₹1/3 Profit % = (1/3)/1 × 100 = 33.33%
Answer: 33.33%
Problem: A shopkeeper gives a discount of 15% on the marked price. If the selling price is ₹425, what was the marked price?
Solution: Let MP = ₹100 Discount = 15% of ₹100 = ₹15 SP = ₹100 - ₹15 = ₹85 When SP = ₹85, MP = ₹100 When SP = ₹425, MP = (425/85) × 100 = ₹500
Answer: ₹500
Problem: A man can row 7 km/h in still water. If the river is flowing at 3 km/h, how long will it take him to row 12 km downstream?
Solution: Speed in still water = 7 km/h Speed of stream = 3 km/h Downstream speed = 7 + 3 = 10 km/h Time = Distance/Speed = 12/10 = 1.2 hours = 1 hour 12 minutes
Answer: 1 hour 12 minutes
Problem: If the sum of the ages of A and B is 50 years, and the difference between their ages is 10 years, find their individual ages.
Solution: Let A’s age = x years, B’s age = y years x + y = 50 x - y = 10 Adding: 2x = 60, x = 30 y = 50 - 30 = 20
Answer: A: 30 years, B: 20 years
Problem: Two pipes A and B can fill a tank in 20 minutes and 30 minutes respectively. If both are opened together, how long will it take to fill the tank?
Solution: Pipe A fills 1/20 of tank per minute Pipe B fills 1/30 of tank per minute Combined = 1/20 + 1/30 = (3+2)/60 = 5/60 = 1/12 per minute Time to fill = 12 minutes
Answer: 12 minutes
Problem: A man spends 80% of his income. If his income increases by 25% and his expenditure increases by 20%, what is the percentage increase in his savings?
Solution: Let income = ₹100 Expenditure = ₹80, Savings = ₹20 New income = ₹125 New expenditure = ₹80 + 20% = ₹96 New savings = ₹125 - ₹96 = ₹29 Increase in savings = ₹29 - ₹20 = ₹9 Percentage increase = (9/20) × 100 = 45%
Answer: 45%
Problem: A train 150 meters long is running at a speed of 60 km/h. In how much time will it pass a pole?
Solution: Speed = 60 km/h = 60 × 5/18 = 50/3 m/s Distance = 150 meters Time = Distance/Speed = 150 / (50/3) = 150 × 3/50 = 9 seconds
Answer: 9 seconds
Problem: If the sum of the first n natural numbers is 210, what is the value of n?
Solution: Sum = n(n + 1)/2 = 210 n(n + 1) = 420 n² + n - 420 = 0 (n + 21)(n - 20) = 0 n = 20 (positive value)
Answer: 20
Problem: A man invests ₹10,000 in a scheme which offers 10% per annum compound interest. Find the amount after 2 years.
Solution: Principal = ₹10,000 Rate = 10%, Time = 2 years Amount = P(1 + R/100)² = 10000(1 + 10/100)² = 10000(1.1)² = 10000 × 1.21 = ₹12,100
Answer: ₹12,100
Problem: What is the output?
#include <stdio.h>int main() { int arr[2][3] = {{1, 2, 3}, {4, 5, 6}}; int (*p)[3] = arr; printf("%d %d\n", *(*(p+1)+1), p[0][2]); return 0;}Solution: p points to first row p+1 points to second row *(p+1) points to first element of second row = 4 *(p+1)+1 points to second element of second row = 5 ((p+1)+1) = arr[1][1] = 5 p[0][2] = arr[0][2] = 3
Answer: 5 3
Problem: What is the output?
#include <stdio.h>int add(int a, int b) { return a + b; }int multiply(int a, int b) { return a * b; }
int main() { int (*func)(int, int) = add; printf("%d ", func(5, 3)); func = multiply; printf("%d\n", func(5, 3)); return 0;}Solution: func initially points to add: func(5, 3) = add(5, 3) = 8 func then points to multiply: func(5, 3) = multiply(5, 3) = 15
Answer: 8 15
Problem: What is the output?
#include <stdio.h>int main() { char *str = "ZOHO2025"; printf("%s ", str + 4); printf("%c\n", *(str + 3)); return 0;}Solution: str points to “ZOHO2025” str + 4 points to “2025” *(str + 3) = ‘O’
Answer: 2025 O
Problem: What is the output?
#include <stdio.h>int main() { int x = 10; int y = x-- - --x; printf("%d\n", y); return 0;}Solution: This is undefined behavior. The order of evaluation of x— and —x is unspecified, and modifying x twice between sequence points leads to undefined behavior.
Answer: Undefined behavior
Problem: What is the output?
#include <stdio.h>int main() { int a = 5; int b = 0; int c = a / b; printf("%d\n", c); return 0;}Solution: Division by zero causes undefined behavior. The program may crash or produce unpredictable results.
Answer: Undefined behavior (runtime error)
Problem: What is the output?
#include <stdio.h>int main() { int a = 5, b = 10; int *p = &a, *q = &b; *p = *p * *q; *q = *p / *q; *p = *p / *q; printf("%d %d\n", a, b); return 0;}Solution: *p = 5 * 10 = 50 (a = 50) *q = 50 / 10 = 5 (b = 5) *p = 50 / 5 = 10 (a = 10) Final: a = 10, b = 5
Answer: 10 5
Problem: What is the output?
#include <stdio.h>int main() { int i = 0; while (i < 5); { printf("%d", i); i++; } return 0;}Solution: The semicolon after while creates an infinite loop. The code block after is never executed. The program will hang or loop indefinitely.
Answer: Infinite loop (program hangs)
Problem: What is the output?
#include <stdio.h>int main() { int x = 10; if (x = 5) printf("Five"); else printf("Not Five"); return 0;}Solution: x = 5 is assignment, not comparison. It assigns 5 to x and returns 5 (non-zero, true). So “Five” is printed.
Answer: Five
Problem: What is the output?
#include <stdio.h>int main() { int *ptr; *ptr = 10; printf("%d\n", *ptr); return 0;}Solution: ptr is uninitialized and points to garbage memory. Dereferencing it causes undefined behavior. The program may crash or print garbage value.
Answer: Undefined behavior (crash or garbage value)
Problem: What is the output?
#include <stdio.h>int main() { int i = 4; printf("%d ", i--); printf("%d\n", --i); return 0;}Solution: First printf: i— uses 4, then i becomes 3 Second printf: —i decrements first, i becomes 2, prints 2
Answer: 4 2
Problem: What is the output?
#include <stdio.h>int main() { int x = 15; int y = x-- + --x; printf("%d\n", y); return 0;}Solution: This is undefined behavior. Modifying x twice between sequence points (x— and —x) leads to undefined behavior.
Answer: Undefined behavior
Problem: What is the output?
#include <stdio.h>int main() { int x = 10; int *p = &x; int **q = &p; printf("%d %d %d\n", x, *p, **q); return 0;}Solution: x = 10 p = &x, so *p = 10 q = &p, so *q = p = &x, so **q = *p = 10
Answer: 10 10 10
Problem: What is the output?
#include <stdio.h>int main() { int arr[5] = {1, 2, 3, 4, 5}; int *p = arr; printf("%d %d\n", *(p + 3), arr[3]); return 0;}Solution: p points to arr[0] *(p + 3) = arr[3] = 4 arr[3] = 4
Answer: 4 4
Problem: What is the output?
#include <stdio.h>int main() { char str[] = "ZOHO2025"; char *ptr = str; printf("%c %s\n", *(ptr + 4), ptr + 5); return 0;}Solution: ptr points to “ZOHO2025” *(ptr + 4) = ‘2’ ptr + 5 points to “025”
Answer: 2 025
Problem: What is the output?
#include <stdio.h>int main() { int a = 5; printf("%d %d %d\n", a, a++, a--); return 0;}Solution: This is undefined behavior. The order of evaluation of function arguments is unspecified, and modifying a variable multiple times between sequence points leads to undefined behavior.
Answer: Undefined behavior
Problem: What is the output?
#include <stdio.h>int main() { int a = 8; int b = 12; int c = a > b ? a : (b > 10 ? b : 0); printf("%d\n", c); return 0;}Solution: a > b is false (8 > 12 is false) So evaluate: b > 10 ? b : 0 b > 10 is true (12 > 10) So c = b = 12
Answer: 12
Q17: Pointer Arithmetic
What is the output?
int arr[] = {1,2,3,4,5};int *ptr = arr + 2;printf("%d", *(ptr+1));Solution:
arr points to arr[0] = 1arr + 2 points to arr[2] = 3ptr = arr + 2, so ptr points to arr[2] = 3ptr+1 points to arr[3] = 4*(ptr+1) = arr[3] = 4Answer: 4
Q18: Array of Pointers
What is the output?
int a = 10, b = 20, c = 30;int *arr[] = {&a, &b, &c};printf("%d %d", *arr[0], *(arr[1]+1));Solution:
arr[0] = &a, so *arr[0] = a = 10arr[1] = &b, arr[1]+1 points to memory after b (undefined behavior)Answer: 10 (second value is undefined)
Q19: Recursive Function
What is the output?
int func(int n) { if(n <= 1) return 1; return n * func(n-2);}printf("%d", func(5));Solution:
func(5) = 5 * func(3)func(3) = 3 * func(1)func(1) = 1func(3) = 3 * 1 = 3func(5) = 5 * 3 = 15Answer: 15
Q20: Nested Loops
What is the output?
for(int i=1;i<=3;i++){ for(int j=1;j<=i;j++){ printf("%d", i*j); } printf("\\n");}Solution:
i=1: j=1, prints 1*1=1, newlinei=2: j=1, prints 2*1=2; j=2, prints 2*2=4, newlinei=3: j=1, prints 3*1=3; j=2, prints 3*2=6; j=3, prints 3*3=9, newlineAnswer:
124369Q21: Complex Recursion (Fibonacci)
What is the output?
int f(int n) { if(n == 0) return 0; if(n == 1) return 1; return f(n-1) + f(n-2);}printf("%d", f(6));Solution:
This is Fibonacci sequence:f(0)=0, f(1)=1f(2)=f(1)+f(0)=1+0=1f(3)=f(2)+f(1)=1+1=2f(4)=f(3)+f(2)=2+1=3f(5)=f(4)+f(3)=3+2=5f(6)=f(5)+f(4)=5+3=8Answer: 8
Problem: What is the output?
char *arr[] = {"ZOHO", "CORP", "INDIA"};char **p = arr;printf("%s ", *(p+1));printf("%c", *(*(p+2)+2));Solution: arr[0] = “ZOHO”, arr[1] = “CORP”, arr[2] = “INDIA” p = arr, so p points to arr[0] p+1 points to arr[1] = “CORP” *(p+1) = arr[1] = “CORP” p+2 points to arr[2] = “INDIA” *(p+2) = “INDIA” (points to first char ‘I’) *(p+2)+2 points to 3rd char of “INDIA” = ‘D’ ((p+2)+2) = ‘D’
Answer: CORP D
Problem: What is the output?
int a[][3] = {{1,2,3},{4,5,6},{7,8,9}};int *p = &a[0][0];int (*q)[3] = a;printf("%d ", *(p+5));printf("%d", q[1][2]);Solution: p points to a[0][0] = 1 p+5 points to 6th element in row-major order = a[1][2] = 6 *(p+5) = 6 q[1][2] = a[1][2] = 6
Answer: 6 6
Problem: What is the output?
void print(char *s) { if(*s) { print(s+1); printf("%c", *s); }}print("ZOHO");Solution: This recursively prints string in reverse: print(“ZOHO”) calls print(“OHO”) print(“OHO”) calls print(“HO”) print(“HO”) calls print(“O”) print(“O”) calls print("") print("") returns (base case) Then prints: ‘O’, ‘H’, ‘O’, ‘Z’
Answer: OHOZ
Problem: Find the first non-repeating character in a string.
Solution (C):
#include <stdio.h>#include <string.h>
char firstNonRepeating(char str[]) { int count[256] = {0}; int len = strlen(str);
// Count frequency of each character for (int i = 0; i < len; i++) count[(int)str[i]]++;
// Find first character with count 1 for (int i = 0; i < len; i++) { if (count[(int)str[i]] == 1) return str[i]; } return '\0';}
int main() { char str[100]; printf("Enter string: "); gets(str); char result = firstNonRepeating(str); if (result) printf("First non-repeating: %c\n", result); else printf("No non-repeating character\n"); return 0;}Problem: Rotate an array by K steps.
Solution (C):
#include <stdio.h>
void rotateArray(int arr[], int n, int k) { k = k % n; int temp[k];
// Store last k elements for (int i = 0; i < k; i++) temp[i] = arr[n - k + i];
// Shift remaining elements for (int i = n - 1; i >= k; i--) arr[i] = arr[i - k];
// Place stored elements at beginning for (int i = 0; i < k; i++) arr[i] = temp[i];}
int main() { int arr[] = {1, 2, 3, 4, 5}; int n = 5, k = 2; rotateArray(arr, n, k); for (int i = 0; i < n; i++) printf("%d ", arr[i]); return 0;}Problem: Print the Fibonacci series up to N terms.
Solution (C):
#include <stdio.h>
void fibonacci(int n) { int a = 0, b = 1, next; if (n >= 1) printf("%d ", a); if (n >= 2) printf("%d ", b);
for (int i = 3; i <= n; i++) { next = a + b; printf("%d ", next); a = b; b = next; } printf("\n");}
int main() { int n; printf("Enter N: "); scanf("%d", &n); fibonacci(n); return 0;}Problem: Write a program to find the second largest element in an array.
Solution (C):
#include <stdio.h>
int secondLargest(int arr[], int n) { int first = arr[0], second = -1;
for (int i = 1; i < n; i++) { if (arr[i] > first) { second = first; first = arr[i]; } else if (arr[i] > second && arr[i] != first) { second = arr[i]; } } return second;}
int main() { int arr[] = {12, 35, 1, 10, 34, 1}; int n = 6; printf("Second largest: %d\n", secondLargest(arr, n)); return 0;}Problem: Write a program to check if a given string is a palindrome.
Solution (C):
#include <stdio.h>#include <string.h>
int isPalindrome(char str[]) { int len = strlen(str); int start = 0, end = len - 1; while (start < end) { if (str[start] != str[end]) return 0; start++; end--; } return 1;}Problem: Implement a function to find the factorial of a number using iteration.
Solution (C):
#include <stdio.h>
int factorial(int n) { int result = 1; for (int i = 2; i <= n; i++) result *= i; return result;}Problem: Write a program to check if a given number is even or odd.
Solution (C):
#include <stdio.h>
int main() { int num; printf("Enter a number: "); scanf("%d", &num); if (num % 2 == 0) printf("%d is even\n", num); else printf("%d is odd\n", num); return 0;}Problem: Write a program to check if a number is a perfect square.
Solution (C):
#include <stdio.h>#include <math.h>
int isPerfectSquare(int n) { int root = sqrt(n); return root * root == n;}Problem: Implement a function to find the sum of all prime numbers up to a given number.
Solution (C):
#include <stdio.h>
int isPrime(int n) { if (n <= 1) return 0; for (int i = 2; i * i <= n; i++) { if (n % i == 0) return 0; } return 1;}
int sumOfPrimes(int n) { int sum = 0; for (int i = 2; i <= n; i++) { if (isPrime(i)) sum += i; } return sum;}Problem: Write a program to reverse the words in a given sentence.
Solution (C):
#include <stdio.h>#include <string.h>
void reverseWords(char str[]) { int len = strlen(str); int start = 0; for (int i = 0; i <= len; i++) { if (str[i] == ' ' || str[i] == '\0') { int end = i - 1; while (start < end) { char temp = str[start]; str[start] = str[end]; str[end] = temp; start++; end--; } start = i + 1; } }}Problem: Implement a function to find the longest common prefix among a set of strings.
Solution (C):
#include <stdio.h>#include <string.h>
void longestCommonPrefix(char strs[][100], int n, char result[]) { if (n == 0) { result[0] = '\0'; return; } int minLen = strlen(strs[0]); for (int i = 1; i < n; i++) { int len = strlen(strs[i]); if (len < minLen) minLen = len; } int idx = 0; for (int i = 0; i < minLen; i++) { char c = strs[0][i]; for (int j = 1; j < n; j++) { if (strs[j][i] != c) { result[idx] = '\0'; return; } } result[idx++] = c; } result[idx] = '\0';}Problem: Write a program to implement a simple calculator that can perform basic arithmetic operations.
Solution (C):
#include <stdio.h>
int main() { char op; float a, b; printf("Enter operator (+, -, *, /): "); scanf(" %c", &op); printf("Enter two numbers: "); scanf("%f %f", &a, &b); switch(op) { case '+': printf("%.2f\n", a + b); break; case '-': printf("%.2f\n", a - b); break; case '*': printf("%.2f\n", a * b); break; case '/': if (b != 0) printf("%.2f\n", a / b); else printf("Division by zero!\n"); break; default: printf("Invalid operator\n"); } return 0;}Problem: Write a program to check if a number is a Harshad number (divisible by sum of its digits).
Solution (C):
#include <stdio.h>
int sumOfDigits(int n) { int sum = 0; while (n > 0) { sum += n % 10; n /= 10; } return sum;}
int isHarshad(int n) { int sum = sumOfDigits(n); return (n % sum == 0);}Problem: Write a program to check if a number is a strong number (sum of factorial of digits equals the number).
Solution (C):
#include <stdio.h>
int factorial(int n) { if (n <= 1) return 1; return n * factorial(n - 1);}
int isStrong(int n) { int original = n, sum = 0; while (n > 0) { sum += factorial(n % 10); n /= 10; } return sum == original;}Problem: Write a program to convert a decimal number to its hexadecimal equivalent.
Solution (C):
#include <stdio.h>
void decimalToHex(int n) { char hex[100]; int i = 0; while (n > 0) { int rem = n % 16; if (rem < 10) hex[i++] = rem + '0'; else hex[i++] = rem - 10 + 'A'; n /= 16; } for (int j = i - 1; j >= 0; j--) printf("%c", hex[j]); printf("\n");}Problem: Write a program to implement the insertion sort algorithm.
Solution (C):
#include <stdio.h>
void insertionSort(int arr[], int n) { for (int i = 1; i < n; i++) { int key = arr[i]; int j = i - 1; while (j >= 0 && arr[j] > key) { arr[j + 1] = arr[j]; j--; } arr[j + 1] = key; }}Q17: Pyramid Pattern
Write a program to print pyramid pattern:
* *** ***** *******Solution (C):
#include <stdio.h>int main() { int n = 4; for(int i=1; i<=n; i++) { for(int j=1; j<=n-i; j++) printf(" "); for(int j=1; j<=2*i-1; j++) printf("*"); printf("\\n"); } return 0;}Q18: Number Pattern
Write a program to print:
1223334444Solution (C):
#include <stdio.h>int main() { int n = 4; for(int i=1; i<=n; i++) { for(int j=1; j<=i; j++) { printf("%d", i); } printf("\\n"); } return 0;}Q19: Sort Odd-Even Indexed
Sort odd-indexed elements descending, even-indexed ascending.
Input: [13,2,4,15,12,10,5] Output: [13,2,12,10,5,15,4]
Solution (C):
#include <stdio.h>void sortArray(int arr[], int n) { // Sort even indices (0,2,4...) ascending for(int i=0; i<n; i+=2) { for(int j=i+2; j<n; j+=2) { if(arr[i] > arr[j]) { int temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; } } } // Sort odd indices (1,3,5...) descending for(int i=1; i<n; i+=2) { for(int j=i+2; j<n; j+=2) { if(arr[i] < arr[j]) { int temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; } } }}Q20: Remove Duplicates
Remove duplicates from array while maintaining order.
Input: [1,2,2,3,4,4,5] Output: [1,2,3,4,5]
Solution (C):
#include <stdio.h>int removeDuplicates(int arr[], int n) { if(n == 0) return 0; int j = 0; for(int i=1; i<n; i++) { if(arr[i] != arr[j]) { j++; arr[j] = arr[i]; } } return j+1;}Q21: Remove Vowels with Condition
Remove vowels from string, but if 2+ vowels together, ignore all.
Input: “beautiful” Output: “btfl”
Solution (C):
#include <stdio.h>#include <string.h>#include <ctype.h>
int isVowel(char c) { c = tolower(c); return (c=='a' || c=='e' || c=='i' || c=='o' || c=='u');}
void removeVowels(char str[]) { int len = strlen(str); int consecutive = 0; int j = 0;
for(int i=0; i<len; i++) { if(isVowel(str[i])) { consecutive++; } else { if(consecutive < 2) { // Add vowels if less than 2 consecutive for(int k=0; k<consecutive; k++) { str[j++] = str[i-consecutive+k]; } } consecutive = 0; str[j++] = str[i]; } } str[j] = '\\0';}Q22: Reverse Words in String
Reverse words in a string.
Input: “hello world” Output: “world hello”
Solution (C):
#include <stdio.h>#include <string.h>
void reverseWords(char str[]) { int len = strlen(str); // Reverse entire string for(int i=0; i<len/2; i++) { char temp = str[i]; str[i] = str[len-1-i]; str[len-1-i] = temp; } // Reverse each word int start = 0; for(int i=0; i<=len; i++) { if(str[i]==' ' || str[i]=='\\0') { for(int j=start; j<(start+i)/2; j++) { char temp = str[j]; str[j] = str[start+i-1-j]; str[start+i-1-j] = temp; } start = i+1; } }}Problem: Implement a function to check if a given binary tree is a Binary Search Tree (BST).
Solution (C):
#include <stdio.h>#include <limits.h>
struct Node { int data; struct Node *left, *right;};
int isBSTUtil(struct Node *node, int min, int max) { if (node == NULL) return 1; if (node->data < min || node->data > max) return 0; return isBSTUtil(node->left, min, node->data - 1) && isBSTUtil(node->right, node->data + 1, max);}
int isBST(struct Node *node) { return isBSTUtil(node, INT_MIN, INT_MAX);}Problem: Given a set of intervals, merge all overlapping intervals and return the non-overlapping intervals.
Solution (C):
#include <stdio.h>#include <stdlib.h>
struct Interval { int start; int end;};
int compare(const void *a, const void *b) { struct Interval *i1 = (struct Interval *)a; struct Interval *i2 = (struct Interval *)b; return i1->start - i2->start;}
void mergeIntervals(struct Interval arr[], int n) { qsort(arr, n, sizeof(arr[0]), compare); int index = 0;
for (int i = 1; i < n; i++) { if (arr[index].end >= arr[i].start) { arr[index].end = (arr[index].end > arr[i].end) ? arr[index].end : arr[i].end; } else { index++; arr[index] = arr[i]; } }
for (int i = 0; i <= index; i++) printf("[%d, %d] ", arr[i].start, arr[i].end);}Problem: Develop a program to help a user find new friends in a social network based on given input data (mutual friends, interests, etc.).
Solution Structure:
struct User { int id; char name[50]; int friends[100]; int friendCount; char interests[10][50]; int interestCount;};
// Implement functions:// - findMutualFriends() - Find users with mutual connections// - findSimilarInterests() - Match based on interests// - recommendFriends() - Suggest new friends// - File operations for user dataProblem: Implement a function to perform matrix multiplication.
Solution (C):
#include <stdio.h>
void matrixMultiply(int A[][10], int B[][10], int C[][10], int m, int n, int p) { for (int i = 0; i < m; i++) { for (int j = 0; j < p; j++) { C[i][j] = 0; for (int k = 0; k < n; k++) { C[i][j] += A[i][k] * B[k][j]; } } }}Problem: Write a program to implement the quicksort algorithm.
Solution (C):
#include <stdio.h>
int partition(int arr[], int low, int high) { int pivot = arr[high]; int i = low - 1; for (int j = low; j < high; j++) { if (arr[j] < pivot) { i++; int temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; } } int temp = arr[i + 1]; arr[i + 1] = arr[high]; arr[high] = temp; return i + 1;}
void quickSort(int arr[], int low, int high) { if (low < high) { int pi = partition(arr, low, high); quickSort(arr, low, pi - 1); quickSort(arr, pi + 1, high); }}Problem: Implement a function to perform binary search on a sorted array.
Solution (C):
#include <stdio.h>
int binarySearch(int arr[], int n, int key) { int left = 0, right = n - 1; while (left <= right) { int mid = left + (right - left) / 2; if (arr[mid] == key) return mid; if (arr[mid] < key) left = mid + 1; else right = mid - 1; } return -1;}Problem: Write a program to implement the merge sort algorithm.
Solution (C):
#include <stdio.h>
void merge(int arr[], int left, int mid, int right) { int n1 = mid - left + 1, n2 = right - mid; int L[n1], R[n2]; for (int i = 0; i < n1; i++) L[i] = arr[left + i]; for (int j = 0; j < n2; j++) R[j] = arr[mid + 1 + j]; int i = 0, j = 0, k = left; while (i < n1 && j < n2) { if (L[i] <= R[j]) arr[k++] = L[i++]; else arr[k++] = R[j++]; } while (i < n1) arr[k++] = L[i++]; while (j < n2) arr[k++] = R[j++];}
void mergeSort(int arr[], int left, int right) { if (left < right) { int mid = left + (right - left) / 2; mergeSort(arr, left, mid); mergeSort(arr, mid + 1, right); merge(arr, left, mid, right); }}Problem: Write a C program to implement a linked list and perform insertion, deletion, and traversal operations.
Solution Structure:
#include <stdio.h>#include <stdlib.h>
struct Node { int data; struct Node *next;};
// Implement functions:// - insertAtBeginning()// - insertAtEnd()// - deleteNode()// - traverse()// - search()Problem: Implement a stack using an array with push, pop, and peek operations.
Solution (C):
#include <stdio.h>#define MAX 100
struct Stack { int arr[MAX]; int top;};
void push(struct Stack *s, int value) { if (s->top < MAX - 1) s->arr[++s->top] = value;}
int pop(struct Stack *s) { if (s->top >= 0) return s->arr[s->top--]; return -1;}
int peek(struct Stack *s) { if (s->top >= 0) return s->arr[s->top]; return -1;}Problem: Implement a queue using an array with enqueue and dequeue operations.
Solution (C):
#include <stdio.h>#define MAX 100
struct Queue { int arr[MAX]; int front, rear;};
void enqueue(struct Queue *q, int value) { if (q->rear < MAX - 1) q->arr[++q->rear] = value;}
int dequeue(struct Queue *q) { if (q->front <= q->rear) return q->arr[q->front++]; return -1;}Problem: Implement a binary search tree and perform insertion, deletion, and inorder traversal.
Solution Structure:
#include <stdio.h>#include <stdlib.h>
struct Node { int data; struct Node *left, *right;};
// Implement functions:// - insert()// - delete()// - inorderTraversal()// - search()Problem: Implement a function to find the longest common subsequence of two strings.
Solution (C):
#include <stdio.h>#include <string.h>
int lcs(char X[], char Y[], int m, int n) { int dp[m + 1][n + 1]; for (int i = 0; i <= m; i++) { for (int j = 0; j <= n; j++) { if (i == 0 || j == 0) dp[i][j] = 0; else if (X[i - 1] == Y[j - 1]) dp[i][j] = dp[i - 1][j - 1] + 1; else dp[i][j] = (dp[i - 1][j] > dp[i][j - 1]) ? dp[i - 1][j] : dp[i][j - 1]; } } return dp[m][n];}Problem: Find the maximum subarray sum using Kadane’s algorithm.
Solution (C):
#include <stdio.h>
int maxSubarraySum(int arr[], int n) { int maxSoFar = arr[0], maxEndingHere = arr[0]; for (int i = 1; i < n; i++) { maxEndingHere = (maxEndingHere + arr[i] > arr[i]) ? maxEndingHere + arr[i] : arr[i]; maxSoFar = (maxEndingHere > maxSoFar) ? maxEndingHere : maxSoFar; } return maxSoFar;}Problem: Implement a LRU (Least Recently Used) cache.
Solution Structure:
// Use doubly linked list + hash table// Implement get() and put() operations// Maintain capacity and evict least recently used itemsProblem: Implement Breadth-First Search (BFS) traversal of a graph.
Solution (C):
#include <stdio.h>#include <stdlib.h>
void BFS(int graph[][10], int start, int n) { int visited[10] = {0}; int queue[10], front = 0, rear = 0; visited[start] = 1; queue[rear++] = start; while (front < rear) { int node = queue[front++]; printf("%d ", node); for (int i = 0; i < n; i++) { if (graph[node][i] && !visited[i]) { visited[i] = 1; queue[rear++] = i; } } }}Problem: Implement Depth-First Search (DFS) traversal of a graph.
Solution (C):
#include <stdio.h>
void DFS(int graph[][10], int visited[], int node, int n) { visited[node] = 1; printf("%d ", node); for (int i = 0; i < n; i++) { if (graph[node][i] && !visited[i]) { DFS(graph, visited, i, n); } }}Problem: Implement Dijkstra’s algorithm for finding the shortest path in a graph.
Solution Structure:
// Use priority queue or min-heap// Maintain distance array// Update distances for all neighbors// Return shortest path distancesProblem: Implement the KMP (Knuth-Morris-Pratt) string matching algorithm.
Solution (C):
#include <stdio.h>#include <string.h>
void computeLPS(char pattern[], int lps[], int m) { int len = 0, i = 1; lps[0] = 0; while (i < m) { if (pattern[i] == pattern[len]) { len++; lps[i] = len; i++; } else { if (len != 0) len = lps[len - 1]; else { lps[i] = 0; i++; } } }}
void KMPSearch(char text[], char pattern[]) { int n = strlen(text), m = strlen(pattern); int lps[m]; computeLPS(pattern, lps, m); int i = 0, j = 0; while (i < n) { if (pattern[j] == text[i]) { i++; j++; } if (j == m) { printf("Found at index %d\n", i - j); j = lps[j - 1]; } else if (i < n && pattern[j] != text[i]) { if (j != 0) j = lps[j - 1]; else i++; } }}Problem: Print the following pattern:
1 232 345434567654Solution (C):
#include <stdio.h>int main() { int n = 4; for(int i=1; i<=n; i++) { // Spaces for(int j=1; j<=n-i; j++) printf(" "); // Increasing numbers for(int j=i; j<=2*i-1; j++) printf("%d", j); // Decreasing numbers for(int j=2*i-2; j>=i; j--) printf("%d", j); printf("\n"); } return 0;}Problem: Remove vowels from string, but if 2+ vowels together, ignore all.
Input: “beautiful” Output: “btfl”
Solution (C):
#include <stdio.h>#include <string.h>#include <ctype.h>
int isVowel(char c) { c = tolower(c); return (c=='a' || c=='e' || c=='i' || c=='o' || c=='u');}
void removeVowels(char str[]) { int len = strlen(str); int consecutive = 0; int j = 0;
for(int i=0; i<len; i++) { if(isVowel(str[i])) { consecutive++; } else { if(consecutive < 2) { // Add vowels if less than 2 consecutive for(int k=0; k<consecutive; k++) { str[j++] = str[i-consecutive+k]; } } consecutive = 0; str[j++] = str[i]; } } str[j] = '\0';}Problem: Rotate array left by k positions, then find element at index.
Input: arr = [1,2,3,4,5], k = 2, index = 1 After rotation: [3,4,5,1,2] Output: 4 (element at index 1)
Solution (C):
#include <stdio.h>
void rotateLeft(int arr[], int n, int k) { k = k % n; int temp[k]; // Store first k elements for(int i=0; i<k; i++) temp[i] = arr[i]; // Shift remaining elements for(int i=0; i<n-k; i++) arr[i] = arr[i+k]; // Place stored elements at end for(int i=0; i<k; i++) arr[n-k+i] = temp[i];}Problem: Compress string by replacing consecutive characters with count.
Input: “aaabbcccdd” Output: “a3b2c3d2”
Solution (C):
#include <stdio.h>#include <string.h>
void compress(char str[]) { int len = strlen(str); int count = 1; int j = 0;
for(int i=1; i<=len; i++) { if(str[i] == str[i-1]) { count++; } else { str[j++] = str[i-1]; if(count > 1) { char num[10]; sprintf(num, "%d", count); for(int k=0; num[k]; k++) str[j++] = num[k]; } count = 1; } } str[j] = '\0';}Problem: Find sum of elements in each row and column of matrix.
Input:
1 2 34 5 67 8 9Output: Row sums: 6, 15, 24 Column sums: 12, 15, 18
Solution (C):
#include <stdio.h>
void rowColumnSum(int mat[][3], int rows, int cols) { // Row sums for(int i=0; i<rows; i++) { int sum = 0; for(int j=0; j<cols; j++) sum += mat[i][j]; printf("Row %d sum: %d\n", i+1, sum); } // Column sums for(int j=0; j<cols; j++) { int sum = 0; for(int i=0; i<rows; i++) sum += mat[i][j]; printf("Column %d sum: %d\n", j+1, sum); }}Problem: Build a quiz application with:
Key Features Required:
Solution Structure:
#include <stdio.h>#include <string.h>
struct Question { char question[200]; char options[4][100]; int correctAnswer;};
// Implement functions: loadQuestions, displayQuestion, checkAnswer, calculateScore, saveResultsProblem: Build an inventory system with:
Key Features:
Solution:
struct Product { int id; char name[100]; int quantity; float price;};
// Implement functions: addProduct, removeProduct, updateStock, searchProduct, generateReport, saveToFileProblem: Build a student management system with:
Key Features:
Solution Structure:
struct Student { int rollNo; char name[50]; float marks[5]; float gpa;};
// Implement functions: addStudent, removeStudent, updateStudent,// searchStudent, calculateGPA, generateReport, saveToFile, loadFromFileProblem: Build a ticket booking system with:
Key Features:
Solution Structure:
struct Show { int id; char name[100]; char time[20]; int totalSeats; int availableSeats; int seats[100]; // 0 = available, 1 = booked};
struct Booking { int bookingId; int showId; char customerName[50]; int seats[10]; int seatCount;};
// Implement functions: addShow, bookTicket, cancelBooking,// viewBookings, saveToFile, loadFromFileQ5: Address Book Application
Build an address book with:
Solution Structure:
#include <stdio.h>#include <string.h>
struct Contact { char name[50]; char phone[15]; char email[50];};
void addContact(struct Contact contacts[], int *count) { // Implementation}
void searchContact(struct Contact contacts[], int count) { // Implementation}
void deleteContact(struct Contact contacts[], int *count) { // Implementation}
void saveToFile(struct Contact contacts[], int count) { // File handling}
int main() { struct Contact contacts[100]; int count = 0; int choice;
while(1) { printf("\\n1. Add Contact\\n2. Search\\n3. Delete\\n4. Display All\\n5. Save\\n6. Exit\\n"); scanf("%d", &choice); // Menu-driven implementation } return 0;}Q6: Banking System Application
Build a banking system with:
Key Features:
Hiring Volume
Salary Packages
New Initiatives
C Output Prediction
Coding Problems
Application Round
Technical Interview
Round 1 (Aptitude & C Programming Test):
Round 2 (Basic Programming - 5 problems):
Round 3 (Application Round):
Round 4 (Technical Interview):
Round 5 (HR Interview):
15-Day Study Plan
Follow the structured 15-day study plan covering all Zoho placement topics from basics to advanced.
Round-Wise Strategy
GitHub Resources
Access comprehensive Zoho preparation materials including round-wise questions and practice problems.
Practice 2025 papers for current year preparation! Download the papers above and start practicing today. Focus on C programming mastery, application building, and code quality.