Zoho 2024 C Output Questions
Complete collection of 2024 C output prediction questions with detailed explanations
Access free Zoho placement papers 2024, previous year C programming questions with solutions, exam pattern, interview questions, and complete preparation guide. Download Zoho 2024 placement papers PDF.
This page contains Zoho placement papers from 2024 with detailed solutions, exam patterns, and preparation insights. Use these previous year papers to understand the 2024 Zoho placement pattern and prepare effectively for current year exams.
Zoho 2024 C Output Questions
Complete collection of 2024 C output prediction questions with detailed explanations
Zoho 2024 Coding Problems
All coding problems from 2024 placement papers with solutions
Zoho 2024 Aptitude Questions
Quantitative aptitude questions from 2024 Zoho placement papers
Zoho 2024 Interview Experience
Real interview experiences from candidates who cleared 2024 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 2024:
This section contains real questions from Zoho placement papers 2024 based on candidate experiences and actual exam patterns.
Problem: If the sum of three consecutive integers is 72, what is the smallest of these integers?
Solution: Let the integers be x, x+1, and x+2. x + (x + 1) + (x + 2) = 72 3x + 3 = 72 3x = 69 x = 23
Therefore, the integers are 23, 24, and 25.
Answer: 23
Problem: A train 150 meters long passes a pole in 15 seconds. What is its speed in km/hr?
Solution: Distance = 150 meters = 0.15 km Time = 15 seconds = 15/3600 hours = 1/240 hours Speed = Distance/Time = 0.15 / (1/240) = 0.15 × 240 = 36 km/hr
Answer: 36 km/hr
Problem: If the cost price of a pen is ₹40 and it is sold at a 25% profit, what is the selling price?
Solution: Profit = 25% of ₹40 = ₹10 Selling Price = Cost Price + Profit = ₹40 + ₹10 = ₹50
Answer: ₹50
Problem: A and B can complete a job in 10 and 20 days respectively. How long will it take them to complete the job together?
Solution: A’s work per day = 1/10 B’s work per day = 1/20 Combined work per day = 1/10 + 1/20 = 3/20 Time taken together = 20/3 = 6.67 days
Answer: 6.67 days (or 6 days and 16 hours)
Problem: If the sum of the first 50 natural numbers is S, what is the value of S?
Solution: Sum of first n natural numbers = n(n + 1)/2 For n = 50: S = 50 × 51 / 2 = 1275
Answer: 1275
Problem: A person covers a certain distance at a speed of 60 km/h and returns at 40 km/h. What is the average speed for the entire journey?
Solution: Let distance = D km Time for forward journey = D/60 hours Time for return journey = D/40 hours Total time = D/60 + D/40 = D(2+3)/120 = 5D/120 = D/24 hours Total distance = 2D km Average speed = 2D / (D/24) = 2D × 24/D = 48 km/h
Answer: 48 km/h
Problem: If the cost price of 15 articles is equal to the selling price of 12 articles, find the profit percentage.
Solution: Let CP of 1 article = ₹1 CP of 15 articles = ₹15 SP of 12 articles = ₹15 (given) SP of 1 article = ₹15/12 = ₹1.25 Profit = SP - CP = ₹1.25 - ₹1 = ₹0.25 Profit % = (0.25/1) × 100 = 25%
Answer: 25%
Problem: The ratio of the ages of two persons is 4:3. After 6 years, the ratio becomes 9:7. What are their present ages?
Solution: Let present ages be 4x and 3x After 6 years: (4x + 6)/(3x + 6) = 9/7 7(4x + 6) = 9(3x + 6) 28x + 42 = 27x + 54 x = 12 Present ages: 4×12 = 48 years, 3×12 = 36 years
Answer: 48 years and 36 years
Problem: A sum of money doubles itself in 8 years at simple interest. What is the annual rate of interest?
Solution: Let Principal = P, Amount = 2P Interest = 2P - P = P SI = P × R × T / 100 P = P × R × 8 / 100 1 = 8R / 100 R = 100/8 = 12.5%
Answer: 12.5% per annum
Problem: A and B can complete a work in 12 days; B and C in 15 days; A and C in 20 days. How long will A, B, and C together take to complete the work?
Solution: (A+B)‘s 1 day work = 1/12 (B+C)‘s 1 day work = 1/15 (A+C)‘s 1 day work = 1/20 Adding: 2(A+B+C)‘s 1 day work = 1/12 + 1/15 + 1/20 = (5+4+3)/60 = 12/60 = 1/5 (A+B+C)‘s 1 day work = 1/10 Time taken = 10 days
Answer: 10 days
Problem: If the difference between the compound interest and simple interest on a certain sum for 2 years at 10% per annum is ₹25, what is the sum?
Solution: CI - SI = P[(1+R/100)² - 1] - (P×R×T/100) = P[(1.1)² - 1] - (P×10×2/100) = P[1.21 - 1] - 0.2P = 0.21P - 0.2P = 0.01P 0.01P = 25 P = ₹2500
Answer: ₹2500
Problem: A shopkeeper gives a discount of 10% on the marked price. If the selling price is ₹540, what was the marked price?
Solution: Let MP = ₹100 Discount = 10% of ₹100 = ₹10 SP = ₹100 - ₹10 = ₹90 When SP = ₹90, MP = ₹100 When SP = ₹540, MP = (540/90) × 100 = ₹600
Answer: ₹600
Problem: A train running at 60 km/h crosses a pole in 9 seconds. What is the length of the train?
Solution: Speed = 60 km/h = 60 × 5/18 = 50/3 m/s Time = 9 seconds Length = Speed × Time = (50/3) × 9 = 150 meters
Answer: 150 meters
Problem: A man can row 6 km/h in still water. If the river flows at 2 km/h, how long will he take to row 12 km upstream?
Solution: Speed in still water = 6 km/h Speed of stream = 2 km/h Upstream speed = 6 - 2 = 4 km/h Time = Distance/Speed = 12/4 = 3 hours
Answer: 3 hours
Problem: If the probability of an event occurring is 0.3, what is the probability of it not occurring?
Solution: P(not occurring) = 1 - P(occurring) = 1 - 0.3 = 0.7
Answer: 0.7 or 70%
Problem: A person bought 3 articles for ₹5 and sold them at 2 articles for ₹5. What is his gain or loss percentage?
Solution: CP of 3 articles = ₹5 CP of 1 article = ₹5/3 SP of 2 articles = ₹5 SP of 1 article = ₹5/2 = ₹2.5 Gain = ₹2.5 - ₹5/3 = ₹(7.5-5)/3 = ₹2.5/3 Gain % = (2.5/3) / (5/3) × 100 = (2.5/5) × 100 = 50%
Answer: 50% gain
Problem: If the average of five numbers is 25, what is their total sum?
Solution: Average = Sum / Count 25 = Sum / 5 Sum = 25 × 5 = 125
Answer: 125
Problem: Find the angle between the hour and minute hands of a clock at 4:20.
Solution: Hour hand at 4:20 = 4 + 20/60 = 4.33 hours Angle of hour hand = 4.33 × 30° = 130° Angle of minute hand = 20 × 6° = 120° Difference = 130° - 120° = 10°
Answer: 10°
Problem: How many ways can the letters in the word “ZOHO” be arranged?
Solution: Total letters = 4 All letters are distinct Number of arrangements = 4! = 24
Answer: 24 ways
Problem: A tap fills a tank in 5 hours, and another tap empties it in 7 hours. How long will it take to fill the tank if both taps are open?
Solution: Filling tap fills 1/5 of tank per hour Emptying tap empties 1/7 of tank per hour Net filling = 1/5 - 1/7 = (7-5)/35 = 2/35 per hour Time to fill = 1 / (2/35) = 35/2 = 17.5 hours
Answer: 17.5 hours
Problem: What will be the output of the following C code?
#include <stdio.h>int main() { int a = 5; printf("%d %d %d\n", a++, a++, ++a); return 0;}Solution: This code exhibits undefined behavior due to sequence point violations. The order of evaluation of function arguments in C is unspecified, and modifying a variable multiple times between sequence points leads to undefined behavior. The output may vary between compilers.
Answer: Undefined behavior (compiler-dependent)
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 + 2), arr[3]); printf("%d\n", p[4]); return 0;}Solution: p points to arr[0] *(p + 2) = arr[2] = 3 arr[3] = 4 p[4] = arr[4] = 5
Answer: 3 4 5
Problem: What is the output?
#include <stdio.h>int main() { char str[] = "ZOHO"; char *ptr = str; printf("%c %s\n", *ptr, ptr + 1); return 0;}Solution: ptr points to first character ‘Z’ *ptr = ‘Z’ ptr + 1 points to “OHO”
Answer: Z OHO
Problem: What is the output?
#include <stdio.h>int main() { int x = 5; printf("%d %d %d\n", x, x++, ++x); return 0;}Solution: This exhibits undefined behavior due to sequence point violations. The order of evaluation of function arguments is unspecified. Different compilers may produce different outputs.
Answer: Undefined behavior (compiler-dependent)
Problem: What is the output?
#include <stdio.h>int main() { int arr[5] = {1, 2, 3, 4, 5}; printf("%d\n", arr[5]); return 0;}Solution: Array indices are 0-4. arr[5] is out of bounds, accessing memory beyond the array. This may print garbage value or cause undefined behavior.
Answer: Undefined behavior (garbage value or crash)
Problem: What is the output?
#include <stdio.h>int main() { int a = 10, b = 20; int *p = &a, *q = &b; *p = *p + *q; *q = *p - *q; *p = *p - *q; printf("%d %d\n", a, b); return 0;}Solution: This swaps values using pointer arithmetic: *p = 10 + 20 = 30 (a = 30) *q = 30 - 20 = 10 (b = 10) *p = 30 - 10 = 20 (a = 20) Final: a = 20, b = 10
Answer: 20 10
Problem: What is the output?
#include <stdio.h>int main() { int i = 0; for (; i < 5; i++); printf("%d\n", i); return 0;}Solution: The semicolon after for loop makes it an empty loop. It executes 5 times (i = 0,1,2,3,4), then i becomes 5 and loop exits. printf prints 5.
Answer: 5
Problem: What is the output?
#include <stdio.h>int main() { int x = 5; printf("%d\n", x = x == 5); return 0;}Solution: x == 5 evaluates to 1 (true) x = 1 (assignment) printf prints 1
Answer: 1
Problem: What is the output?
#include <stdio.h>int main() { int a = 5, b = 10; int c = a-- - --b; printf("%d %d %d\n", a, b, c); return 0;}Solution: —b is evaluated first: b = 9 a— uses current value (5) then decrements: a = 4 c = 5 - 9 = -4
Answer: 4 9 -4
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 i = 1; while (i <= 5) printf("%d", i++); return 0;}Solution: Loop executes: i=1 prints 1, i=2 prints 2, i=3 prints 3, i=4 prints 4, i=5 prints 5, then i=6 and loop exits.
Answer: 12345
Problem: What is the output?
#include <stdio.h>int main() { int a = 5, b = 10; int c = a++ + b++; printf("%d %d %d\n", a, b, c); return 0;}Solution: c = 5 + 10 = 15 (uses current values) Then a becomes 6, b becomes 11
Answer: 6 11 15
Problem: What is the output?
#include <stdio.h>int main() { int a = 5; int b = 10; int c = a > b ? a : b; printf("%d\n", c); return 0;}Solution: a > b is false (5 > 10 is false) So c = b = 10
Answer: 10
Problem: What is the output?
#include <stdio.h>int main() { int a = 10; int b = 20; int c = a < b ? a++ : b++; printf("%d %d %d\n", a, b, c); return 0;}Solution: a < b is true (10 < 20) So c = a++ = 10 (uses current value) Then a becomes 11 b remains 20
Answer: 11 20 10
Problem: What is the output?
#include <stdio.h>int main() { int x = 5; 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?
int arr[] = {10, 20, 30, 40, 50};int *ptr = arr;printf("%d %d", *(ptr+2), ptr[3]);Solution: arr points to arr[0] = 10 ptr = arr, so ptr points to arr[0] ptr+2 points to arr[2] = 30 *(ptr+2) = arr[2] = 30 ptr[3] = arr[3] = 40
Answer: 30 40
Problem: What is the output?
int a = 5, b = 10, c = 15;int *arr[] = {&a, &b, &c};printf("%d %d", *arr[1], **(arr+2));Solution: arr[0] = &a, arr[1] = &b, arr[2] = &c *arr[1] = *(&b) = b = 10 arr+2 points to arr[2] = &c *(arr+2) = &c **(arr+2) = *(&c) = c = 15
Answer: 10 15
Problem: What is the output?
int func(int n) { if(n <= 1) return 1; return n * func(n-2);}printf("%d", func(6));Solution: func(6) = 6 * func(4) func(4) = 4 * func(2) func(2) = 2 * func(0) func(0) = 1 func(2) = 2 * 1 = 2 func(4) = 4 * 2 = 8 func(6) = 6 * 8 = 48
Answer: 48
Problem: What is the output?
char str[] = "ZOHO";char *p = str;printf("%c", ++*p++);printf(" %s", str);Solution: p points to ‘Z’ (str[0]) ++*p++ means: increment value at p, then increment p *p = ‘Z’, ++*p = ‘A’ (next ASCII), then p++ moves to next char So str becomes “AOHO” After p++, p points to ‘O’
Answer: A AOHO
Problem: What is the output?
int arr[3][3] = {{1,2,3},{4,5,6},{7,8,9}};int i, j, sum = 0;for(i=0; i<3; i++) { for(j=0; j<3; j++) { if(i == j || i+j == 2) sum += arr[i][j]; }}printf("%d", sum);Solution: Diagonal elements: arr[0][0]=1, arr[1][1]=5, arr[2][2]=9 Anti-diagonal: arr[0][2]=3, arr[2][0]=7 Note: arr[1][1] is counted once (both conditions) Sum = 1 + 5 + 9 + 3 + 7 = 25
Answer: 25
Problem: What is the output?
int f(int (*p)(int), int n) { if(n <= 1) return 1; return n * p(n-1);}int g(int n) { return f(g, n);}printf("%d", g(5));Solution: This is factorial calculation: g(5) = f(g, 5) = 5 * g(4) g(4) = f(g, 4) = 4 * g(3) g(3) = f(g, 3) = 3 * g(2) g(2) = f(g, 2) = 2 * g(1) g(1) = f(g, 1) = 1 g(2) = 2 * 1 = 2 g(3) = 3 * 2 = 6 g(4) = 4 * 6 = 24 g(5) = 5 * 24 = 120
Answer: 120
Q22: 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
Q23: 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)
Q24: Pointer to Pointer
What is the output?
int x = 5;int *p = &x;int **q = &p;printf("%d %d %d", x, *p, **q);Solution:
x = 5p = &x, so *p = x = 5q = &p, so *q = p = &x, so **q = *p = x = 5Answer: 5 5 5
Q25: 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
Q26: 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:
124369Q27: 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
Q28: Pointer to Array
What is the output?
int arr[3][3] = {{1,2,3},{4,5,6},{7,8,9}};int (*p)[3] = arr;printf("%d %d", *(*(p+1)+1), p[1][1]);Solution:
p points to first row of arrp+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] = 5p[1][1] = arr[1][1] = 5Answer: 5 5
Q29: Function Pointers
What is the output?
int add(int a, int b) { return a+b; }int mul(int a, int b) { return a*b; }
int (*func)(int, int) = add;printf("%d", func(3,4));func = mul;printf(" %d", func(3,4));Solution:
func initially points to add: func(3, 4) = add(3, 4) = 7func then points to multiply: func(3, 4) = multiply(3, 4) = 12Answer: 7 12
Problem: Design a system with the following functionalities:
Solution Structure:
#include <stdio.h>#include <string.h>
// Use hash table or structure to store variables// Maintain transaction stack for BEGIN/ROLLBACK/COMMIT// Implement SET, GET, UNSET, COUNT operations
struct Variable { char name[50]; int value;};
// Implement transaction management with stack// Track changes for rollback capabilityProblem: Write a program to check if a given number is prime.
Solution (C):
#include <stdio.h>#include <math.h>
int isPrime(int n) { if (n <= 1) return 0; if (n <= 3) return 1; if (n % 2 == 0 || n % 3 == 0) return 0;
for (int i = 5; i * i <= n; i += 6) { if (n % i == 0 || n % (i + 2) == 0) return 0; } return 1;}
int main() { int num; printf("Enter a number: "); scanf("%d", &num); if (isPrime(num)) printf("%d is prime\n", num); else printf("%d is not prime\n", num); return 0;}Problem: Reverse a given string without using any built-in functions.
Solution (C):
#include <stdio.h>#include <string.h>
void reverseString(char str[]) { int len = strlen(str); int start = 0, end = len - 1; while (start < end) { char temp = str[start]; str[start] = str[end]; str[end] = temp; start++; end--; }}
int main() { char str[100]; printf("Enter a string: "); gets(str); reverseString(str); printf("Reversed: %s\n", str); return 0;}Problem: Implement a function to count the number of vowels in a given string.
Solution (C):
#include <stdio.h>#include <ctype.h>
int countVowels(char str[]) { int count = 0; for (int i = 0; str[i] != '\0'; i++) { char c = tolower(str[i]); if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') count++; } return count;}
int main() { char str[100]; printf("Enter a string: "); gets(str); printf("Number of vowels: %d\n", countVowels(str)); return 0;}Problem: Write a program to check if a given number is a palindrome.
Solution (C):
#include <stdio.h>
int isPalindrome(int n) { int original = n, reversed = 0; while (n > 0) { reversed = reversed * 10 + n % 10; n /= 10; } return original == reversed;}
int main() { int num; printf("Enter a number: "); scanf("%d", &num); if (isPalindrome(num)) printf("%d is a palindrome\n", num); else printf("%d is not a palindrome\n", num); return 0;}Problem: Implement a function to find the factorial of a number using recursion.
Solution (C):
#include <stdio.h>
int factorial(int n) { if (n == 0 || n == 1) return 1; return n * factorial(n - 1);}
int main() { int num; printf("Enter a number: "); scanf("%d", &num); printf("Factorial of %d = %d\n", num, factorial(num)); return 0;}Problem: Write a program to find the largest element in an array.
Solution (C):
#include <stdio.h>
int findLargest(int arr[], int n) { int max = arr[0]; for (int i = 1; i < n; i++) { if (arr[i] > max) max = arr[i]; } return max;}
int main() { int arr[] = {12, 35, 1, 10, 34, 1}; int n = 6; printf("Largest element: %d\n", findLargest(arr, n)); return 0;}Problem: Implement a function to check if two strings are anagrams of each other.
Solution (C):
#include <stdio.h>#include <string.h>#include <ctype.h>
int areAnagrams(char str1[], char str2[]) { int count[256] = {0}; int len1 = strlen(str1), len2 = strlen(str2); if (len1 != len2) return 0;
for (int i = 0; i < len1; i++) { count[tolower(str1[i])]++; count[tolower(str2[i])]--; }
for (int i = 0; i < 256; i++) { if (count[i] != 0) return 0; } return 1;}Problem: Write a program to find the GCD of two numbers using recursion (Euclidean algorithm).
Solution (C):
#include <stdio.h>
int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b);}
int main() { int a, b; printf("Enter two numbers: "); scanf("%d %d", &a, &b); printf("GCD: %d\n", gcd(a, b)); return 0;}Problem: Implement a function to merge two sorted arrays into a single sorted array.
Solution (C):
#include <stdio.h>
void mergeArrays(int arr1[], int n1, int arr2[], int n2, int result[]) { int i = 0, j = 0, k = 0; while (i < n1 && j < n2) { if (arr1[i] < arr2[j]) result[k++] = arr1[i++]; else result[k++] = arr2[j++]; } while (i < n1) result[k++] = arr1[i++]; while (j < n2) result[k++] = arr2[j++];}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;}Problem: Rotate an array to the right by k steps.
Solution (C):
#include <stdio.h>
void rotateRight(int arr[], int n, int k) { k = k % n; int temp[k]; for (int i = 0; i < k; i++) temp[i] = arr[n - k + i]; for (int i = n - 1; i >= k; i--) arr[i] = arr[i - k]; for (int i = 0; i < k; i++) arr[i] = temp[i];}Problem: Write a program to find the intersection of two arrays.
Solution (C):
#include <stdio.h>
void intersection(int arr1[], int n1, int arr2[], int n2) { for (int i = 0; i < n1; i++) { for (int j = 0; j < n2; j++) { if (arr1[i] == arr2[j]) { printf("%d ", arr1[i]); break; } } }}Problem: Find the missing number in an array containing numbers from 1 to n.
Solution (C):
#include <stdio.h>
int findMissing(int arr[], int n) { int total = (n + 1) * (n + 2) / 2; for (int i = 0; i < n; i++) total -= arr[i]; return total;}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); for (int i = 0; i < len; i++) count[(int)str[i]]++; for (int i = 0; i < len; i++) { if (count[(int)str[i]] == 1) return str[i]; } return '\0';}Problem: Write a program to implement the bubble sort algorithm.
Solution (C):
#include <stdio.h>
void bubbleSort(int arr[], int n) { for (int i = 0; i < n - 1; i++) { for (int j = 0; j < n - i - 1; j++) { if (arr[j] > arr[j + 1]) { int temp = arr[j]; arr[j] = arr[j + 1]; arr[j + 1] = temp; } } }}Problem: Print the following pattern:
1 121 123211234321Solution (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=1; j<=i; j++) printf("%d", j); // Decreasing numbers for(int j=i-1; j>=1; j--) printf("%d", j); printf("\n"); } return 0;}Problem: Sort odd-indexed elements in descending order, even-indexed in ascending order.
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; } } }}Problem: Find all occurrences of pattern in string and replace with reverse of pattern.
Input: str = “abc123abc456abc”, pattern = “abc” Output: “cba123cba456cba”
Solution (C):
#include <stdio.h>#include <string.h>
void reverse(char str[], int start, int end) { while(start < end) { char temp = str[start]; str[start] = str[end]; str[end] = temp; start++; end--; }}
void replacePattern(char str[], char pattern[]) { int len = strlen(str); int patLen = strlen(pattern); int i = 0;
while(i <= len - patLen) { if(strncmp(&str[i], pattern, patLen) == 0) { reverse(str, i, i + patLen - 1); i += patLen; } else { i++; } }}Problem: Print matrix elements in spiral order.
Input:
1 2 3 45 6 7 89 10 11 12Output: 1 2 3 4 8 12 11 10 9 5 6 7
Solution (C):
#include <stdio.h>
void spiralPrint(int mat[][4], int rows, int cols) { int top = 0, bottom = rows-1, left = 0, right = cols-1;
while(top <= bottom && left <= right) { // Print top row for(int i=left; i<=right; i++) printf("%d ", mat[top][i]); top++;
// Print right column for(int i=top; i<=bottom; i++) printf("%d ", mat[i][right]); right--;
// Print bottom row if(top <= bottom) { for(int i=right; i>=left; i--) printf("%d ", mat[bottom][i]); bottom--; }
// Print left column if(left <= right) { for(int i=bottom; i>=top; i--) printf("%d ", mat[i][left]); left++; } }}Q5: 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;}Q6: 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;}Q7: 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; } } }}Q8: 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;}Q9: 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';}Q10: 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: Given a matrix, implement an algorithm to find the largest square sub-matrix with all 1s.
Solution (C):
#include <stdio.h>
int min(int a, int b, int c) { int m = a; if (b < m) m = b; if (c < m) m = c; return m;}
int largestSquare(int mat[][100], int rows, int cols) { int dp[100][100]; int maxSize = 0;
// Initialize first row and column for (int i = 0; i < rows; i++) dp[i][0] = mat[i][0]; for (int j = 0; j < cols; j++) dp[0][j] = mat[0][j];
// Fill DP table for (int i = 1; i < rows; i++) { for (int j = 1; j < cols; j++) { if (mat[i][j] == 1) { dp[i][j] = min(dp[i-1][j], dp[i][j-1], dp[i-1][j-1]) + 1; if (dp[i][j] > maxSize) maxSize = dp[i][j]; } else { dp[i][j] = 0; } } } return maxSize;}Problem: Develop a console-based tax calculator application with:
Solution Structure:
struct TaxSlab { float minIncome; float maxIncome; float taxRate;};
struct User { int id; char name[50]; float income; float tax;};
// Implement functions:// - setTaxSlabs() - Admin function// - registerUser() - Taxpayer registration// - calculateTax() - Tax calculation based on slabs// - saveToFile() / loadFromFile() - File operations// - Menu-driven interfaceProblem: 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: Build a banking system with:
Key Features Required:
Solution Structure:
#include <stdio.h>#include <string.h>
struct Account { int accNo; char name[50]; float balance;};
struct Transaction { int accNo; char type[20]; // "DEPOSIT" or "WITHDRAW" float amount; float balance;};
// Implement functions: createAccount, deposit, withdraw, checkBalance, saveToFile, loadFromFileProblem: Build a library management system with:
Key Features Required:
Solution Structure:
#include <stdio.h>#include <string.h>
struct Book { char isbn[20]; char title[100]; char author[50]; int totalCopies; int availableCopies;};
struct Member { int id; char name[50]; char issuedBooks[5][20]; // ISBNs int bookCount;};
// Implement functions: addBook, removeBook, issueBook, returnBook,// searchBook, displayBooks, saveToFile, loadFromFileProblem: Build an address book with:
Key Features:
Solution Structure:
struct Contact { char name[50]; char phone[15]; char email[100]; char address[200];};
// Implement functions: addContact, deleteContact, searchContact,// updateContact, displayAll, saveToFile, loadFromFileQ4: Quiz Application
Build a quiz app with:
Key Features:
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, saveResults, questionManagementFile Format:
Question|Option1|Option2|Option3|Option4|CorrectAnswerHiring Volume
Salary Packages
Process Changes
C Output Prediction
Coding Problems
Application Round
Technical Interview
Zoho 2025 Papers
Latest Zoho placement papers with current year C programming questions
Zoho 2026 Preparation
Expected Zoho placement pattern and preparation guide for 2026
Zoho Aptitude Questions
Complete collection of Zoho quantitative aptitude questions
Zoho Interview Experience
Real interview experiences from candidates who cleared Zoho placement
Zoho HR Interview
Common HR interview questions and answers for Zoho placement
Zoho Preparation Guide
Comprehensive preparation strategy for Zoho placement process
Zoho Pen & Paper Test
Guide to Zoho’s unique pen-and-paper test format
Zoho Main Page
Complete Zoho placement guide with eligibility, process, and salary
Practice 2024 papers to understand Zoho’s unique pattern and prepare for current year exams! Focus on C programming, application building, and practical coding skills.