wu :: forums
« wu :: forums - Abstract Computer »

Welcome, Guest. Please Login or Register.
May 2nd, 2024, 11:21pm

RIDDLES SITE WRITE MATH! Home Home Help Help Search Search Members Members Login Login Register Register
   wu :: forums
   riddles
   microsoft
(Moderators: Icarus, ThudnBlunder, Grimbal, towr, Eigenray, william wu, SMQ)
   Abstract Computer
« Previous topic | Next topic »
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print
   Author  Topic: Abstract Computer  (Read 2822 times)
irrational
Junior Member
**





   


Gender: male
Posts: 52
Abstract Computer  
« on: Sep 14th, 2006, 10:28am »
Quote Quote Modify Modify

Another M$ interview Question:
 
You have an abstract computer.  
 
A variable is defined as a entity that can store a number.
 
 You can use as many variable as you need, there are no negetive numbers, all numbers are integers. You do not know the size of the integers, they could be infinitely large, so you can't count on truncating at any point. There are no comparisons allowed, no if statements or anything like that.
 
 There are only four operations you can do on a variable.
a) You can set a variable to 0.
b) You can set a variable = another variable.
c) You can increment a variable(only by 1), and its a post increment.
d) You can loop. So, if you were to say loop(v1) and v1 = 10, your loop would execute 10 times, but the value in v1 wouldn't change so the first line in the loop can change value of v1 without chaning the no of times you loop. You need to do 2 things.
(i) Write a function that decrements by 1.
(ii) Write a function that subtracts one variable from another.
 
You can use as many variable as you need, there are no negetive numbers, all numbers are integers. You do not know the size of the integers, they could be infinitely large, so you can't count on truncating at any point. There are NO comparisons allowed, no if statements or anything like that.
IP Logged
SMQ
wu::riddles Moderator
Uberpuzzler
*****






   


Gender: male
Posts: 2084
Re: Abstract Computer  
« Reply #1 on: Sep 14th, 2006, 10:55am »
Quote Quote Modify Modify

here
 
--SMQ
IP Logged

--SMQ

irrational
Junior Member
**





   


Gender: male
Posts: 52
Re: Abstract Computer  
« Reply #2 on: Sep 14th, 2006, 11:55am »
Quote Quote Modify Modify

Sorry for the re-post.  Embarassed  Embarassed
IP Logged
SMQ
wu::riddles Moderator
Uberpuzzler
*****






   


Gender: male
Posts: 2084
Re: Abstract Computer  
« Reply #3 on: Sep 14th, 2006, 12:06pm »
Quote Quote Modify Modify

No need to be that embarrassed about it. Wink
 
Happens all the time around here, and we all know that the Search functions are rudimentary at best...
 
--SMQ
IP Logged

--SMQ

Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print

« Previous topic | Next topic »

Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board