Showing posts with label Aptitude. Show all posts
Showing posts with label Aptitude. Show all posts

Friday, August 17, 2012

Infosys Practice Relative Speed Problems

Dear Reader, Below are three practice relative speed problems. These are actually simple but could be lengthy consuming time.
Question 1
Two persons - Srikanth and Kashyap start at --6 am on 19th February 2012 from two places – Coimbatore and Hyderabad ( 900 km away at ) — each going towards the other end in two cars. Rupashri starts from Coimbatore at 7 am on the same day from Coimbatore towards Hyderabad. Srikanth, Rupashri and Kashyap travel at 40 km/hour, 60 km/hour and 50 km/hour respectively. Which pair will meet on the way – Srikanth –Kashyap or Kashyap-Rupashri or Srikanth-Rupashri.
a) Srikanth-Kashyap b) Srikanth-Rupashri c) Kashyap-Rupashri d) none of these.
Answer :
 b) Srikanth –Rupashri.
Solution :
Case I : Consider Srikanth and Kashyap
Distance between Coimbatore and Hyderabad - 900 km
Srikanth and Kashyap start at 6 am and their speeds are respectively 40 km/hour and 50 km/hour. So relative speed is 40 + 50 = 90 km. Hence they will meet after [distance between them/relative speed] = 900/90 = 10 hours from 6 am i.e 4 pm

Case II: Consider Rupashri and Kashyap
Rupashri starts at 7 am from Coimbatore – speed 60 km/hour. But since Kashyap had started at 6 am (1 hour earlier at 50Km/hr) he would have travelled 50 km by 7am. Distance between them = 900 - 50 =850 km. Relative speed = 60 + 50 = 110.
Rupashri and Kashyap will meet after [distance between them/relative speed] = 850/110 = 7 and 8/11 hours.

Case III: Consider Rupashri and Srikanth
On the other hand When Rupashri starts – 7 AM Srikanth would have travelled 40 km only (as Srikanth would had started at 6 am travelling at 40 Km/hr).
The speed of Rupashri and Srikanth = 60 and 40 km/hour. Relative speed of Rupashri with respect to Srikanth = 60 - 40 = 20 km per hour (we are subtracting the speeds in relative speed calculation as they are both travelling in same direction) and hence Rupashri will cross/meet Srikanth after [distance between them/relative speed] = 40/20 = 2 hours i.e. at 9 am.

Inference : Considering all discussed cases above, Srikanth-Rupashri will meet first at 9 am.

Question 2
The distance between Chennai and other cities is given below:

Agartala3356Gurgaon2088Panaji923
Agra1892Guwahati2718Paradwip1359
Ahmedabad1800Gwalior1768Pathankot2570
Aizawl3281Haldia1660Patna2022
Ajmer1978Hassan518Pondicherry165
Priya starts from Chennai at 8 AM, 20th February 2012 towards Ahmedabad. Shriya starts from Ahmedabad on the same day at 9 AM towards Chennai. Ramya starts from Chennai at 10 AM on the same day towards Ahmedabad. Which pair will meet on the way – Priya - Shriya or Ramya – Priya or Ramya - Shriya? Assume Priya travelled at 100 km/hour, Ramya travelled at 110 km/hour and Shriya travelled at 90 km/hour.
a) Priya-Shriya
b) Ramya – Priya
c) Ramya – Shriya
d) None of these.

Answer :
a) Priya- Shriya
Solution :
In these types of problems careful analysis of information and appropriate understanding is very important. It is equally important to learn to identify relevant and irrelevant information in the data provided and discard the unwanted information. For example in this question distances between Chennai to other places except that of Ahmedabad is not required (unwarranted ) and can be safely ignored.
Case I
Priya starts at 8 am – speed - 100 km/hour. Shriya starts from Ahmedabad at 9 am with a speed of 90 km/hour. Original distance between Chennai and Ahmedabad is 1800 Km. But since Shriya has started 1 hour late, Priya would had covered 100 Kms (travelling at 100 Km/hr) by 9 am. Therefore, at 9 am distance between Priya and Shriya is 1800 - 100 = 1700 km. Relative speed = 100 + 90 = 190 km/hour. They will meet at [Distance between them / Relative speed] = 1700/190 = 8 18/19 hours from 9 am i.e. around 5.57 pm.

Case II
Ramya starts from Chennai at 10 am at 110 km/hour. But since Shriya has started at 9 am, she would had covered 90 Km (travelling at 90 Km/hr). At 10 am distance between Ramya and Shriya = 1800 + 90 = 1890 km. Relative speed = 110 + 90 = 200 km/hour. They will meet at [Distance between them / Relative speed] =1890/200 hours = 9 and 9/20 hours after 10 am. And it will be around 7.27 pm.

Case III
At 10 am when Ramya starts Priya would have travelled 200 km (as Priya had started at 2 hours earlier i.e at 8 am, she would had covered 200 Km in 2 hours till 10 am when Ramya starts). At 10 am Distance between Ramya and Priya is 200km. Relative speed is 110-100 = 10 km/hour (we are subtracting the speeds for relative speed calculation as both are travelling in same direction) and they will meet at [Distance between them / Relative speed] = 200/10 = 20 hours . But we know that Priya would had covered the entire distance between Chennai and Ahmedabad in Distance between two cities / Priya's Speed = 1800/100 = 18 hours. This means that Ramya will not be able to meet Priya before reaching Ahmedabad.

Inference : Considering all the above cases, Priya- Shriya will be meeting first.
Question 3
The chart showing the distance of different cities/towns from Madurai is given below:

CityDistance (Kms)CityDistance (Kms)CityDistance (Kms)
Agartala3800Guntur840Panaji1024
Agra2304Gurgaon2500Paradwip1803
Ahmedabad1938Guwahati3162Pathankot2982
Akola1507Hasan533Porbandar2332
Allahabad2100Hubli851Purulia2146
Ambala2698Hyderabad1000Raipur1773
Karthik travelled from Madurai to Gurgaon in his car with an average speed of 130 km/hour starting at 5 am. Jeeva travelled from Hyderabad towards Madurai in his car with an average speed of 60 km/hour starting at 10 am on the same day. Surya started at 10 am for Hyderabad from Madurai and he travelled at an average speed of 40 km/hour. Vijay started at 5 am from Gurgaon towards Madurai and he was travelling at 120 km/hour. Which pair will meet first and at what time
a) Vijay – Karthik at 1 pm
b) Surya – Jeeva at 5 pm
c) Karthik – Vijay at 3 pm
d) Jeeva – Surya at 8 pm

Answer :
c) Karthik – Vijay at 3 pm
Solution :
Relative speed of Karthik & Vijay pair - 130 + 120 = 250 km/hour.
Since both Vijay and Karthik start at 5 am the distance between them at the start will be exactly the distance between Madurai and Gurgaon from the chart = 2500 km. They will meet at [Distance between them / Relative speed] = 2500/250 = 10 hours from 5 am = 3 pm
Relative speed of Surya & Jeeva = 40 + 60 = 100 km/hour
Since both Surya and Jeeva started at 10 am, distance between them at the start will be exactly the distance between Madurai and Hyderabad from the chart – 100 km. They will meet at [Distance between them / Relative speed] = 1000/100 = 10 hours from 10 am = 8 pm.
So the pair Karthik- Vijay will meet first at 3 pm.

Monday, August 13, 2012

Interview questions on Bitwise Operators

1)Which bit wise operator is suitable for turning off a particular bit in a number?

2)what will be printed out when the following code is executed:

main()
{
printf("%x",-1<<4);
}

3)Which one is equivalent to multiplying by 2?

* Left shifting a number by 1
* Left shifting an unsigned int or char by 1?

4)Write a function which gets the n bits from an unsigned integer x, starting from position p .(the right most digit is at position 0)

5)Write a function using bitwise opetators to check whether an integer is a power of 2 or not?

6)Write a Program that swaps the contents of two variables without
using any other variable,using bitwise operators?

7) Which bit wise operator is suitable for checking whether a particular bit is on or off?

8) Which bit wise operator is suitable for putting on a particular bit in a number?

9) Which bit wise operator is suitable for checking whether a particular bit is on or off?

10)Write a function setbits(x,p,n,y) that returns x with the n bits that begin at position p set to the rightmost n bits of y,leaving the other bits changed.

11)Write a function invert(x,p,n) that returns x with the n bits that begin at position p inverted leaving other unchanged

Frequently Asked C Interview Questions With Answers-2

Here, are some sample questions based on “C Programming language”. Read it carefully as these questions will help you in cracking any interview.


Question -6) What is scope & storage allocation of extern and global variables?

Extern variables are global variables. These variables belong to the external storage class and are stored in the system’s main memory. They are declared in a separate source file which could be outside the current program scope. The scope of these variables is global.

Global variables are variables declared above the main function. They are accessible throughout the program. They have 0 as the default value.


Question -7) What is scope & storage allocation of register?

Register variables are storage allocated in the CPU registers. Since they are stored in the CPU registers, their storage and accessibility is much easier and faster than other variables. The scope of register variables is local to the blocks in which they are defined.


Question -8) What is scope & storage allocation of static and local variables?

The storage allocation of static variables is done at the beginning of program execution. After the program terminates, the memory is reallocated. Scope of static variables is local to the block within which they are defined.

Local variables are variables defined within a function or program. Their default value is a garbage value and they are accessed only by the particular function or program.


Question -9) What is the difference between 'break' and 'continue' statements?

The break keyword is used to terminate a loop or exit from a block. After exiting, the program control jumps to the statement after the loop or block.

The continue keyword is used to skip a current iteration and move to the next iteration.


Question -10) What is the difference between uses of 'for' and 'while' loops?

When a user wants to initialize, check condition and increment or decrement the value of a variable in a single statement, and using an iterative loop, then the loop used may be for loop.

When the user wants to initialize, check condition and increment or decrement value not using a single iterative loop, then he/she may use the while loop. Only one condition can be checked using the while loop.

Frequently Asked C Interview Questions With Answers

Here, are some sample questions based on “C Programming language”. Read it carefully as these questions may help you in cracking any interview.


Question:1) What is the difference between declaring a variable and defining a variable?
The difference between declaring a variable and defining a variable is that while declaring a variable, the compiler verifies if the variable has been defined elsewhere but does not allocate memory for that variable. It is a kind of explicit declaration of a variable.

But while defining a variable, the compiler allocates specific memory for the variable and initializes the variable to some value. Normally, variables are declared after defining.



Question:2) Define static variable?

A static variable is a variable which has been allocated statically. i.e., the life of the variable extends as long as the entire run of the program. Static variables are global variables and find wide use in programs. It is declared as:
static datatype variable;


Question:3) What is a register variable?
Register variables are special variants of automatic variables. Register variables are stored in processor registers. The system register provides a certain control of efficiency of the program when variables are declared as register variables.

Question:4) Where is an auto variable stored?
An auto variable is stored in the computer’s main memory.

Question:5) What is meant by scope and storage allocation of a variable or function?
The scope of a variable is defined by the storage allocation of that variable. Storage allocation of a variable decides the memory part where storage space is allocated for a particular variable or function.







Saturday, August 11, 2012

PLACEMENTS: PRACTICE TALLYING THE COST PROBLEMS WITH SOLUTION



Its Placements days......

Quants tests are always taken during placements in companies like TCS, Infosys, Wipro, Samsung etc.....

so i am with some problems based on costs calculation and tallying collected from various websites.

this may be usefull...





Question 1
Santosh Iyer had Rs.35 with him and he went for shopping. Vendor was selling one apple for Rs.5, two bananas for Rs.5 and three guavas for Rs. 5. If Santosh Iyer wants to give equal number of fruits to three of his friends what is the combination (for each of his friends) in which he can buy and give fruits?
a) Two apples, two bananas and two guavas

b) One apple, two bananas and one guava

c) Three apples, two bananas, two guavas

d) None of these.

Answer : b) One apple, two bananas and one guava

Solution :

Cost Observations :

Cost of 1 apple = Rs. 5

Cost of 2 bananas = Rs. 5. Therefore cost of 1 banana = Rs. 5/2

Cost of 3 guavas = Rs. 5. Therefore cost of 1 guava = Rs. 5/3

Now its time to inspect option by option, if the total money spent tallies with the amount originally had.

i) Consider Option a) 2 Apples, 2 Bananas, 2 Guavas

If a combination 2 apples, 2 bananas and 2 guavas are given to each friend (totally 3 friends), he would have to buy 2 x 3 = 6 apples, 2 x 3 = 6 bananas and 2 x 3 = 6 guavas

Total Cost = 6 apples x Cost of 1 apple + 6 bananas x Cost of 1 banana + 6 guavas x Cost of 1 guava

= 6 x 5 + 6 x 5/2 + 6 x 5/3 = 30 + 15 + 10 = Rs .55

But Rs. 55 is not equal to Rs. 35 which Santosh had initially. Therefore, option a cannot be the right answer.

ii) Consider Option b) 1 Apple, 2 Bananas and 1 Guava

If option b combination is given to each of his friends, in total he would have to buy 3 apples, 6 bananas and 3 guavas.

Total Cost = 3 apples x Cost of 1 apple + 6 bananas x Cost of 1 banana + 3 guavas x Cost of 1 guava

= 3 x 5 + 6 x 5/2 + 3 x 5/3 = 15 + 15 + 5 = Rs. 35

Here, Total cost Rs. 35 tallies perfectly with the amount of Rs. 35 that Santosh had initially. Therefore, option b is correct.

Question 2

Srinisha went to a leading stationery shop for buying gifts for her four friends—Two pens cost Rs.40, each eraser costs Rs.15 and two sharpeners are sold for Rs.12.50. Srinisha had Rs.300 with her. In which combination she can buy these items so that she can present her friends equal number of pens, sharpeners and erasers?

a) Two pens, one eraser and one sharpener

b) One pen, two erasers and four sharpeners

c) One pen, four erasers and two sharpeners

d) Two pens, Two erasers and two sharpeners

Answer : b) One pen, two erasers and four sharpeners

Solution :

This question is very similar to question number 1.

Cost Observations :

Cost of 1 pen = Rs. 40/2 = Rs. 20

Cost of 1 eraser = Rs. 15

Cost of 1 sharpener = Rs. 12.5/2

Consider option a) 2 pens, 1 eraser, 1 sharpener

If option a) combination is to be given to each of her 4 friends, she should buy 8 pens, 4 erasers and 4 sharpeners

Total Cost = 8 pens x Cost of 1 pen + 4 erasers x Cost of 1 eraser + 4 sharpeners x Cost of 1 sharpener

= 8 x 20 + 4 x 15 + 4 x 12.5/2 = Rs. 465

But Rs. 465 is not equal to Rs. 300 which Srinisha had initially. Therefore, option a is not correct.

Consider option b) 1 pen, 2 erasers and 4 sharpeners

For 4 friends, she should buy 4 pens, 8 erasers and 16 sharpeners.

Total Cost = 4 pens x Cost of 1 pen + 8 erasers x Cost of 1 eraser + 16 sharpeners x Cost of 1 sharpener

= 4 x 20 + 8 x 15 + 16 x 12.5/2 = Rs. 300

Total cost of Rs. 300 matches perfectly with Rs. 300 that Srinisha had initially. Hence, option b is correct.

Question 3

Pragathi won Super Singer Contest and wanted to give fruits to her five friends equal number of each fruits. In what combination can she purchase and give if she has Rs.1175 with her.? -- 4 Papayas cost Rs. 100, One avocado costs Rs. 62.50, ten apples cost Rs.300.

a) One papaya, two avocados, 2 apples

b) Two papayas, two avocados, 1 apple

c) Two papayas, 2 avocados, 2 apples

d) Three apples, two avocados, 2 apples.

Answer : c) Two papayas, 2 avocados, 2 apples

Solution :

Cost Observations :

One papaya costs Rs. 25

One avocado costs Rs. 62.50

One apple costs Rs. 30

Consider option a) 1 papaya, 2 avocado, 2 apples

To give the above combination to each of her 5 friends, she should buy 5 papayas, 10 avocados and 10 apples

Total Cost = 5 papayas x Cost of 1 papaya + 10 avocados x Cost of 1 avocados + 10 apples x Cost of 1 apple

= 5 x 25 + 10 x 62.5 + 10 x 30 = Rs. 1050

But Rs. 1050 is not equal to Rs. 1175, which she had initially. Hence, option a is not correct.

Consider option b) 2 papayas, 2 avocados, 1 apple

To give the above combination to each of her 5 friends, she should buy 10 papayas, 10 avocados and 5 apples

Total Cost = 10 papayas x Cost of 1 papaya + 10 avocados x Cost of 1 avocados + 5 apples x Cost of 1 apple

= 10 x 25 + 10 x 62.5 + 5 x 30 = Rs. 1025

But Rs. 1025 is not equal to Rs. 1175, which she had initially. Hence, option b is not correct.

Consider option c) 2 papayas, 2 avocados, 2 apples

To give the above combination to each of her 5 friends, she should buy 10 papayas, 10 avocados and 10 apples

Total Cost = 10 papayas x Cost of 1 papaya + 10 avocados x Cost of 1 avocados + 10 apples x Cost of 1 apple

= 10 x 25 + 10 x 62.5 + 10 x 30 = Rs. 1175

Total cost is exactly equal to Rs. 1175, which she had initially. Hence, option c is correct.

Thursday, July 12, 2012

Very Good Book on Reasoning Skills Development


This book is designed to help you improve your critical thinking and reasoning skills in 20 short lessons of 20 minutes a day.

If you read one chapter a day,Monday through Friday, and do all the exercises carefully, you should see dramatic improvement in your ability to think critically and to solve problems logically and effectively by the end of your month of study.
share dis with your friends
Follow my blog:http://vimalzalariya.blogspot.com

Collection of a Objective Questions on C and C++

As we all know that in Tests of Campus Placement of Core Comapnies of IT industries questions of C and C++ are very frequent.
So here is a very nice document conatining collection of few of them.
this may be help full to all of you.

Dont hesitate to add comments and write reviews of my post
FOLLOW MY BLOG TO GET MORE..
follow the Download link given below.

DOWNLOAD NOW
Related Posts Plugin for WordPress, Blogger...