Zoho Interview Experience (Off-Campus) 2+ Year Experienced

I am a Software Engineer with 2+ yr of experience. I had an off-campus round of Zoho. I got rejected in the third round of object-oriented design.

Level 1: The level consists of 10 programming questions and 10 aptitude questions.

1. What is the output?

C

void func(int *b) { *b = 1;  }

int main(){

  int *a; 

  int n;

  a = &n;

 *a=0;

func(a);

std::cout << *a << std::end;

return 0;

}

2. What is the output?

C

int main(){

int x=10;

int y=20;

if(!(x^y))

printf("0");

else

printf("1");

return 0;

}

3. What is the output?

C

int main(){

int a[10][10]={{1,2},{3,4},{5,6},{7,8},{9,10}};

int *p=3;

int result = a[2][1]+ (*p--)+(++*p)+(*p+13);

printf("%d",result);

return 0;

}

4. What is the output?

C

#include<stdio.h>

int main(){

int i;

char ch[]={'z','o','h','o'};

char *ptr,*str1;

ptr=ch;

sr1=ch;

i =(*ptr-- + ++*str1)-10;

return 0;

}

5. What is the output?

C++

void main(){

     int n=21; 

     int out = 1;

     while(n>=3){

      n/=2;

       out*=(n/2);

}

printf("%d",n*out);

}

6. What is the output?

C

#include <stdio.h>

void function(char**);

int main(){

char *arr[] = {"ant","bat","cat","dog","egg","fly"};

function(arr);

return 0;

}

 

void function(char **ptr){

char *ptr1;

ptr1 = (ptr + = sizeof(int))[-2];

printf("%sn",ptr1);

}

7. What is the output?

C++

#include<iostream>

using namespace std;

class Test{

static int i;

int j;

};

int Test :: i;

int main(){

count << sizeof(Test);

return 0;

}

8. What is the output?

C

int main(){

int a[10][10] = {{1,2},{3,4},{5,6},{7,8},{9,10}};

int *p = a[3];

int result = (*p+2)*a[4][1]+(++*p)+(*p+7);

printf("%d",result);

return 0;

}

9. What is the output?

C

int a=20;

int main(){

int a=10;

std::cout << a << ""<<::a;

return 0;

}

10. What is the output?

C

int main() {

int n[]={8,1,3,9,4};

int j,*y=n;

for(j=0;j<5;j++) {

if(j%2==0)

*y++;

}

printf("%d",*y);

return 0;

}

Section 2 consists of 10 questions

  1. The price of 2 apples and 4 oranges is Rs 160. With the same money, one can buy 1 apple and 6 oranges. What is the price of 3 oranges?
  2. Anirudh wants to cut a large rectangular board into small identical square pieces. If the board size is 18 inches by 30 inches. What is the least number of square pieces he can cut without wasting any of the board?
  3. At a party, every person shakes hands with every other person. If there are 105 handshakes, find the number of people at the party.
  4. A started a business with the amount of Rs. 40000. After 5 months A withdraws Rs 20000. B invest every monthly regularly. The ratio of profit share between A and B at the end of the year is 10239. Find how much B invested in each month?
  5. the difference between a two-digit number and the number obtained by interchanging the position of its digits is 18. What is the difference between the two digits of the number?
  6. The price of 2 apples and 4 oranges is Rs. 160. With the same money, one can buy 1 apple and 6 oranges. What is the price of 3 oranges?
  7. A class has 6 boys and 7 girls. out of them, they have to select a group of 6 students for performing a mime, so that the selected group should have at least 4 girls.
  8. If everyone in a group contributed for fundraising and each paid at least Rs. 140 and the total amount collected is 2370, which could be the maximum possible strength of that group.
  9. Find the unit’s digit in the product 24647^117 and 45639^118.
  10. If A(x) denotes the number of prime numbers not greater than x. then what is the value of A(A(100)).

You have to score 100% to clear this L1 level of the Zoho round. I got selected in this round and within a few days got a call from HR regarding the L2 level of the Zoho round.

L2 level of Zoho round involves DataStructure and Algorithms round.

1. Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string.

Example1 :

Input : strs = ["flower","flow","flight"]
output : "fl"

Example 2:

Input : strs = ["dog","racecar","car"]
output : ""

2. A tree goes through two growth cycles every year, Summer and Spring. Every spring, it doubles in height. Every summer, its height is increased by the meter. Given a sampling, that is planted at a height of 1 meter during Spring. Calculate the height after n cycles.

Example 1:

Input : 0
Output:1

Example 2:

Input: 1
Output  2

Example 3:

Input 4
Output:7

https://hackerranksolution.in/utopiantreealgo/

3. You are given an array of prices where prices[i] is the price of a given stock on an ith day. You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock. Return the maximum profit you can achieve from this transaction. If you cannot achieve any profit, return 0

Example 1:

Input : prices =[7,1,5,3,6,4]
output: 5

Explanation: Buy on day 2 (price=1) and sell on day 5(price=6), profit = 6-1 = 5

Note that buying on day 2 and selling on day 1 is not allowed because you must buy before you sell.

Example 2:

input : prices = [7,6,4,3,1]
output : 0

Explanation: In this case, no transactions are done and the max profit =0

something similar to this article: https://www.geeksforgeeks.org/stock-buy-sell/

L3 level round: L3 is an object-oriented design round. I was rejected in this round, try to complete all the tasks in 3 hrs, otherwise, you won’t be shortlisted.

Create a Bus booking application, ZOBUS, which satisfies the following conditions:

Task 1: initialization

Initialize the data as per the details are given below to be loaded when the program starts:

it can be loaded and kept in the memory. No need to maintain a File or DB.

Assume that this bus is available only for a single route (Chennai to Bengaluru).

And that all the passengers want to travel on the same day.

One customer can book only 1 ticket.

2 Sleeper buses – 1 AC and 1 Non-AC

2 Seater Buses – 1 AC and 1 Non-AC.

Seater Bus Has 12 Seats (1,2 3, 4 -represent row where people can seat. middle space is left because it’s walking area).

A B C
1
2
3
4

Sleeper Bus has 12 Seats in 2 Decks(6 each)

(Lower Deck)

A B
1
2
3

(Upper Deck)

A B
4
5
6

Initial Customers

Id Name Password Age Gender
1 aaa 111 25 F
2 bbb 222 61 M
3 cc 333 22 M
4 ddd 444 36 F

Task 2: Customer Sign-up: The customer should have an option to sign up using a new account by providing all the basic details.

Task 3: Customer Login: The customer should be able to log in using their existing account credentials (Username and password)

Task 4: Booking a Ticket

4.1 Bus options

The customer should be asked for the number of passengers We should display all the buses with the remaining capacity.

Sample Output :

  • AC Sleeper – 12 Seats
  • AC Seater – 9 Seats
  • Non AC Sleeper – 4 Seats
  • Non AC Seater – 10 Seats

4.2 Seat Selection: Once the required bus is chosen by the customer, h should be shown the current status of the bus in which seats are occupied and which ones are vacant.

And the customer can choose his seats based on the following rules :

  1. He /She should enter the number of travelers not greater than the remaining seats). Should get the name and gender of co-travelers.
  2. He /She can choose the seats such that only a lady can occupy the seat beside a lady from the different ticket.
  3. A lady and gent may occupy adjacent seats if they are from the same ticket.

Sample Output

A B C
1
2 F
3 M
4 M

If B2 is a lady, then seat B1 can be occupied only by another lady. Similar to the sleeper. Whereas if 2 people are traveling. 1 Male and 1 Female. They can take seats A1 and A2.

Task 5: Fare calculation: The fare should be calculated and intimated to the customer based as follows :

  • AC + Sleeper – Rs 700 / seat
  • AC + Seater – Rs 550 / seat
  • Non-AC + Sleeper – Rs 600/seat
  • Non-AC + Seater – Rs 450/seat

Task 6: Ticket confirmation: Once the fare is estimated, the customer must be prompted for the confirmation of the booking. Only if he confirms, the ticket should be booked.

Task 7 Ticket Cancellation: The customer should be given an option to cancel their ticket based on the following workflow:

  1. He should show the list of seats booked by him.
  2. He can have the option to completely cancel(all seats) or partially cancel (selected seats)
  3. Cancellation Fee of 50% for AC and 25% for Non-AC seats.

Task 8: Bus Filtering: The customer can filter and view the buses based on his preference among the following :

  1. AC or Non-Ac or Both
  2. Seater or Sleeper or Both

Only applicable buses which are not filled should be shown.

  1. In the descending order of remaining capacity.
  2. If the same capacity AC should come first.
  3. If the same capacity Sleeper should come first.

Sample Output :

  1. AC Seater – 12 Seats
  2. AC Sleeper – 11 seats
  3. Non-AC Sleeper – 11 seats
  4. Non-AC Seater – 11 seats

Task 9: Bus summary: The admin should be able to see the summary of the buses as follows :

Bus Type, Number of seats filled, Total Fare Collected, and details of each filled seat.

Sample Output :

  • AC Sleeper
  • Number of Seats Filled: 4

Total Fare Collected : 3510 (4 seats+ 1 cancellation)

Seat Details:

Seat Name Gender
A3 cc M
B6 aaa F
A4 ddd F
A5 daa F

I got rejected after this round, though I tried my best, maybe I was not that good. Better Luck Next time.

Leave a Comment