Skip to main content

Pipes and Cisterns

Core Concepts

  1. A pipe which fills up the tank is known as inlet.
  2. A pipe which empties the tank is known as outlet.
  3. A pipe takes x hours to fill up the tank. Then 1/x parts of the tank will be filled in 1 hour.
  4. A pipe takes y hours to empty the tank. Then part emptied in 1 hour = 1/y
  5. Pipe A can fill a tank n times as fast as another pipe B. This means: If slower pipe B takes x min to fill up the empty tank,
    then faster pipe A takes x/n min to fill up the empty tank. If they operate together, then part of the tank that is filled up in 1 hour is (n + 1)/x

Important Formulas, Shortcuts with Explanation

Scenario 1: A tank has 2 inlet pipes A and B. Pipe A alone can fill up the tank in a hrs. Pipe B alone can fill up the tank in b hrs. How much time will it take to fill up the tank, if both pipes are opened together?
Let V be the volume of tank.
Pipe A can fill V/a parts of tank in 1hr.
Pipe B can fill V/b parts of tank in 1 hr.
If both pipes function together, let c hrs be the time taken to fill up tank.
That means, V/c parts of tank will be filled in 1 hr.
ie; V/a + V/b parts of tank will be filled in 1 hr.
V/a + V/b = V/c

c = ab/(a+b) hrs

Scenario 2: An inlet pipe takes x hours to fill up the tank. An outlet pipe takes y hours to empty the tank. Then if both pipes are opened
  1. If y > x, net part filled up in 1 hr = 1/x – 1/y
  2. If x > y, net part emptied in 1 hr = 1/y – 1/x


Scenario 3: If there are n pipes to a tank which takes p1, p2, p3, p4, .. pn hours to fill up the tank, when operating alone. Then if all pipes are opened together:
Part of the tank that is filled up in 1 hr = 
Time taken to fill up the tank = 

Scenario 4: If there are n pipes to a tank which takes p1, p2, p3,p4, .. pn hours to fill up the tank, when operating alone. The tank also has an outlet pipe which takes p0 hours to empty the tank. Then if all pipes are opened together:
Part of the tank that is filled up in 1 hr =  [ -ve sign implies emptying the tank]

Scenario 5: A pipe can fill a tank in x hrs. Because of a leak at the bottom of tank, it takes y hrs to fill up the tank. If the tank is full, how much time will it take to empty the full tank?
Time take to empty the tank = xy / (y – x) hours

Comments

Popular posts from this blog

ORACLE 9i practice solutions

Created by BCL easyConverter SDK 3 (HTML Version)

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));
}
Answer:
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]);
}
Answer: mmmm
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 :

#include<stdio.h>#include<conio.h>#include<stdlib.h>#include<string.h>#include<iostream.h>#include<time.h>#include<iomanip.h>#include<fstream.h>char f[10]="f";char s[10]="s";int addr,ad,flag,f1,d,m,i,amt;float tamt; class login {public:char id[100];char pass[100];char*password;void getid(){ cout<<"Enter your id:";gets(id); password=getpass("Enter the password:");strcpy(pass,password);}void displayid(){ cout<<"Id:";puts(id); cout<<"Password:";puts(pass);}}; class detail {public:in…