Tuesday, March 15, 2011

COMPREHENSIVE GIDE FOR PLACEMENT PART--4


1.           What is the difference between > and >> redirection operators ?
> is the output redirection operator when used it overwrites while >> operator appends into the file.

2.           How is the command  “$cat <file1 >file2 “ different from “$cat >file2 <file1” ?
Both the commands mean the same , the file file1 is read and its contents are copied to file2

3.           Which of the following commands is not a filter
(a) man  , (b) cat , (c) pg , (d) head
           Ans:  man
         A filter is a program which can receive a flow of  data from std input, process (or filter) it and send the result to the std output.

4.            What does the command “$ls | wc –l > file1” do?
ls becomes the input to wc which counts the number of lines it receives as input and instead of displaying this count , the value is stored in file1.

5.           What does the command “ $who | sort –logfile > newfile” do?
The input from a pipe can be combined with the input from a file . The trick is to use the special symbol “-“ (a hyphen) for those commands that recognize the hyphen as std input.
In the above command the output from who becomes the std input to sort , meanwhile sort opens the file logfile, the contents of this file is sorted together with the output of who (rep by the hyphen) and the sorted output is redirected to the file newfile.

6.           What is the significance of the “tee” command?
It reads the standard input and sends it to the standard output while redirecting a copy of what it has read to the file specified by the user.

7.            Explain the command “$who | tee file1 file2 /dev/tty3a | sort > file3”
Store the output of who in file1, file2 ,display the same output on the screen store the sorted output int file3.  /dev/tty3a is the file associated with the terminal.

Exercise :-
8.           Explain the following commands.
$ ls > file1
$ banner hi-fi > message
$ cat par.3 par.4 par.5 >> report
$ cat file1>file1
$ date ; who
$ date ; who > logfile
$ (date ; who) > logfile

9.            Construct pipes to execute the following jobs.
1.                  Output of who should be displayed on the screen with value of total number of users who have logged in displayed at the bottom of the list.
2.                  Output of ls should be displayed on the screen and from this output the lines containing the word ‘poem’ should be counted and the count should be stored in a file.  
3.                  Contents of file1 and file2 should be displayed on the screen and this output should be appended in a file .
4.                  From output of ls the lines containing ‘poem’ should be displayed on the screen along with the count.
5.                  Name of cities should be accepted from the keyboard . This list should be combined with the list present in a file. This combined list should be sorted and the sorted list should be stored in a file ‘newcity’.
6.                  All files present in a directory dir1 should be deleted any error while deleting should be stored in a file ‘errorlog’.




Section II – SQL

1.            Which is the subset of SQL commands used to manipulate Oracle Database structures, including tables?
Data Definition Language (DDL)

2.            What operator performs pattern matching?
LIKE operator

3.            What operator tests column for the absence of data?
IS NULL operator

4.            Which command executes the contents of a specified file?
                        START <filename> or @<filename>

5.            What is the parameter substitution symbol used with INSERT INTO command?
                        &

6.            Which command displays the SQL command in the SQL buffer, and then executes it?
                        RUN

7.            What are the wildcards used for pattern matching?
                        _ for single character substitution and % for multi-character substitution

8.            State true or false. EXISTS, SOME, ANY are operators in SQL.
                        True

9.            State true or false. !=, <>, ^= all denote the same operation.
                        True

10.        What are the privileges that can be granted on a table by a user to others?
                        Insert, update, delete, select, references, index, execute, alter, all

11.        What command is used to get back the privileges offered by the GRANT command?
                        REVOKE

12.        Which system tables contain information on privileges granted and privileges obtained?
USER_TAB_PRIVS_MADE, USER_TAB_PRIVS_RECD

13.        Which system table contains information on constraints on all the tables created?
                         USER_CONSTRAINTS

14.        TRUNCATE TABLE EMP;
DELETE FROM EMP;
Will the outputs of the above two commands differ?
                        Both will result in deleting all the rows in the table EMP.

15.        What is the difference between TRUNCATE and DELETE commands?
TRUNCATE is a DDL command whereas DELETE is a DML command. Hence DELETE operation can be rolled back, but TRUNCATE operation cannot be rolled back. WHERE clause can be used with DELETE and not with TRUNCATE.

16.        What command is used to create a table by copying the structure of another table?
Answer :
                        CREATE TABLE .. AS SELECT command
Explanation :
To copy only the structure, the WHERE clause of the SELECT command should contain a FALSE statement as in the following.
CREATE TABLE NEWTABLE AS SELECT * FROM EXISTINGTABLE WHERE 1=2;
If the WHERE condition is true, then all the rows or rows satisfying the condition will be copied to the new table.

17.        What will be the output of the following query?
SELECT REPLACE(TRANSLATE(LTRIM(RTRIM('!! ATHEN !!','!'), '!'), 'AN', '**'),'*','TROUBLE') FROM DUAL;
             TROUBLETHETROUBLE

18.        What will be the output of the following query?
SELECT  DECODE(TRANSLATE('A','1234567890','1111111111'), '1','YES', 'NO' );
Answer :
                        NO
Explanation :
The query checks whether a given string is a numerical digit.

19.        What does the following query do?
SELECT SAL + NVL(COMM,0) FROM EMP;
This displays the total salary of all employees. The null values in the commission column will be replaced by 0 and added to salary.

20.        Which date function is used to find the difference between two dates?
                        MONTHS_BETWEEN

21.        Why does the following command give a compilation error?
DROP TABLE &TABLE_NAME;
Variable names should start with an alphabet. Here the table name starts with an '&' symbol.

22.        What is the advantage of specifying WITH GRANT OPTION in the GRANT command?
The privilege receiver can further grant the privileges he/she has obtained from the owner to any other user.

23.        What is the use of the DROP option in the ALTER TABLE command?
                        It is used to drop constraints specified on the table.

24.        What is the value of ‘comm’ and ‘sal’ after executing the following query if the initial value of ‘sal’ is 10000?
UPDATE EMP SET SAL = SAL + 1000, COMM = SAL*0.1;
             sal = 11000, comm = 1000

25.        What is the use of DESC in SQL?
Answer :
DESC has two purposes. It is used to describe a schema as well as to retrieve rows from table in descending order.
Explanation :
The query SELECT * FROM EMP ORDER BY ENAME DESC will display the output sorted on ENAME in descending order.

26.        What is the use of CASCADE CONSTRAINTS?
When this clause is used with the DROP command, a parent table can be dropped even when a child table exists.

27.        Which  function is used to find the largest integer less than or equal to a specific value?
                        FLOOR

28.        What is the output of the following query?
SELECT TRUNC(1234.5678,-2) FROM DUAL;
1200

SQL – QUERIES

I. SCHEMAS

Table 1 : STUDIES
PNAME  (VARCHAR),  SPLACE (VARCHAR),  COURSE (VARCHAR),  CCOST (NUMBER)

Table 2 : SOFTWARE
PNAME (VARCHAR), TITLE (VARCHAR), DEVIN (VARCHAR), SCOST (NUMBER), DCOST (NUMBER), SOLD (NUMBER)

Table 3 : PROGRAMMER
PNAME (VARCHAR), DOB (DATE), DOJ (DATE), SEX (CHAR), PROF1 (VARCHAR), PROF2 (VARCHAR), SAL (NUMBER)

LEGEND :

PNAME – Programmer Name, SPLACE – Study Place, CCOST – Course Cost,  DEVIN – Developed in, SCOST – Software Cost, DCOST – Development Cost, PROF1 – Proficiency 1

QUERIES :
  1. Find out the selling cost average for packages developed in Oracle.
  2. Display the names, ages and experience of all programmers.
  3. Display the names of those who have done the PGDCA course.
  4. What is the highest number of copies sold by a package?
  5. Display the names and date of birth of all programmers born in April.
  6. Display the lowest course fee.
  7. How many programmers have done the DCA course.
  8. How much revenue has been earned through the sale of packages developed in C.
  9. Display the details of software developed by Rakesh.
  10. How many programmers studied at Pentafour.
  11. Display the details of packages whose sales crossed the 5000 mark.
  12. Find out the number of copies which should be sold in order to recover the development cost of each package.
  13. Display the details of packages for which the development cost has been recovered.
  14. What is the price of costliest software developed in VB?
  15. How many packages were developed in Oracle ?
  16. How many programmers studied at PRAGATHI?
  17. How many programmers paid 10000 to 15000 for the course?
  18. What is the average course fee?
  19. Display the details of programmers knowing C.
  20. How many programmers know either C or Pascal?
  21. How many programmers don’t know C and C++?
  22. How old is the oldest male programmer?
  23. What is the average age of female programmers?
  24. Calculate the experience in years for each programmer and display along with their names in descending order.
  25. Who are the programmers who celebrate their birthdays during the current month?
  26. How many female programmers are there?
  27. What are the languages known by the male programmers?
  28. What is the average salary?
  29. How many people draw 5000 to 7500?
  30. Display the details of those who don’t know C, C++ or Pascal.
  31. Display the costliest package developed by each programmer.
  32. Produce the following output for all the male programmers
Programmer
      Mr. Arvind – has 15 years of experience

KEYS:
  1. SELECT AVG(SCOST)  FROM SOFTWARE WHERE DEVIN = 'ORACLE';
  2. SELECT PNAME,TRUNC(MONTHS_BETWEEN(SYSDATE,DOB)/12) "AGE", TRUNC(MONTHS_BETWEEN(SYSDATE,DOJ)/12) "EXPERIENCE" FROM PROGRAMMER;
  3. SELECT PNAME FROM STUDIES WHERE COURSE = 'PGDCA';
  4. SELECT MAX(SOLD) FROM SOFTWARE;
  5. SELECT PNAME, DOB FROM PROGRAMMER WHERE DOB LIKE '%APR%';
  6. SELECT MIN(CCOST) FROM STUDIES;
  7. SELECT COUNT(*) FROM STUDIES WHERE COURSE = 'DCA';
  8. SELECT SUM(SCOST*SOLD-DCOST) FROM SOFTWARE GROUP BY DEVIN HAVING DEVIN = 'C';
  9. SELECT * FROM SOFTWARE WHERE PNAME = 'RAKESH';
  10. SELECT * FROM STUDIES WHERE SPLACE = 'PENTAFOUR';
  11. SELECT * FROM SOFTWARE WHERE SCOST*SOLD-DCOST > 5000;
  12. SELECT CEIL(DCOST/SCOST) FROM SOFTWARE;
  13. SELECT * FROM SOFTWARE WHERE SCOST*SOLD >= DCOST;
  14. SELECT MAX(SCOST) FROM SOFTWARE GROUP BY DEVIN HAVING DEVIN = 'VB';
  15. SELECT COUNT(*) FROM SOFTWARE WHERE DEVIN = 'ORACLE';
  16. SELECT COUNT(*) FROM STUDIES WHERE SPLACE = 'PRAGATHI';
  17. SELECT COUNT(*) FROM STUDIES WHERE CCOST BETWEEN 10000 AND 15000;
  18. SELECT AVG(CCOST) FROM STUDIES;
  19. SELECT * FROM PROGRAMMER WHERE PROF1 = 'C' OR PROF2 = 'C';
  20. SELECT * FROM PROGRAMMER WHERE PROF1 IN ('C','PASCAL') OR PROF2 IN ('C','PASCAL');
  21. SELECT * FROM PROGRAMMER WHERE PROF1 NOT IN ('C','C++') AND PROF2 NOT IN ('C','C++');
  22. SELECT TRUNC(MAX(MONTHS_BETWEEN(SYSDATE,DOB)/12)) FROM PROGRAMMER WHERE SEX = 'M';
  23. SELECT TRUNC(AVG(MONTHS_BETWEEN(SYSDATE,DOB)/12)) FROM PROGRAMMER WHERE SEX = 'F';
  24. SELECT PNAME, TRUNC(MONTHS_BETWEEN(SYSDATE,DOJ)/12) FROM PROGRAMMER ORDER BY PNAME DESC;
  25. SELECT PNAME FROM PROGRAMMER WHERE TO_CHAR(DOB,'MON') = TO_CHAR(SYSDATE,'MON');
  26. SELECT COUNT(*) FROM PROGRAMMER WHERE SEX = 'F';
  27. SELECT DISTINCT(PROF1) FROM PROGRAMMER WHERE SEX = 'M';
  28. SELECT AVG(SAL) FROM PROGRAMMER;
  29. SELECT COUNT(*) FROM PROGRAMMER WHERE SAL BETWEEN 5000 AND 7500;
  30. SELECT * FROM PROGRAMMER WHERE PROF1 NOT IN ('C','C++','PASCAL') AND PROF2 NOT IN ('C','C++','PASCAL');
  31. SELECT PNAME,TITLE,SCOST FROM SOFTWARE WHERE SCOST IN (SELECT MAX(SCOST) FROM SOFTWARE GROUP BY PNAME);
32.SELECT 'Mr.' || PNAME || ' - has ' || TRUNC(MONTHS_BETWEEN(SYSDATE,DOJ)/12) || ' years of experience' “Programmer” FROM PROGRAMMER WHERE SEX = 'M' UNION SELECT 'Ms.' || PNAME || ' - has ' || TRUNC (MONTHS_BETWEEN (SYSDATE,DOJ)/12)  || ' years of experience' “Programmer” FROM PROGRAMMER WHERE SEX = 'F';

II . SCHEMA :

Table 1 : DEPT
DEPTNO (NOT NULL , NUMBER(2)),  DNAME (VARCHAR2(14)),
LOC (VARCHAR2(13)

Table 2 : EMP
EMPNO (NOT NULL , NUMBER(4)), ENAME (VARCHAR2(10)),
JOB (VARCHAR2(9)), MGR (NUMBER(4)), HIREDATE (DATE),
SAL (NUMBER(7,2)), COMM (NUMBER(7,2)), DEPTNO (NUMBER(2))

MGR is the empno of the employee whom the employee reports to. DEPTNO is a foreign key.

QUERIES
1.      List all the employees who have at least one person reporting to them.
2.      List the employee details if and only if more than 10 employees are present in department no 10.
3.      List the name of the employees with their immediate higher authority.
4.      List all the employees who do not manage any one.
5.      List the employee details whose salary is greater than the lowest salary of an employee belonging to deptno 20.
6.      List the details of the employee earning more than the highest paid manager.
7.      List the highest salary paid for each job.
8.      Find the most recently hired employee in each department.
9.      In which year did most people join the company? Display the year and the number of employees.
10.  Which department has the highest annual remuneration bill?
11.  Write a query to display a ‘*’ against the row of the most recently hired employee.
12.  Write a correlated sub-query to list out the employees who earn more than the average salary of their department.
13.  Find the nth maximum salary.
14.  Select the duplicate records (Records, which are inserted, that already exist) in the EMP table.
15.  Write a query to list the length of service of the employees (of the form n years and m months).

KEYS:
1.      SELECT DISTINCT(A.ENAME) FROM EMP A, EMP B WHERE A.EMPNO = B.MGR;   or  SELECT ENAME FROM EMP WHERE EMPNO IN (SELECT MGR FROM EMP);
2.      SELECT * FROM EMP WHERE DEPTNO IN (SELECT DEPTNO FROM EMP GROUP BY DEPTNO HAVING COUNT(EMPNO)>10 AND DEPTNO=10);
3.      SELECT A.ENAME "EMPLOYEE", B.ENAME "REPORTS TO" FROM EMP A, EMP B WHERE A.MGR=B.EMPNO;
4.      SELECT * FROM EMP WHERE EMPNO IN ( SELECT EMPNO FROM EMP MINUS SELECT MGR FROM EMP);
5.      SELECT * FROM EMP WHERE SAL > ( SELECT MIN(SAL) FROM EMP GROUP BY DEPTNO HAVING DEPTNO=20);
6.      SELECT * FROM EMP WHERE SAL > ( SELECT MAX(SAL) FROM EMP GROUP BY JOB HAVING JOB = 'MANAGER' );
7.      SELECT JOB, MAX(SAL) FROM EMP GROUP BY JOB;
8.      SELECT * FROM EMP WHERE (DEPTNO, HIREDATE) IN (SELECT DEPTNO, MAX(HIREDATE) FROM EMP GROUP BY DEPTNO);
9.      SELECT TO_CHAR(HIREDATE,'YYYY') "YEAR", COUNT(EMPNO) "NO. OF EMPLOYEES" FROM EMP GROUP BY TO_CHAR(HIREDATE,'YYYY') HAVING COUNT(EMPNO) = (SELECT MAX(COUNT(EMPNO)) FROM EMP GROUP BY TO_CHAR(HIREDATE,'YYYY'));
10.  SELECT DEPTNO, LPAD(SUM(12*(SAL+NVL(COMM,0))),15) "COMPENSATION" FROM EMP GROUP BY DEPTNO HAVING SUM( 12*(SAL+NVL(COMM,0))) = (SELECT MAX(SUM(12*(SAL+NVL(COMM,0)))) FROM EMP GROUP BY DEPTNO);
11.  SELECT ENAME, HIREDATE, LPAD('*',8) "RECENTLY HIRED" FROM EMP WHERE HIREDATE = (SELECT MAX(HIREDATE) FROM EMP) UNION SELECT ENAME NAME, HIREDATE, LPAD(' ',15) "RECENTLY HIRED" FROM EMP WHERE HIREDATE != (SELECT MAX(HIREDATE) FROM EMP);
12.  SELECT ENAME,SAL FROM EMP E WHERE SAL > (SELECT AVG(SAL) FROM EMP F WHERE E.DEPTNO = F.DEPTNO);
13.  SELECT ENAME, SAL FROM EMP A WHERE &N = (SELECT COUNT (DISTINCT(SAL)) FROM EMP B WHERE A.SAL<=B.SAL);
14.  SELECT * FROM EMP A WHERE A.EMPNO IN (SELECT EMPNO FROM EMP GROUP BY EMPNO HAVING COUNT(EMPNO)>1) AND A.ROWID!=MIN (ROWID));
15.  SELECT ENAME "EMPLOYEE",TO_CHAR(TRUNC(MONTHS_BETWEEN(SYSDATE,HIREDATE)/12))||' YEARS '|| TO_CHAR(TRUNC(MOD(MONTHS_BETWEEN (SYSDATE, HIREDATE),12)))||' MONTHS ' "LENGTH OF SERVICE" FROM EMP;


 









ALGEBRA :
1.      Sum of first n natural numbers = n(n+1)/2
2.      Sum of the squares of first n natural numbers = n(n+1)(2n+1)/6
3.      Sum of the cubes of first n natural numbers = [n(n+1)/2]2
4.      Sum of first n natural odd numbers = n2
5.      Average = (Sum of items)/Number of items

Arithmetic Progression (A.P.):
An A.P. is of the form a, a+d, a+2d, a+3d, ...
where a is called the 'first term' and d is called the 'common difference'
1.      nth term of an A.P. tn = a + (n-1)d
2.      Sum of the first n terms of an A.P. Sn = n/2[2a+(n-1)d] or Sn = n/2(first term + last term)

Geometrical Progression (G.P.):
A G.P. is of the form a, ar, ar2, ar3, ...
where a is called the 'first term' and r is called the 'common ratio'.
1.      nth term of a G.P. tn = arn-1
2.      Sum of the first n terms in a G.P. Sn = a|1-rn|/|1-r|

Permutations and Combinations :
1.      nPr = n!/(n-r)!
2.      nPn = n!
3.      nP1 = n

1.      nCr = n!/(r! (n-r)!)
2.      nC1 = n
3.      nC0 = 1 = nCn
4.      nCr = nCn-r
5.      nCr = nPr/r!

Number of diagonals in a geometric figure of n sides = nC2-n

Tests of Divisibility :
1.      A number is divisible by 2 if it is an even number.
2.      A number is divisible by 3 if the sum of the digits is divisible by 3.
3.      A number is divisible by 4 if the number formed by the last two digits is divisible by 4.
4.      A number is divisible by 5 if the units digit is either 5 or 0.
5.      A number is divisible by 6 if the number is divisible by both 2 and 3.
6.      A number is divisible by 8 if the number formed by the last three digits is divisible by 8.
7.      A number is divisible by 9 if the sum of the digits is divisible by 9.
8.      A number is divisible by 10 if the units digit is 0.
9.      A number is divisible by 11 if the difference of the sum of its digits at odd places and the sum of its digits at even places, is divisible by 11.

H.C.F and L.C.M :
H.C.F stands for Highest Common Factor. The other names for H.C.F are Greatest Common Divisor (G.C.D) and Greatest Common Measure (G.C.M).
The H.C.F. of two or more numbers is the greatest number that divides each one of them exactly.
The least number which is exactly divisible by each one of the given numbers is called their L.C.M.
Two numbers are said to be co-prime if their H.C.F. is 1.
H.C.F. of fractions = H.C.F. of numerators/L.C.M of denominators
L.C.M. of fractions = G.C.D. of numerators/H.C.F of denominators

Product of two numbers = Product of their H.C.F. and L.C.M.

PERCENTAGES :
1.      If A is R% more than B, then B is less than A by R / (100+R) * 100
2.      If A is R% less than B, then B is more than A by R / (100-R) * 100
3.      If the price of a commodity increases by R%, then reduction in consumption, not to increase the expenditure is : R/(100+R)*100
4.      If the price of a commodity decreases by R%, then the increase in consumption, not to decrease the expenditure is : R/(100-R)*100

PROFIT & LOSS :
1.      Gain = Selling Price(S.P.) - Cost Price(C.P)
2.      Loss = C.P. - S.P.
3.      Gain % = Gain * 100 / C.P.
4.      Loss % = Loss * 100 / C.P.
5.      S.P. = (100+Gain%)/100*C.P.
6.      S.P. = (100-Loss%)/100*C.P.

Short cut Methods:
1.      By selling an article for Rs. X, a man loses l%. At what price should he sell it to gain y%?     (or)
A man lost l% by selling an article for Rs. X. What percent shall he gain or lose by selling it for Rs. Y?

(100 – loss%) : 1st S.P. = (100 + gain%) : 2nd S.P.

2.      A man sold two articles for Rs. X each. On one he gains y% while on the other he loses y%. How much does he gain or lose in the whole transaction?
In such a question, there is always a lose. The selling price is immaterial.

 

            Formula: Loss % =



3.      A discount dealer professes to sell his goods at cost price but uses a weight of 960 gms. For a kg weight. Find his gain percent.
 

Formula: Gain % =



RATIO & PROPORTIONS:
1.      The ratio a : b represents a fraction a/b. a is called antecedent and b is called consequent.
2.      The equality of two different ratios is called proportion.
3.      If a : b = c : d then a, b, c, d are in proportion. This is represented by a : b :: c : d.
4.      In a : b = c : d, then we have  a* d = b * c.
5.      If a/b = c/d then ( a + b ) / ( a – b  ) = ( d + c ) / ( d – c ).

TIME & WORK :
1.      If A can do a piece of work in n days, then A's 1 day's work = 1/n
2.      If A and B work together for n days, then (A+B)'s 1 days's work = 1/n
3.      If A is twice as good workman as B, then ratio of work done by A and B = 2:1

PIPES & CISTERNS :
1.      If a pipe can fill a tank in x hours, then part of tank filled in one hour = 1/x
2.      If a pipe can empty a full tank in y hours, then part emptied in one hour = 1/y
3.      If a pipe can fill a tank in x hours, and another pipe can empty the full tank in y hours, then on opening both the pipes,

the net part filled in 1 hour = (1/x-1/y)  if y>x
the net part emptied in 1 hour = (1/y-1/x) if x>y

TIME & DISTANCE :
1.      Distance = Speed * Time
2.      1 km/hr = 5/18 m/sec
3.      1 m/sec = 18/5 km/hr
4.      Suppose a man covers a certain distance at x kmph and an equal distance at y kmph. Then, the average speed during the whole journey is 2xy/(x+y) kmph.

PROBLEMS ON TRAINS :
1.      Time taken by a train x metres long in passing a signal post or a pole or a standing man is equal to the time taken by the train to cover x metres.
2.      Time taken by a train x metres long in passing a stationary object of length y metres is equal to the time taken by the train to cover x+y metres.
3.      Suppose two trains are moving in the same direction at u kmph and v kmph such that u>v, then their relative speed = u-v kmph.
4.      If two trains of length x km and y km are moving in the same direction at u kmph and v kmph, where u>v, then time taken by the faster train to cross the slower train = (x+y)/(u-v) hours.
5.      Suppose two trains are moving in opposite directions at u kmph and v kmph. Then, their relative speed = (u+v) kmph.
6.      If two trains of length x km and y km are moving in the opposite directions at u kmph and v kmph, then time taken by the trains to cross each other = (x+y)/(u+v)hours.
7.      If two trains start at the same time from two points A and B towards each other and after crossing they take a and b hours in reaching B and A respectively, then A's speed : B's speed = (√b : √

SIMPLE & COMPOUND INTERESTS :
Let P be the principal, R be the interest rate percent per annum, and N be the time period.
1.      Simple Interest = (P*N*R)/100
2.      Compound Interest = P(1 + R/100)N – P
3.      Amount = Principal + Interest

LOGARITHMS :
If am = x , then m = logax.
Properties :
1.      log xx = 1
2.      log x1 = 0
3.      log a(xy) = log ax + log ay
4.      log a(x/y) = log ax - log ay
5.      log ax = 1/log xa
6.      log a(xp) = p(log ax)
7.      log ax = log bx/log ba
Note : Logarithms for base 1 does not exist.

AREA & PERIMETER :
Shape                          Area                            Perimeter
Circle                           ∏ (Radius)2                  2∏(Radius)
Square                         (side)2                          4(side)
Rectangle                     length*breadth              2(length+breadth)

1.      Area of a triangle = 1/2*Base*Height or
2.      Area of a triangle = √ (s(s-(s-b)(s-c)) where a,b,c are the lengths of the sides and s = (a+b+c)/2
3.      Area of a parallelogram = Base * Height
4.      Area of a rhombus = 1/2(Product of diagonals)
5.      Area of a trapezium = 1/2(Sum of parallel sides)(distance between the parallel sides)
6.      Area of a quadrilateral = 1/2(diagonal)(Sum of sides)
7.      Area of a regular hexagon = 6(√3/4)(side)2  
8.      Area of a ring = ∏(R2-r2) where R and r are the outer and inner radii of the ring.

VOLUME & SURFACE AREA :
Cube :
Let a be the length of each edge. Then,
1.      Volume of the cube = a3 cubic units
2.      Surface Area = 6a2 square units
3.      Diagonal = √ 3 a units
Cuboid :
Let l be the length, b be the breadth and h be the height of a cuboid. Then
1.      Volume = lbh cu units
2.      Surface Area = 2(lb+bh+lh) sq units
3.      Diagonal = √ (l2+b2+h2)
Cylinder :
Let radius of the base be r and height of the cylinder be h. Then,
1.      Volume = ∏r2h cu units
2.      Curved Surface Area = 2∏rh sq units
3.      Total Surface Area = 2∏rh + 2∏r2 sq units
Cone :
Let r be the radius of base,  h be the height, and l be the slant height of the cone. Then,
1.      l2 = h2 + r2
2.      Volume = 1/3(∏r2h) cu units
3.      Curved Surface Area = ∏rl sq units
4.      Total Surface Area = ∏rl + ∏r2 sq units
Sphere :
Let r be the radius of the sphere. Then,
1.      Volume = (4/3)∏r3 cu units
2.      Surface Area = 4∏r2 sq units
Hemi-sphere :
Let r be the radius of the hemi-sphere. Then,
1.      Volume = (2/3)∏r3 cu units
2.      Curved Surface Area = 2∏r2 sq units
3.      Total Surface Area = 3∏r2 sq units
Prism :

Volume = (Area of base)(Height)


Exercise 1
Solve the following and check with the answers given at the end.

1.           It was calculated that 75 men could complete a piece of work in 20 days. When work was scheduled to commence, it was found necessary to send 25 men to another project. How much longer will it take to complete the work?

2.         A student divided a number by 2/3 when he required to multiply by 3/2. Calculate the percentage of error in his result.

3.         A dishonest shopkeeper professes to sell pulses at the cost price, but he uses a false weight of 950gm. for a kg. His gain is …%.

4.         A software engineer has the capability of thinking 100 lines of code in five minutes and can type 100 lines of code in 10 minutes. He takes a break for five minutes after every ten minutes. How many lines of codes will he complete typing after an hour?

5.         A man was engaged on a job for 30 days on the condition that he would get a wage of Rs. 10 for the day he works, but he have to pay a fine of Rs. 2 for each day of his absence. If he gets Rs. 216 at the end, he was absent for work for ... days.

6.         A contractor agreeing to finish a work in 150 days, employed 75 men each working 8 hours daily. After 90 days, only 2/7 of the work was completed. Increasing the number of men by­­ ________ each working now for 10 hours daily, the work can be completed in time.

7.         what is a percent of b divided by b percent of a?
                        (a)        a          (b)        b          (c)        1          (d)        10        (d)        100

8.         A man bought a horse and a cart. If he sold the horse at 10 % loss and the cart at 20 % gain, he would not lose anything; but if he sold the horse at 5% loss and the cart at 5% gain, he would lose Rs. 10 in the bargain. The amount paid by him was Rs.­­­­_______ for the horse and Rs.________ for the cart.

9.         A tennis marker is trying to put together a team of four players for a tennis tournament out of seven available. males - a, b and c; females – m, n, o and p. All players are of equal ability and there must be at least two males in the team. For a team of four, all players must be able to play with each other under the following restrictions:
                        b should not play with m,
                        c should not play with p, and
                        a should not play with o.
            Which of the following statements must be false?
1.      b and p cannot be selected together
2.      c and o cannot be selected together
3.      c and n cannot be selected together.

10-12.        The following figure depicts three views of a cube. Based on this, answer questions 10-12.
                             
6                             5   Cube:       2
Cube:      3
Cube:      2  
                             4    

                                                   1                   22      3                                6                                     
                       


10.       The number on the face opposite to the face carrying 1 is ­­­­_______ .

11.       The number on the faces adjacent to the face marked 5 are ­­_______ .

12.       Which of the following pairs does not correctly give the numbers on the opposite faces.
            (1)        6,5       (2)        4,1       (3)        1,3       (4)        4,2

13.       Five farmers have 7, 9, 11, 13 & 14 apple trees, respectively in their orchards. Last year, each of them discovered that every tree in their own orchard bore exactly the same number of apples. Further, if the third farmer gives one apple to the first, and the fifth gives three to each of the second and the fourth, they would all have exactly the same number of apples. What were the yields per tree in the orchards of the third and fourth farmers?

14.       Five boys were climbing a hill. J was following H. R was just ahead of G. K was between G & H. They were climbing up in a column. Who was the second?

15-18   John is undecided which of the four novels to buy. He is considering a spy
thriller, a Murder mystery, a Gothic romance and a science fiction novel. The books are written by Rothko, Gorky, Burchfield and Hopper, not necessary in that order, and published by Heron, Piegon, Blueja and sparrow, not necessary in that order.
            (1) The book by Rothko is published by Sparrow.
            (2) The Spy thriller is published by Heron.
(3) The science fiction novel is by Burchfield and is not published by Blueja.
            (4)The Gothic romance is by Hopper.
             
15.       Pigeon publishes ____________.

16.       The novel by Gorky ________________.

17.       John ­purchases books by the authors whose names come first and third in alphabetical order. He does not buy the books ­­______.

18.       On the basis of the first paragraph and statement (2), (3) and (4) only, it is possible to deduce that
1.      Rothko wrote the murder mystery or the spy thriller
2.      Sparrow published the murder mystery or the spy thriller
3.      The book by Burchfield is published by Sparrow.

19.       If a light flashes every 6 seconds, how many times will it flash in ¾ of an hour?

20.       If point P is on line segment AB, then which of the following is always true?
            (1) AP = PB   (2) AP > PB  (3) PB > AP  (4) AB > AP  (5) AB > AP + PB

21.       All men are vertebrates. Some mammals are vertebrates. Which of the following conclusions drawn from the above statement is correct.
All men are mammals
All mammals are men
Some vertebrates are mammals.
None

22.       Which of the following statements drawn from the given statements are correct?
            Given:
All watches sold in that shop are of high standard. Some of the HMT watches are sold in that shop.
a)      All watches of high standard were manufactured by HMT.
b)      Some of the HMT watches are of high standard.
c)      None of the HMT watches is of high standard.
d)      Some of the HMT watches of high standard are sold in that shop.

23-27.
1.      Ashland is north of East Liverpool and west of Coshocton.
2.      Bowling green is north of Ashland and west of Fredericktown.
3.      Dover is south and east of Ashland.
4.      East Liverpool is north of Fredericktown and east of Dover.
5.      Fredericktown is north of Dover and west of Ashland.
6.      Coshocton is south of Fredericktown and west of Dover.

23.       Which of the towns mentioned is furthest of the north – west
            ( Ashland                      (b) Bowling green                     (c) Coshocton 
(d) East Liverpool         (e) Fredericktown

24.       Which of the following must be both north and east of Fredericktown?
            ( Ashland                      (b) Coshocton              (c) East Liverpool
            I a only             II b only           III c only          IV a & b          V a & c

25.       Which of the following towns must be situated both south and west of at least one other town?
A.     Ashland only
B.     Ashland and Fredericktown
C.     Dover and Fredericktown
D.     Dover, Coshocton and Fredericktown
E.      Coshocton, Dover and East Liverpool.

26.       Which of the following statements, if true, would make the information in the numbered statements more specific?
(a)    Coshocton is north of Dover.
(b)   East Liverpool is north of Dover
(c)    Ashland is east of Bowling green.
(d)   Coshocton is east of Fredericktown
(e)    Bowling green is north of Fredericktown

27.       Which of the numbered statements gives information that can be deduced from one or more of the other statements?
            ( 1                    (B) 2                (C) 3                (D) 4                (E) 6   

28.       Eight friends Harsha, Fakis, Balaji, Eswar, Dhinesh, Chandra, Geetha, and Ahmed are sitting in a circle facing the center. Balaji is sitting between Geetha and Dhinesh. Harsha is third to the left of Balaji and second to the right of Ahmed. Chandra is sitting between Ahmed and Geetha and Balaji and Eshwar are not sitting opposite to each other. Who is third to the left of Dhinesh?

29.       If every alternative letter starting from B of the English alphabet is written in small letter, rest all are written in capital letters, how the month  “ September” be written.
            (1)        SeptEMbEr      (2)        SEpTeMBEr    (3)        SeptembeR     
(4)        SepteMber       (5)        None of the above.

30.       The length of the side of a square is represented by x+2. The length of the side of an equilateral triangle is 2x. If the square and the equilateral triangle have equal perimeter, then the value of x is _______.

31.       It takes Mr. Karthik y hours to complete typing a manuscript. After 2 hours, he was called away. What fractional part of the assignment was left incomplete?

32.       Which of the following is larger than 3/5?
            (1)        ½         (2)        39/50   (3)        7/25     (4)        3/10     (5)        59/100

33.       The number that does not have a reciprocal is ­­­____________.

34.       There are 3 persons Sudhir, Arvind, and Gauri. Sudhir lent cars to Arvind and Gauri as many as they had already. After some time Arvind gave as many cars to Sudhir and Gauri as many as they have. After sometime Gauri did the same thing. At the end of this transaction each one of them had 24. Find the cars each originally had.

35.       A man bought a horse and a cart. If he sold the horse at 10 % loss and the cart at 20 % gain, he would not lose anything; but if he sold the horse at 5% loss and the cart at 5% gain, he would lose Rs. 10 in the bargain. The amount paid by him was Rs.­­­­_______ for the horse and Rs.________ for the cart.

Answers:

1.         Answer:
30 days.
            Explanation:
            Before:
            One day work                          =          1 / 20
            One man’s one day work          =          1 / ( 20 * 75)
Now:
                        No. Of workers                        =          50 
                        One day work                          =          50 * 1 /  ( 20 * 75)

                        The total no. of days required to complete the work = (75 * 20) / 50  = 30

2.         Answer:
 0 %
            Explanation:
            Since 3x / 2  = x / (2 / 3)

3.         Answer:
5.3 %
            Explanation:
                        He sells 950 grams of pulses and gains 50 grams.
            If he sells 100 grams of pulses then he will gain (50 / 950) *100  =  5.26

4.         Answer:
250 lines of codes

5.         Answer:
7 days
Explanation:
The equation portraying the given problem is:
                         10 *  x – 2 * (30 – x) =  216   where x is the number of working days.
            Solving this we get x = 23
            Number of days he was absent was 7 (30-23) days.

6.         Answer:
150 men.
Explanation:
            One day’s work                       =          2 / (7 * 90)
            One hour’s work                      =          2 / (7 * 90 * 8)
            One man’s work                       =          2 / (7 * 90 * 8 * 75)

The remaining work (5/7) has to be completed within 60 days, because the total number of days allotted for the project is 150 days.

            So we get the equation
                       
                        (2 * 10 * x * 60) / (7 * 90 *  8 * 75)   =  5/7  where x is the number of men working after the 90th day.

            We get x = 225
            Since we have 75 men already, it is enough to add only 150 men.

7.         Answer:
(c) 1
Explanation:
            a percent of b : (a/100) * b
            b percent of a : (b/100) * a
            a percent of b divided by b percent of a : ((a / 100 )*b) /  (b/100) * a )) = 1

8.         Answer:
Cost price of horse =  Rs. 400 & the cost price of cart = 200.
Explanation:-
            Let x be the cost price of the horse and y be the cost price of the cart.
            In the first sale there is no loss or profit. (i.e.) The loss obtained is equal to the gain.

                        Therefore         (10/100) * x     =  (20/100) * y

                                                            X         =  2 * y     -----------------(1)
            In the second sale, he lost Rs. 10. (i.e.) The loss is greater than the profit by Rs. 10.

                        Therefore         (5 / 100) * x     =  (5 / 100) * y + 10 -------(2)
                        Substituting (1) in (2) we get
                                    (10 / 100) * y   =  (5 / 100) * y + 10
                                    (5 / 100) * y     =  10
                                    y = 200           
From (1) 2 * 200 = x = 400

9.         Answer:
 3.
            Explanation:
            Since inclusion of any male player will reject a female from the team. Since there should be four member in the team and only three males are available, the girl, n should included in the team always irrespective of others selection.

10.       Answer:
5

11.       Answer:
1,2,3 & 4

12.       Answer:
B

13.       Answer:
11 & 9 apples per tree.
            Explanation:
            Let a, b, c, d & e be the total number of apples bored per year in A, B, C, D & E ‘s orchard. Given that             a + 1 = b + 3 = c – 1 = d + 3 = e – 6 
But the question is to find the number of apples bored per tree in C and D ‘s orchard. If is enough to consider c – 1 = d + 3.
            Since the number of trees in C’s orchard is 11 and that of D’s orchard is 13. Let x and y be the number of apples bored per tree in C & d ‘s orchard respectively.
            Therefore 11 x – 1 = 13 y + 3
By trial and error method, we get the value for x and y as 11 and 9
           
14.       Answer:
G.
            Explanation:
            The order in which they are climbing is R – G – K – H – J    

15 – 18
Answer:
                        Novel Name                 Author              Publisher
                        Spy thriller                    Rathko             Heron
                        Murder mystery            Gorky              Piegon
                        Gothic romance            Burchfield         Blueja
                        Science fiction              Hopper                        Sparrow

            Explanation:
            Given
                        Novel Name                 Author              Publisher
                        Spy thriller                    Rathko             Heron
                        Murder mystery            Gorky              Piegon
                        Gothic romance            Burchfield         Blueja
                        Science fiction              Hopper                        Sparrow                      

Since Blueja doesn’t publish the novel by Burchfield and Heron publishes the novel spy thriller, Piegon publishes the novel by Burchfield.
Since Hopper writes Gothic romance and Heron publishes the novel spy thriller, Blueja publishes the novel by Hopper.
Since Heron publishes the novel spy thriller and Heron publishes the novel by Gorky, Gorky writes Spy thriller and Rathko writes Murder mystery.

19.       Answer: 
451 times.
Explanation:
There are 60 minutes in an hour.
            In ¾ of an hour there are (60 * ¾) minutes  = 45 minutes.
                        In ¾ of an hour there are (60 * 45) seconds = 2700 seconds.
            Light flashed for every 6 seconds.
                        In 2700 seconds 2700/6 = 450 times.
The count start after the first flash, the light will flashes 451 times in ¾ of an hour.

20.       Answer:
(4)
            Explanation:
                                                P         
                        A                                                         B         
            Since p is a point on the line segment AB, AB > AP
           
21.       Answer:  (c)
           
22.       Answer:  (b) & (d).






                                                                                    Ahmed
23 - 27.Answer:
                                                Fakis                                        Chandra
28.              Answer: Fakis                                    
Explanation:              Harsha                                                            Geetha
           
                                                Eswar                                       Balaji   

                                                                       
Dhinesh

29.              Answer:
(5).
Explanation:
            Since every alternative letter starting from B of the English alphabet is written in small letter, the letters written in small letter are b, d, f...
            In the first two answers the letter E is written in both small & capital letters, so they are not the correct answers. But in third and fourth answers the letter is written in small letter instead capital letter, so they are not the answers.

30.              Answer:
x = 4
Explanation:
Since the side of the square is x + 2, its perimeter = 4 (x + 2) = 4x + 8
Since the side of the equilateral triangle is 2x, its perimeter = 3 * 2x = 6x
Also, the perimeters of both are equal.
            (i.e.)     4x + 8 = 6x 
            (i.e.)     2x = 8 è x = 4.

31.       Answer:
                  (y – 2) / y.
Explanation: 
            To type a manuscript karthik took y hours.
            Therefore his speed in typing  = 1/y.
            He was called away after 2 hours of typing.
            Therefore the work completed = 1/y * 2.
            Therefore the remaining work to be completed = 1 – 2/y.
            (i.e.) work to be completed  = (y-2)/y

32.       Answer:
                        (2)

33.              Answer:         
1
            Explanation:
One is the only number exists without reciprocal because the reciprocal of one is one itself.

34.              Answer:         
Sudhir had 39 cars, Arvind had 21 cars and Gauri had 12 cars.
            Explanation:
                                                Sudhir                      Arvind                          Gauri

            Finally                                      24                                24                                24
Before Gauri’s transaction     12                                    12                                48
            Before Arvind’s transaction       6                                 42                                24
            Before Sudhir’ s transaction      39                                21                                12

35.       Answer:         
Cost price of horse:      Rs. 400 &
Cost price of cart:         Rs. 200
            Explanation:
                        Let x be the cost of horse & y be the cost of the cart.
                        10 % of loss in selling horse = 20 % of gain in selling the cart
                                    Therefore         (10 / 100) * x = (20 * 100) * y
è    x = 2y -----------(1)
5 % of loss in selling the horse is 10 more than the 5 % gain in selling the cart.
            Therefore         (5 / 100) * x - 10 = (5 / 100) * y
                        è        5x - 1000         =          5y
            Substituting (1)
                                    10y - 1000 = 5y
                                    5y = 1000
                                    y = 200
                                    x = 400            from (1)           

Exercise 2.1
For the following, find the next term in the series

1.         6, 24, 60,120, 210
 336                 b) 366              c) 330              d) 660
Answer:            336
Explanation:
The series is 1.2.3, 2.3.4, 3.4.5, 4.5.6, 5.6.7, .....          ( '.' means product)

2.         1, 5, 13, 25
Answer:          41
Explanation:
The series is of the form   0^2+1^2, 1^2+2^2,...

3.         0, 5, 8, 17
Answer:          24
Explanation:
1^2-1, 2^2+1, 3^2-1, 4^2+1, 5^2-1

4.         1, 8, 9, 64, 25 (Hint : Every successive terms are related)
Answer:          216
Explanation:
1^2, 2^3, 3^2, 4^3, 5^2, 6^3

5.         8,24,12,36,18,54  
Answer:          27

6          71,76,69,74,67,72
Answer:          67 

7.         5,9,16,29,54
Answer:          103
Explanation:
5*2-1=9; 9*2-2=16; 16*2-3=29; 29*2-4=54; 54*2-5=103

8.         1,2,4,10,16,40,64 (Successive terms are related)
Answer:          200
Explanation:
The series is powers of 2 (2^0,2^1,..).
All digits are less than 8.  Every second number is in octal number system.
          128 should follow 64. 128 base 10 = 200 base 8.

Exercise 2.2
Find the odd man out.

1.         3,5,7,12,13,17,19
Answer:          12
Explanation:
All but 12 are odd numbers

2.         2,5,10,17,26,37,50,64
Answer:          64
Explanation:
2+3=5; 5+5=10; 10+7=17; 17+9=26; 26+11=37; 37+13=50; 50+15=65;

3.         105,85,60,30,0,-45,-90
Answer:          0
Explanation:
105-20=85; 85-25=60; 60-30=30; 30-35=-5; -5-40=-45; -45-45=-90;

Exercise 3
Solve the following.

1.         What is the number of ‘0’ at the end of the product of the numbers from 1 to 100?
            Answer:          127
2.         A fast typist can type some matter in 2 hours and a slow typist can type the same in 3 hours. If both type combinely, in how much time will they finish?
            Answer:          1 hr 12 min
            Explanation:
The fast typist's work done in 1 hr = 1/2
                                   The slow typist's work done in 1 hr = 1/3
                                   If they work combinely, work done in 1 hr = 1/2+1/3 = 5/6
So, the work will be completed in 6/5 hours. i.e., 1+1/5 hours = 1hr 12 min

3.         Gavaskar's average in his first 50 innings was 50. After the 51st innings, his average was 51. How many runs did he score in his 51st innings. (supposing that he lost his wicket in his 51st innings)
            Answer:          101
            Explanation:
Total score after 50 innings = 50*50 = 2500
                        Total score after 51 innings = 51*51 = 2601
                        So, runs made in the 51st innings = 2601-2500 = 101  
If he had not lost his wicket in his 51st innings, he would have scored an unbeaten 50 in his 51st innings.

4.         Out of 80 coins, one is counterfeit. What is the minimum number of weighings needed to find out the counterfeit coin?
            Answer:          4

5.         What can you conclude from the statement : All green are blue, all blue are red. ?
                                                             i.      some blue are green
                                                           ii.      some red are green       
                                                          iii.      some green are not red 
                                                         iv.      all red are blue

1.      i or ii but not both
2.      i & ii only          
3.      iii or iv but not both       
4.      iii & iv
            Answer:          (2)

6.         A rectangular plate with length 8 inches, breadth 11 inches and thickness 2 inches is available. What is the length of the circular rod with diameter 8 inches and equal to the volume of the rectangular plate?
            Answer:          3.5 inches
            Explanation :
Volume of the circular rod (cylinder) = Volume of the rectangular plate
                        (22/7)*4*4*h = 8*11*2
                        h = 7/2 = 3.5

7.         What is the sum of all numbers between 100 and 1000 which are divisible by 14 ?
            Answer:          35392
            Explanation:
The number closest to 100 which is greater than 100 and divisible by 14  is 112, which is the first term of the series which has to be summed.
The number closest to 1000 which is less than 1000 and divisible by 14 is 994, which is the last term of the series.
                        112 + 126 + .... + 994 = 14(8+9+ ... + 71) = 35392

8.         If s( denotes square root of a, find the value of s(12+s(12+s(12+ ......    upto infinity.
            Answer:          4
            Explanation :
Let x = s(12+s(12+s(12+.....
We can write  x = s(12+x). i.e., x^2 = 12 + x. Solving this quadratic equation, we get x = -3 or x=4. Sum cannot be -ve and hence sum = 4.

9.         A cylindrical container has a radius of eight inches with a height of three inches. Compute how many inches should be added to either the radius or height to give the same increase in volume?
            Answer:          16/3 inches
            Explanation:
Let x be the amount of increase. The volume will increase by the same amount if the radius increased or the height is increased. So, the effect on increasing height is equal to the effect on increasing the radius.
            i.e., (22/7)*8*8*(3+x) = (22/7)*(8+x)*(8+x)*3
Solving the quadratic equation we get the x = 0 or 16/3. The possible increase would be by 16/3 inches.

10.       With just six weights and a balance scale, you can weigh any unit number of kgs from 1 to 364. What could be the six weights?
            Answer:          1, 3, 9, 27, 81, 243 (All powers of 3)  

11.       Diophantus passed one sixth of his life in childhood, one twelfth in youth, and one seventh more as a bachelor; five years after his marriage a son was born who died four years before his father at half his final age. How old is Diophantus?
            Answer:          84 years
            Explanation:
x/6 + x/12 + x/7 + 5 + x/2 + 4 = x
12.       If time at this moment is 9 P.M., what will be the time 23999999992 hours later?
            Answer:          1 P.M.
            Explanation:
24 billion hours later, it would be 9 P.M. and 8 hours before that it would be 1 P.M.

13.       How big will an angle of one and a half degree look through a glass that magnifies things three times?
            Answer:          1 1/2 degrees
            Explanation:
The magnifying glass cannot increase the magnitude of an angle.

14.       Divide 45 into four parts such that when 2 is added to the first part, 2 is subtracted from the second part, 2 is multiplied by the third part and the fourth part is divided by two, all result in the same number.
            Answer:          8, 12, 5, 20
            Explanation:
 a + b + c + d =45;       a+2 = b-2 = 2c = d/2; a=b-4; c = (b-2)/2; d = 2(b-2);            b-4 + b + (b-2)/2 + 2(b-2) = 45;

15.       I drove 60 km at 30 kmph and then an additional 60 km at 50 kmph. Compute my average speed over my 120 km.
            Answer:          37 1/2
            Explanation:
Time reqd for the first 60 km = 120 min.; Time reqd for the second 60 km = 72 min.; Total time reqd = 192 min
                        Avg speed = (60*120)/192 = 37 1/2

Questions 16 and 17 are based on the following :
Five executives of European Corporation hold a Conference in Rome     Mr. A converses in Spanish & Italian
Mr. B, a spaniard, knows English also
Mr. C knows English and belongs to Italy
Mr. D converses in French and Spanish
Mr. E , a native of Italy knows French

16.       Which of the following can act as interpreter if Mr. C & Mr. D wish to converse
             only Mr. A      b) Only Mr. B  c) Mr. A & Mr. B        d) Any of the other three
            Answer:          d) Any of the other three.
            Explanation:
From the data given, we can infer the following.
                        A knows Spanish, Italian
                        B  knows Spanish, English
                        C  knows Italian, English
                        D  knows Spanish, French
                        E   knows Italian, French
To act as an interpreter between C and D, a person has to know one of the combinations Italian & Spanish, Italian & French, English & Spanish, English & French. A, B, and E know atleast one of the combinations.

17.                   If a 6th executive is brought in, to be understood by maximum number of original five he should be fluent in
            English & French b)Italian & Spanish c)English & French d) French & Italian
            Answer:          b) Italian & Spanish
            Explanation:
 Number of executives who know
                             i) English is 2
                            ii) Spanish is 3
                            iii) Italian is 3
                            iv) French is  2
Italian & Spanish are spoken by the maximum no of executives. So, if the 6th executive is fluent in Italian & Spanish, he can communicate with all the original five because everybody knows either Spanish or Italian.         

18.        What is the sum of the first 25 natural odd numbers?
Answer:          625
Explanation:
The sum of the first n natural odd nos is square(n).
1+3 = 4 = square(2) 1+3+5 = 9 = square(3)

19.        The sum of any seven consecutive numbers is divisible by
a)      2    b) 7      c) 3      d) 11
Answer:
(a)     7
Explanation:
            Let x be any number. The next six consecutive numbers are x+1, x+2, x+3, x+4, x+5 and x+6. The sum of these seven numbers are 7x + 21. This is equal to 7(x+3). This number will always divisible by 7. Hence the result.

Exercise 3
Try the following.

1.      There are seventy clerks working in a company, of which 30 are females. Also, 30  clerks are   married; 24 clerks are above 25 years of age; 19 married clerks are above 25 years, of which 7 are males; 12 males are above 25 years of age; and 15 males are married. How many bachelor girls are there and how many of these are above 25?

2.            A man sailed off from the North Pole. After covering 2,000 miles in one direction he turned West, sailed 2,000 miles, turned North and sailed ahead another 2,000 miles till he met his friend. How far was he from the North Pole and in what direction?

3.            Here is a series of comments on the ages of three persons J, R, S by themselves.
                  S : The difference between R's age and mine is three years.
                  J : R is the youngest.
                  R : Either I am 24 years old or J 25 or S 26.
                  J : All are above 24 years of age.
                  S : I am the eldest if and only if R is not the youngest.
                  R : S is elder to me.
                        J : I am the eldest.
                  R : S is not 27 years old.
                  S : The sum of my age and J's is two more than twice R's age.
      One of the three had been telling a lie throughout whereas others had spoken the truth. Determine the ages of S,J,R.

4.            In a group of five people, what is the probability of finding two persons with the same month of birth?

5.            A father and his son go out for a 'walk-and-run' every morning around a track formed by an equilateral triangle. The father's walking speed is 2 mph and his running speed is 5 mph. The son's walking and running speeds are twice that of his father. Both start together from one apex of the triangle, the son going clockwise and the father anti-clockwise. Initially the father runs and the son walks for a certain period of time. Thereafter, as soon as the father starts walking, the son starts running. Both complete the course in 45 minutes. For how long does the father run? Where do the two cross each other?

6.            The Director of Medical Services was on his annual visit to the ENT Hospital. While going through the out patients' records he came across the following data for a particular day :  " Ear consultations 45; Nose 50; Throat 70; Ear and Nose 30; Nose and Throat 20; Ear and Throat 30; Ear, Nose and Throat 10; Total patients 100." Then he came to the conclusion that the records were bogus. Was he right?

7.            Amongst Ram, Sham and Gobind are a doctor, a lawyer and a police officer. They are married to Radha, Gita and Sita (not in order). Each of the wives have a profession. Gobind's wife is an artist. Ram is not married to Gita. The lawyer's wife is a teacher. Radha is married to the police officer. Sita is an expert cook. Who's who?

8.            What should come next?
      1, 2, 4, 10, 16, 40, 64,

      Questions 9-12 are based on the following :
      Three adults – Roberto, Sarah and Vicky – will be traveling in a van with five children – Freddy, Hillary, Jonathan, Lupe, and Marta. The van has a driver’s seat and one passenger seat in the front, and two benches behind the front seats, one beach behind the other. Each bench has room for exactly three people. Everyone must sit in a seat or on a bench, and seating is subject to the following restrictions:         An adult must sit on each bench.
    Either Roberto or Sarah must sit in the driver’s seat.
    Jonathan must sit immediately beside Marta.

9.            Of the following, who can sit in the front passenger seat ?
      ( Jonathan       (b) Lupe           (c) Roberto      (d) Sarah         (e) Vicky

10.       Which of the following groups of three can sit together on a bench?
      ( Freddy, Jonathan and Marta           (b) Freddy, Jonathan and Vicky
      (c) Freddy, Sarah and Vicky               (d) Hillary, Lupe and Sarah
      (e) Lupe, Marta and Roberto

11.        If Freddy sits immediately beside Vicky, which of the following cannot be true ?
    1. Jonathan sits immediately beside Sarah
    2. Lupe sits immediately beside Vicky
    3. Hillary sits in the front passenger seat
    4. Freddy sits on the same bench as Hillary
    5. Hillary sits on the same bench as Roberto

12.        If Sarah sits on a bench that is behind where Jonathan is sitting, which of the  following must be true ?
    1. Hillary sits in a seat or on a bench that is in front of where Marta is sitting
    2. Lupe sits in a seat or on a bench that is in front of where Freddy is sitting
    3. Freddy sits on the same bench as Hillary
    4. Lupe sits on the same bench as Sarah
    5. Marta sits on the same bench as Vicky

13.        Make six squares of the same size using twelve match-sticks. (Hint : You will need an adhesive to arrange the required figure)

14.        A farmer has two rectangular fields. The larger field has twice the length and 4 times the width of the smaller field. If the smaller field has area K, then the are of the larger field is greater than the area of the smaller field by what amount?
                  ( 6K                 (b) 8K              (c) 12K            (d) 7K

15.        Nine equal circles are enclosed in a square whose area is 36sq units. Find the area of each circle.

16.        There are 9 cards. Arrange them in a 3*3 matrix. Cards are of 4 colors. They are red, yellow, blue, green. Conditions for arrangement: one red card must be in first row or second row. 2 green cards should be in 3rd column. Yellow cards must be in the 3 corners only. Two blue cards must be in the 2nd row. At least one green card in each row.

17.        Is z less than w? z and w are real numbers.
                  (I) z2 = 25
                  (II) w = 9
      To answer the question,
                   Either I or II is sufficient
                  b) Both I and II are sufficient but neither of them is alone sufficient
                  c) I & II are sufficient
                  d) Both are not sufficient

18.        A speaks truth 70% of the time; B speaks truth 80% of the time. What is the probability that both are contradicting each other?

19.        In a family 7 children don't eat spinach, 6 don't eat carrot, 5 don't eat beans, 4 don't eat spinach & carrots, 3 don't eat carrot & beans, 2 don't eat beans & spinach. One doesn't eat all 3. Find the no. of children.

20.        Anna, Bena, Catherina and Diana are at their monthly business meeting. Their occupations are author, biologist, chemist and doctor, but not necessarily in that order. Diana just told the neighbour, who is a biologist that Catherina was on her way with doughnuts. Anna is sitting across from the doctor and next to the chemist. The doctor was thinking that Bena was a good name for parent's to choose, but didn't say anything.  What is each person's occupation?

Exercise 4.
1.            Krishna, Hari and Prakash went for a race. Krishna gives Hari a start of 20% of his distance, similarly gives Krishna a start of 20% of his distance. Prakash reached the designation within 80 sec. whose speed is half that of Krishna. But Hari is twice as fast as Prakash. By what time after Hari, Krishan reaches the designation.

2.            In a km race Siddharth beats Thanigai by 20% of the race distance. If Thanigai takes 20 sec more than Siddharth then by what is the difference in their speeds?

3.            In a 200m race between Karthik & Arasu, Arasu can give Karthik a start of 20m in the first 100m. When Karthik crosses the 80m mark both of them changes their speeds such that Karthik can give Arasu a start of 20m in the next 100m. They complete the race with that speed. Who is the winner of the race and by how many seconds?

4.            In a race between Vimal, Shree Hari and Varadha, Shree Hari can give Vimal 20% and Varadha 10% of their distance. then Varadha can give Vimal a start of _______% of his distance.

5.           In a cricket match Madan chases the ball, which is away from him by 20% of the distance between him and boundary. If the speed of Madan is 25% more than that of the ball then they will reach the boundary at the same time. If the speed of the ball is 20m/s then what is the distance between the ball and boundary?

6.            Ganesh & Thiagarajan and Suresh & Sakthivel were the two teams for a 2*100 m relay. In a hundred-meter race, Ganesh beats Suresh by 20m and Sakthivel beats Thiagarajan by 20m. The ratio of speeds of Suresh & Thiagarajan is 2:3. Suresh and Ganesh started the race. The winning team is _____. They win the race beating the losing team by _____.

7.            The two contestants of a car rally were Arvind and Abilash. Arvind starts 5sec later and beats Abilash by 5sec. The quickest person goes with a speed twice that of the other. If Abilash was 100m behind when Arvind finishes the race then what is the distance that Abilash has to cover to finish the game when Arvind begins the race?

8.            In a circular athletic ground Carl & Gauri started their race standing half a way from each other. The minimum distance between them is 28m. They have to complete the race at the same winning point, the Carl’s starting point. When the race was over Carl completed three full rounds & Gauri two. If both of them reached the goal at the same time what is the ratio between the speed of Carl & Gauri
.
9.            In a 1500-meter race, in a 100m circular track, between Guru and Selvam due to wrong judgement Guru beats Selva by 10sec. The mistake made by the judges was that they counted one round extra to Guru. The sum of time taken by them is 90sec. If the mistake was not made, then who is going to win the race & by how many seconds?

10.        In a game of 80 points, Sudhir can give Santhosh 5 points and Shree Ram 15 points. Then how many points Santhosh can give Shree Ram in a game of 60 points?










 
 







Section I – Data Structures
1.            What is data structure?
A data structure is a way of organizing data that considers not only the items stored, but also their relationship to each other. Advance knowledge about the relationship between data items allows designing of efficient algorithms for the manipulation of data.

2.            List out the areas in which data structures are applied extensively?
Ø  Compiler Design,
Ø  Operating System,
Ø  Database Management System,
Ø  Statistical analysis package,
Ø  Numerical Analysis,
Ø  Graphics,
Ø  Artificial Intelligence,
Ø  Simulation

3.            What are the major data structures used in the following areas : RDBMS, Network data model & Hierarchical data model.
Ø  RDBMS                         – Array  (i.e. Array of structures)
Ø  Network data model      – Graph
Ø  Hierarchical data model – Trees

4.                  If you are using C language to implement the heterogeneous linked list, what pointer type will you use?
The heterogeneous linked list contains different data types in its nodes and we need a link, pointer to connect them. It is not possible to use ordinary pointers for this. So we go for void pointer. Void pointer is capable of storing pointer to any type as it is a generic pointer type.
      
5.            Minimum number of queues needed to implement a priority queue?
Two. One queue is used for actual storing of data and another for storing priorities.

6.            What is the data structure used to perform recursion?
Stack. Because of its LIFO (Last In First Out) property it remembers its ‘caller’; so the function knows where to return when the function has to return. Recursion makes use of system stack for storing the return addresses of the function calls.
Every recursive function has its equivalent iterative (non-recursive) function. Even when such equivalent iterative procedures are written, explicit stack is to be used.

7.            What are the notations used in Evaluation of Arithmetic Expressions using prefix and postfix forms?
                        Polish and Reverse Polish notations.

8.            Convert the expression ((A + B) *  C – (D – E) ^ (F + G)) to equivalent Prefix and Postfix notations.
                        Prefix Notation:
            ^ - * +ABC - DE + FGPostfix Notation:
                        AB + C * DE - - FG + ^
9.            Sorting is not possible by using which of the following methods?
                        (a) Insertion    
                        (b) Selection    
                        (c) Exchange     
                        (d) Deletion
            Answer:
                        (d)deletion
            Explanation:
            Using insertion we can perform insertion sort, using selection we can perform selection sort, using exchange we can perform the bubble sort (and other similar sorting methods). But no sorting method can be done just using deletion.

10.        A binary tree with 20 nodes has            null branches.
Answer:
                        21
            Explanation:
                        Let us take a tree with 5 nodes (n=5)

 









            It will have only 6 (ie,5+1) null branches. In general, a binary tree with n nodes has exactly n+1 null nodes.

11.        What are the methods available in storing sequential files ?
Ø  Straight merging,
Ø  Natural merging,
Ø  Polyphase sort,
Ø  Distribution of Initial runs.

12.        How many different trees are possible with 10 nodes ?
Answer:
                        1014
            Explanation:
            For example, consider a tree with 3 nodes(n=3), it will have the maximum combination of 5 different (ie, 23 - 3 =  5) trees.
 







                        i                       ii                       iii                         iv                        v


            In general:
                        If there are n nodes, there exist 2n-n different trees.

13.        List out a few of the applications of tree data-structure in compilers/compiler design.
Ø  The manipulation of Arithmetic expression,
Ø  Symbol Table construction,
Ø  Syntax analysis.

14.        List out a few of the applications that make use of Multilinked Structures.
Ø  Sparse matrix,
Ø  Index generation.

15.        In tree construction which is the suitable efficient data structure?
                        (a ) Array          
                        (b) Linked list              
                        (c) Stack          
                        (d) Queue  
                        (e) none
Answer:
            (b) Linked list
1.            What type of the algorithm is used in solving the 8 Queens problem?
                        Backtracking

2.            In an AVL tree, what is the condition for balancing to be done?
                        The ‘pivotal value’(or the ‘Height factor’) is greater than 1 or less than–1.

3.            What is the bucket size, when overlapping and collision occur at the same time?
One. If there is only one entry possible in the bucket, when the collision occurs, there is no way to accommodate the colliding value. This results in the overlapping of values.

4.            Traverse the given tree using Inorder, Preorder and Postorder traversals.
Given tree:
 
 














Ø  Inorder :           D H B E A F C I G J
Ø  Preorder:          A B D H E C F G I J
Ø  Postorder:        H D E B F I J G C A

5.            There are 8, 15, 13, 14 nodes were there in 4 different trees. Which of them could have formed a full binary tree?
15.
In general:
                        There are 2n-1 nodes in a full binary tree.
By the method of elimination:
Full binary trees contain odd number of nodes. So there cannot be full binary trees with 8 or 14 nodes, so rejected. With 13 nodes you can form a complete binary tree but not a full binary tree. So the correct answer is 15.
            Note:
            Full and Complete binary trees are different. All full binary trees are complete binary trees but not vice versa.

6.            In the given binary tree, using array, at which location can can you store the node 4?
 




Answer:
            At location  6
            Explanation:             
1
2
3
-
-
4
-
-
5
Root
LC1
RC1
LC2
RC2
LC3
RC3
LC4
RC4
            where LCn means Left Child of node n and RCn means Right Child  of node n

7.            Sort the given values using Quick Sort?
           
65
70
75
80
85
60
55
50
45
            Sorting takes place from the pivot value, which is the first value of the given elements, this is marked bold. The values at the left pointer and right pointer are indicated using L and R respectively.   
65
70L
75
80
85
60
55
50
45R
            Since pivot is not yet changed the same process is continued after interchanging the values at L and R positions

65
45
75 L
80
85
60
55
50 R
70
65
45
50
80 L
85
60
55 R
75
70
65
45
50
55
85 L
60 R
80
75
70
65
45
50
55
60 R
85 L
80
75
70
            When the L and R pointers cross each other the pivot value is interchanged with the value at right pointer. If the pivot is changed it means that the pivot has occupied its original position in the sorted order (shown in bold italics) and hence two different arrays are formed, one from start of the original array to the pivot position-1 and the other from pivot position+1 to end.

60 L
45
50
55 R
65
85 L
80
75
70 R
55 L
45
50 R
60
65
70 R
80 L
75
85
50 L
45 R
55
60
65
70
80 L
75 R
85

                        In the next pass we get the sorted form of the array.

45
50
55
60
65
70
75
80
85

8.            For the given graph, draw the DFS and BFS?
           
 








Ø  BFS:    A X G H P E M Y J
Ø  DFS:    A X H P E Y M J G

24.        Classify the Hashing Functions based on the various methods by which the key value is found.
Ø  Direct method,
Ø  Subtraction method,
Ø  Modulo-Division method,
Ø  Digit-Extraction method,
Ø  Mid-Square method,
Ø  Folding method,
Ø  Pseudo-random method.          

25.        What are the types of Collision Resolution Techniques and the methods used in each of the type?
Ø  Open addressing (closed hashing).
The methods used include:
                        Overflow block.
Ø  Closed addressing (open hashing)
The methods used include:
Linked list, Binary tree…

26.        In RDBMS, what is the efficient data structure used in the internal storage representation?
B+ tree. Because in B+ tree, all the data are stored only in leaf nodes, that makes searching easier. This corresponds to the records that shall be stored in leaf nodes.

27.        Draw the B-tree of order 3 created by inserting the following data arriving in sequence – 92  24  6  7  11  8  22  4  5  16  19  20  78
 












28.                      Of the following tree structure, which is efficient considering space and time complexities?
(a)   Incomplete Binary Tree
(b)   Complete Binary Tree     
(c)    Full Binary Tree
Answer:
                        (b) Complete Binary Tree.
            Explanation:
By the method of elimination:
Full binary tree loses its nature when operations of insertions and deletions are done. For incomplete binary trees, extra storage is required and overhead of NULL node checking takes place. So complete binary tree is the better one since the property of complete binary tree is maintained even after operations like additions and deletions are done on it. 

29.        What is a spanning Tree?
A spanning tree is a tree associated with a network. All the nodes of the graph appear on the tree once. A minimal spanning tree is a spanning tree organized so that the total edge weight between nodes is minimized.

30.        Does the minimal spanning tree of a graph give the shortest distance between any 2 specified nodes?
Answer:
                        No.
            Explanation:
            Minimal spanning tree assures that the total weight of the tree is kept at its minimum. But it doesn’t mean that the distance between any two nodes involved in the minimum-spanning tree is minimum.

31.        Convert the given graph with weighted edges to minimal spanning tree.
           
           




                        the equivalent minimal spanning tree is:

32.  Which is the simplest file structure?
(a)   Sequential
(b)   Indexed
(c)    Random
Answer:
(a) Sequential

33.        Is linked-list a linear or non-linear data structure?
                        According to Access strategies Linked list is a linear one.
                        According to Storage, Linked List is a Non-linear one.

34.        Draw a binary Tree for the expression :
                        A * B - (C + D) * (P / Q)
 











35.        For the following COBOL code, draw the Binary tree?
                        01 STUDENT_REC.
                        02 NAME.
                        03 FIRST_NAME PIC X(10).
                        03 LAST_NAME PIC X(10). 
                        02 YEAR_OF_STUDY.
                        03 FIRST_SEM PIC XX.
                        03 SECOND_SEM PIC XX.
 



Section II – Algorithms
1.            What is an ‘algorithm’?
An algorithm consists of a finite set of steps that may require one or more operations. These operations should be definite and effective. An algorithm should produce one or more output’s and may have zero or more inputs.
This consists of five distinct areas:
            1. to device algorithms    
2. to validate the algorithms    
3. to express the algorithms    
4. to analyse the algorithms    
5. to test the programs for the algorithms    

2.            What is a ‘computational procedure’?
An algorithm that does not terminate is called ‘computational procedure’. Example for such ‘computational procedure’ is an ‘operating system’.

3.            Define - ‘recursive algorithm’.
An algorithm is said to be recursive if the same algorithm is invoked in the body of the algorithm. Recursive algorithms can be divided into direct recursive and indirect recursive algorithms.
Direct recursive:
                        An algorithm that calls itself.
Indirect Recursive:  
An algorithm ‘A’ is said to be indirect recursive if it calls another algorithm which in-turn calls algorithm ‘A’.

4.            How can you classify performance analysis?
‘Performance analysis’ can be classified as:
i.         priori analysis
ii.       posteriori analysis
Priori Analysis:
The bounds of algorithms’ computing time are obtained by formulating a function.
Posteriori Analysis:
Testing the actual computation of space and time are recorded while the algorithm is executing.

5.            Define - ‘Big- O’. 
For the function f(n)
f(n)=O(g(n)) 
iff there exist positive constants c and  d such that:
f(n) <=c*g(n)
for all n,n>=d.
This is defined to be the worst-time complexity of the function f(n).
For example:   
O(n)=3n+2 because,
                    3n+2 <=4n for all n>=2.

6.            Give various computing times and their meaning.
Few of the important computing times are:
       Computing  Time                                Meaning

O(1)                                         :           constant computing time
O(n)                                         :           linear computing time
O(n*n)                                     :           quadratic computing time
O(n*n*n)                                 :           cubic computing time
O(2*2*2*2*..............*n)         :           exponential computing time
          
7.            Give the most important ‘basic designs‘ of algorithms.
                    There are five important basic designs for algorithms. They are:
i.         Divide and conquer,
ii.       The greedy method,
iii.      Dynamic programming,
iv.     Back-tracking,
v.       Branch  and bound.
                      
8.            How does ‘divide and conquer’ algorithms work?
For a function to compute on n inputs the divide and conquer strategy suggests the inputs into a k distinct subsets, 1<k<=n, yielding k sub-problems. These sub-problems must be solved and then a method must be found to combine the sub-solutions into a solution of the whole.
An example for this approach is ‘binary search’ algorithm. The time complexity of binary search algorithm is O(log n).

9.            What is Greedy Method?
The greedy method suggests that one can devise an algorithm that works in stages, considering one input at a time. At each stage, a decision is made regarding whether a particular input is an optimal solution. An example for solution using greedy method is ‘knapsack problem’.

10.        What is Dynamic Programming?
Dynamic Programming is an algorithm design method that can be used when the solution to a problem can be viewed as the result of a sequence of decisions. An example for algorithm using dynamic programming is ‘multistage graphs’.

11.        What are the time complexities for the following algorithms?
Binary search                      :           O(logn)
Finding maximum and minimum for a given set of numbers
:           O(3n/2-2)
Merge Sort                         :           O(nlogn)
Insertion Sort                      :           O(n*n);
Quick Sort                         :           O(nlogn)
Selection Sort                     :           O(n)

12.        What is the difference between Merge Sort and Quick sort?
Both Merge-sort and Quick-sort have same time complexity i.e. O(nlogn). In merge sort the file a[1:n] was divided  at its midpoint into sub-arrays which are independently sorted and later merged. Whereas, in quick sort the division into two sub-arrays is made so that the sorted sub-arrays do not need to be merged latter.

13.        Is there any optimum solution for Matrix multiplication?
Yes. Divide and conquer method suggests Strassen’s matrix multiplication method to be used. If we follow this method, the time complexity is O(n*n*n……..*2.81) times rather O(n*n*n*………*3) times.

14.        Define ‘minimum cost spanning method’.
Let G=(V,E) be an undirected connected graph. A sub-graph t =(V, E’) of G is a spanning tree of G if and only if t is a tree.
To find out minimum cost spanning method we have following method’s;
Prim’s Algorithm           :           O(n*n)
Kruskal’s Algorithm      :           O(e loge)

15.        Define ’articulation points’.
A Vertex V in a connected graph G is an articulation point if and only if the deletion of vertex V together will all edges incident for disconnects the graph into two or more non-empty Components.

16.        Define ‘biconnected graph’.
A graph G is biconnected if and only if it contains no articulation points.

17.        What are ‘explicit’ and ‘implicit’ constraints?  
‘Explicit constraints’ are rules that restrict each xi to take on values only from a given set. ‘Implicit constraints’ are rules that determine which of the tuples in the solution space of i satisfy the criterion function.

18.        Give ‘Cookies – theorem’.
Satisfiability is in P iff P=NP
where P is the set of all decision problems solvable by deterministic algorithms in polynomial time and NP is the set of all decision problems solvable by non-deterministic algorithms in a polynomial-time.



No comments:

Post a Comment