ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Do you have a collection of Interview Questions and interested to share with us!!
Please send that collection to along with your userid / name. ThanQ
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C++  >>  OOPS
 
 


 

 
 STL interview questions  STL Interview Questions
 OOPS interview questions  OOPS Interview Questions
 C++ General interview questions  C++ General Interview Questions
Question
We have a scale and 7 balls. 1 ball is heavier than all the 
rest. How to determine the heaviest ball with only 3 
possible weighing attempts? 
 Question Submitted By :: Kunal
I also faced this Question!!     Rank Answer Posted By  
 
  Re: We have a scale and 7 balls. 1 ball is heavier than all the rest. How to determine the heaviest ball with only 3 possible weighing attempts?
Answer
# 1
let a,b,c,d,e,f,g be the 7 balls,
group them 
a and b group 1
b and c group 2 and others one group
 weigh group 1 against group 2
if they are not equal weigh the individual balls with 
respect to each other 

if they are not equal(group 1 is not equal to group 2) 
weigh e against f, if they are not equal heaviest among 
them is ur answer else g is the answer.
 
Is This Answer Correct ?    0 Yes 3 No
Srini
 
  Re: We have a scale and 7 balls. 1 ball is heavier than all the rest. How to determine the heaviest ball with only 3 possible weighing attempts?
Answer
# 2
(Step-1)Divide the balls into 2 groups of 3 each, and weigh 
them. If they weigh same, then the 7th ball outside is the 
heaviest.
(Step-2) If not then, 
one of the 3 balls group being weighed is heavier. Take 
them down and consider the heavier group, with one ball on 
each side of the balance. 
(Step-3)if they measure unequal, then the heavier one is 
detected, and if they measure equal then the one outside is 
heavier.
 
Is This Answer Correct ?    4 Yes 1 No
Subir
 
 
 
  Re: We have a scale and 7 balls. 1 ball is heavier than all the rest. How to determine the heaviest ball with only 3 possible weighing attempts?
Answer
# 3
Sorry guys, you failed the interview, and you got the 
question wrong. It is what is the least number of 
weighings - the answer is 2 not 3.
1) Take 2 random groups of 3 balls, compare them. If they 
are the same you got lucky - the heavier ball is the one 
you didn't weigh. If they are different you need step 2
2) Take the 3 heavier balls from weighing 1) and randomly 
compare 2 of them. If one is heavier, that is the hevier 
ball - if tehy are the same, then the one you didn't weigh 
is the heavy one.
 
Is This Answer Correct ?    1 Yes 0 No
Simon Y
 

 
 
 
Other OOPS Interview Questions
 
  Question Asked @ Answers
 
What will happen when the following code is run: int x; while(x<100) { cout<<x; x++; } 1) The computer will output "0123...99" 2) The computer will output "0123...100" 3) The output is undefined  3
What do you mean by public, private, protected and friendly?  1
When is a memory allocated to a class?  3
why c++ is called OOPS? waht is inherutance? what is compiler?  2
what is the use of mutable key word HCL2
if u write a class do u write Assignment operator and copy constructor Siemens1
What is a template?  5
What is public, protected, private? Satyam4
Describe the difference between a Thread and a Process?  6
Name an advantage of linked list over array? IBM6
what is a virtual class? Cap-Gemini1
write a c++ program to find maximum of two numbers using inline functions.  1
WHAT IS THE DIFFERENCE BETWEEN ABSTRUCTION AND ENCAPSULATION? PLEASE EXPLAIN IT.  3
Which is the parameter that is added to every non-static member function when it is called?  3
Why do we use virtual functions?  3
What is late bound function call and early bound function call? Differentiate.  2
What is OOPS and How it is different from Procedural Programming ? HP10
In which Scenario you will go for Interface or Abstract Class?  1
how to swap to variables without using thrid variable in java?  3
What is command routing in MFC GE1
 
For more OOPS Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com