## Basic Concepts of Time and Work

Most of the aptitude questions on time and work can be solved if you know the basic correlation between time, work and man-hours which you have learnt in your high school class.

Analogy between problems on time and work to time, distance and speed:
1. Speed is equivalent to rate at which work is done
2. Distance travelled is equivalent to work done.
3. Time to travel distance is equivalent to time to do work.
• Man - Work - Hour Formula:
1. More men can do more work.
2. More work means more time required to do work.
3. More men can do more work in less time.
4. $M$ men can do a piece of work in $T$ hours, then .
5. If $A$ can do a piece of work in $D$ days, then $A$'s 1 day's work = $1D$.
Part of work done by $A$ for $t$ days = $tD$.
6. If $A$'s 1 day's work = $1D$, then $A$ can finish the work in $D$ days.
7. $MDHW=Constant$
Where,
M = Number of men
D = Number of days
H = Number of hours per day
W = Amount of work
8. If $M1$ men can do $W1$ work in $D1$ days working $H1$ hours per day and $M2$ men can do $W2$ work in $D2$days working $H2$ hours per day, then
$M1D1H1W1=M2D2H2W2$
9. If $A$ is $x$ times as good a workman as $B$, then:
1. Ratio of work done by $A$ and $B$ = $x:1$
2. Ratio of times taken by $A$ and $B$ to finish a work = $1:x$ ie; $A$ will take $(1x)th$ of the time taken by $B$to do the same work.

## Shortcuts for frequently asked time and work problems

• $A$ and $B$ can do a piece of work in $'a'$ days and $'b'$ days respectively, then working together:
1. They will complete the work in $aba+b$ days
2. In one day, they will finish $(a+bab)th$ part of work.
• If $A$ can do a piece of work in $a$ days, $B$ can do in $b$ days and $C$ can do in $c$ days then,
• If $A$ can do a work in $x$ days and $A$ and $B$ together can do the same work in $y$ days then,
$Number of days required to complete the work if B works alone=xyx-ydays$
• If $A$ and $B$ together can do a piece of work in $x$ days, $B$ and $C$ together can do it in $y$ days and $C$ and $A$together can do it in $z$ days, then number of days required to do the same work:
1. If A, B, and C working together = $2xyzxy+yz+zx$
2. If A working alone = $2xyzxy+yz-zx$
3. If B working alone = $2xyz-xy+yz+zx$
4. If C working alone = $2xyzxy-yz+zx$
• If $A$ and $B$ can together complete a job in $x$ days.
If $A$ alone does the work and takes $a$ days more than $A$ and $B$ working together.
If $B$ alone does the work and takes $b$ days more than $A$ and $B$ working together.
Then,
• If $m1$ men or $b1$ boys can complete a work in $D$ days, then $m2$ men and $b2$ boys can complete the same work in $Dm1b1m2b1+m1b2$ days.
• If $m$ men or $w$ women or $b$ boys can do work in $D$ days, then 1 man, 1 woman and 1 boy together can together do the same work in $Dmwbmw+wb+bm$ days
• If the number of men to do a job is changed in the ratio $a:b$, then the time required to do the work will be changed in the inverse ratio. ie; $b:a$
• If people work for same number of days, ratio in which the total money earned has to be shared is the ratio of work done per day by each one of them.
$A$$B$$C$ can do a piece of work in $x$$y$$z$ days respectively. The ratio in which the amount earned should be shared is $1x:1y:1z=yz:zx:xy$
• If people work for different number of days, ratio in which the total money earned has to be shared is the ratio of work done by each one of them.

## Special cases of time and work problems

• Given a number of people work together/alone for different time periods to complete a work, for eg: $A$ and $B$work together for few days, then $C$ joins them, after few days $B$ leaves the job. To solve such problems, following procedure can be adopted.
1. Let the entire job be completed in $D$ days.
2. Let sum of parts of the work completed by each person = 1.
3. Find out part of work done by each person with respect to $D$. This can be easily found out if you calculate how many days each person worked with respect to $D$.
4. Substitute values found out in Step 3 in Step 2 and solve the equation to get unknowns.
• A certain no of men can do the work in $D$ days. If there were $m$ more men, the work can be done in $d$ days less. How many men were there initially?
Let the initial number of men be $M$
Number of man days to complete work = $MD$
If there are $M+m$ men, days taken = $D-d$
So, man days = $(M+m)(D-d)$
ie; $MD=(M+m)(D-d)$
$M(D–(D-d))=m(D-d)$
$M=m(D-d)d$
• A certain no of men can do the work in $D$ days. If there were $m$ less men, the work can be done in $d$ days more. How many men were initially?
Let the initial number of men be $M$
Number of man days to complete work = $MD$
If there are $M-m$ men, days taken = $D+d$
So, man days = $(M-m)(D+d)$
ie; $MD=(M-m)(D+d)$
$M(D+d–D)=m(D+d)$
$M=m(D+d)d$
• Given $A$ takes $a$ days to do work. $B$ takes $b$ days to do the same work. Now $A$ and $B$ started the work together and $n$ days before the completion of work $A$ leaves the job. Find the total number of days taken to complete work?
Let $D$ be the total number of days to complete work.
$A$ and $B$ work together for $D-n$ days.
So, $(D-n)(1a+1b)+n(1b)=1$
$D(1a+1b)–na-nb+nb=1$
$D(1a+1b)=n+aa$
$D=b(n+a)a+b$ days.

### C Questions

C Questions
C Questions

Note : All the programs are tested under Turbo C/C++ compilers.
It is assumed that,
Programs run under DOS environment, The underlying machine is an x86 system, Program is compiled using Turbo C/C++ compiler.
The program output may depend on the information based on this assumptions (for example sizeof(int) == 2 may be assumed).
Predict the output or error(s) for the following:

void main()
{
int const * p=5; printf("%d",++(*p));
}
Compiler error: Cannot modify a constant value.
Explanation:
p is a pointer to a "constant integer". But we tried to change the value of the "constant integer".
main()
{
char s[ ]="man"; int i;
for(i=0;s[ i ];i++)
printf("\n%c%c%c%c",s[ i ],*(s+i),*(i+s),i[s]);
}
aaaa nnnn
Explanation

### Zoho Interview | Set 1 (Advanced Programming Round)

Third Round: (Advanced Programming Round) Here they asked us to create a “Railway reservation system” and gave us 4 modules. The modules were:
1. Booking
2. Availability checking
3. Cancellation
4. Prepare chart
We were asked to create the modules for representing each data first and to continue with the implementation phase.

My Solution :