Non-DB2 Quiz

jwkwan2000

Non-DB2 Quiz
My brother told me he had an interview with Microsoft and he was asked the
following question

How do you write a program to express A*B without using * and +?


Regards,

James Kwan
IBM Certified Solutions Expert
- DB2 V7.1 Database Administration for OS/390



Dave Shortley

Re: Non-DB2 Quiz
(in response to Bill Johnson)
A/(1/B)?
============
Dave Shortley
[login to unmask email]
TSYS
Technical Support
Data Base Support
706-644-2923




jwkwan2000
<[login to unmask email] To: [login to unmask email]
ON.RR.COM> cc:
Sent by: DB2 Data Subject: Non-DB2 Quiz
Base Discussion
List
<[login to unmask email]
LASSOC.COM>

01/09/2003 04:27
PM

Please respond to
DB2 Data Base
Discussion List





My brother told me he had an interview with Microsoft and he was asked the
following question

How do you write a program to express A*B without using * and +?


Regards,

James Kwan
IBM Certified Solutions Expert
- DB2 V7.1 Database Administration for OS/390



the DB2-L webpage at http://listserv.ylassoc.com. The owners of the list
can



Bill Johnson

Re: Non-DB2 Quiz
(in response to Andy Lankester)
How about A / (1 / B)

Bill Johnson
Parker Hannifin
Cleveland, Ohio



jwkwan2000
<[login to unmask email] To: [login to unmask email]
N.RR.COM> cc:
Sent by: DB2 Data Subject: Non-DB2 Quiz
Base Discussion
List
<[login to unmask email]
ASSOC.COM>


01/09/2003 04:27
PM
Please respond to
DB2 Data Base
Discussion List






My brother told me he had an interview with Microsoft and he was asked the
following question

How do you write a program to express A*B without using * and +?


Regards,

James Kwan
IBM Certified Solutions Expert
- DB2 V7.1 Database Administration for OS/390



the DB2-L webpage at http://listserv.ylassoc.com. The owners of the list
can



Andy Lankester

Re: Non-DB2 Quiz
(in response to jwkwan2000)
A/B^(-1)?

> -----Original Message-----
> From: DB2 Data Base Discussion List
> [mailto:[login to unmask email] On Behalf Of jwkwan2000
> Sent: 09 January 2003 21:27
> To: [login to unmask email]
> Subject: Non-DB2 Quiz
>
>
> My brother told me he had an interview with Microsoft and he
> was asked the following question
>
> How do you write a program to express A*B without using * and +?
>
>
> Regards,
>
> James Kwan
> IBM Certified Solutions Expert
> - DB2 V7.1 Database Administration for OS/390
>
>
> To change your subscription options or to cancel your
> subscription visit the DB2-L webpage at
> http://listserv.ylassoc.com. The owners of the > list can be
>
>



Andy Lankester

Re: Non-DB2 Quiz
(in response to Cathy Taddei)
Or A/(1/B)

> -----Original Message-----
> From: DB2 Data Base Discussion List
> [mailto:[login to unmask email] On Behalf Of jwkwan2000
> Sent: 09 January 2003 21:27
> To: [login to unmask email]
> Subject: Non-DB2 Quiz
>
>
> My brother told me he had an interview with Microsoft and he
> was asked the following question
>
> How do you write a program to express A*B without using * and +?
>
>
> Regards,
>
> James Kwan
> IBM Certified Solutions Expert
> - DB2 V7.1 Database Administration for OS/390
>
>
> To change your subscription options or to cancel your
> subscription visit the DB2-L webpage at
> http://listserv.ylassoc.com. The owners of the > list can be
>
>



Cathy Taddei

Re: Non-DB2 Quiz
(in response to Dave Shortley)
Do you get a choice of programming languages? This works in REXX, assuming
A and B are already initialized:

X = 0
Do While A > 0
A = A - 1
Y = B
Do While Y > 0
Y = Y - 1
X = X - 1
End
End
Answer = ABS(X)
Say Answer

Regards,
Cathy Taddei

-----Original Message-----
From: jwkwan2000 [mailto:[login to unmask email]
Sent: Thursday, January 09, 2003 1:27 PM
To: [login to unmask email]
Subject: Non-DB2 Quiz


My brother told me he had an interview with Microsoft and he was asked the
following question

How do you write a program to express A*B without using * and +?


Regards,

James Kwan
IBM Certified Solutions Expert
- DB2 V7.1 Database Administration for OS/390






------------------------------------------------------------------------------

This email is confidential and may be legally privileged.

It is intended solely for the addressee. Access to this email by anyone else, unless expressly approved by the sender or an authorized addressee, is unauthorized.

If you are not the intended recipient, any disclosure, copying, distribution or any action omitted or taken in reliance on it, is prohibited and may be unlawful. If you believe that you have received this email in error, please contact the sender, delete this e-mail and destroy all copies.


=====

Abhijit Sinha

Re: Non-DB2 Quiz
(in response to Andy Lankester)
A /(1/B)

Abhijit

-----Original Message-----
From: jwkwan2000 [mailto:[login to unmask email]
Sent: Thursday, January 09, 2003 4:27 PM
To: [login to unmask email]
Subject: Non-DB2 Quiz


My brother told me he had an interview with Microsoft and he was asked the
following question

How do you write a program to express A*B without using * and +?


Regards,

James Kwan
IBM Certified Solutions Expert
- DB2 V7.1 Database Administration for OS/390








Cathy Taddei

Re: Non-DB2 Quiz
(in response to Abhijit Sinha)
Doh! Maybe I should have spent more than 10 seconds thinking about my
solution before implementing it. I wonder if Microsoft would have hired me?

On Thu, 9 Jan 2003 21:49:33 -0000, Andy Lankester
<[login to unmask email]> wrote:

>Or A/(1/B)
>
>> -----Original Message-----
>> From: DB2 Data Base Discussion List
>> [mailto:[login to unmask email] On Behalf Of jwkwan2000
>> Sent: 09 January 2003 21:27
>> To: [login to unmask email]
>> Subject: Non-DB2 Quiz
>>
>>
>> My brother told me he had an interview with Microsoft and he
>> was asked the following question
>>
>> How do you write a program to express A*B without using * and +?
>>
>>
>> Regards,
>>
>> James Kwan
>> IBM Certified Solutions Expert
>> - DB2 V7.1 Database Administration for OS/390
>>
>>
>> To change your subscription options or to cancel your
>> subscription visit the DB2-L webpage at
>> http://listserv.ylassoc.com. The owners of the > list can be
>>
>>
>
>
>
the DB2-L webpage at http://listserv.ylassoc.com. The owners of the list
can



Scott Gjerdingen

Re: Non-DB2 Quiz
(in response to John H. Maenpaa Jr.)
hmm, trick question? ...challenge is to write A*B without * AND + ?

how about just A*B :-)

-----Original Message-----
From: jwkwan2000 [mailto:[login to unmask email]
Sent: Thursday, January 09, 2003 3:27 PM
To: [login to unmask email]
Subject: Non-DB2 Quiz


My brother told me he had an interview with Microsoft and he was asked the
following question

How do you write a program to express A*B without using * and +?


Regards,

James Kwan
IBM Certified Solutions Expert
- DB2 V7.1 Database Administration for OS/390








John H. Maenpaa Jr.

Re: Non-DB2 Quiz
(in response to Cathy Taddei)
Actually, your solution is what first popped into my head, too. I think it's
because the question asked for a program rather than an equation.

Either way, we have some programmatic issues with all of the results so far.
Yours didn't handle non-positive input variables and the equations won't work
well if B=0.

On Thursday 09 January 2003 04:03 pm, Cathy Taddei wrote:
> Doh! Maybe I should have spent more than 10 seconds thinking about my
> solution before implementing it. I wonder if Microsoft would have hired
> me?
>
> On Thu, 9 Jan 2003 21:49:33 -0000, Andy Lankester
>
> <[login to unmask email]> wrote:
> >Or A/(1/B)
> >
> >> -----Original Message-----
> >>
> >> My brother told me he had an interview with Microsoft and he
> >> was asked the following question
> >>
> >> How do you write a program to express A*B without using * and +?
> >>
> >>
> >> Regards,
> >>
> >> James Kwan
> >> IBM Certified Solutions Expert
> >> - DB2 V7.1 Database Administration for OS/390
--
John Maenpaa
Yevich, Lawson and Associates
www.ylassoc.com



Mark Doyle

Re: Non-DB2 Quiz
(in response to Scott Gjerdingen)
Four answers ( but none tested):

1)
x = A*B; print x

2)
x = 0
loop 1 to A
x = x + B
endloop
print x

Each of the above solves the problem without using " * AND + " (how's that
for a logician?)

3)

x = A / ( 1 / B )
print x

4) -- My favorite, but I thought you said it wasn't a DB2 problem. (assumes
A & B < 4046 and DB2V6 for O/S 390 or above)

Create table X
( A varchar (4046),
B varchar varchar(4046)
ANSWER clob(2G) )

Insert into X (A,B) Values(space(:A), Space(:B))

Update X set ANSWER = B;
Commit;
Loop 1 to A
Update X set ANSWER = ANSWER CONCAT B;
endloop
select LENGTH(ANSWER) into :y;
print y



----- Original Message -----
From: "jwkwan2000" <[login to unmask email]>
Newsgroups: bit.listserv.db2-l
To: <[login to unmask email]>
Sent: Thursday, January 09, 2003 3:27 PM
Subject: Non-DB2 Quiz


> My brother told me he had an interview with Microsoft and he was asked the
> following question
>
> How do you write a program to express A*B without using * and +?
>
>
> Regards,
>
> James Kwan
> IBM Certified Solutions Expert
> - DB2 V7.1 Database Administration for OS/390
>
>
>


>

Matt Kunz

Re: Non-DB2 Quiz
(in response to Mark Doyle)
Simple solution:

Evaluate True
When B = 0
When A = 0
X=0
When Other
X = A / ( 1 / B )
End Evaluate



(Embedded image moved to file: pic28475.pcx)



Todd Burch

Re: Non-DB2 Quiz
(in response to Matt Kunz)
Now see, I would have taken a completely different approach. I would have
asked for clarification...

Q1: Is the assignment a "reporting assignment" in which I merely have to
display the character string "A*B" or was a mathematical solution needed for
the function "A*B".
Q2: What encoding mechanism? EDCDIC or ASCII, or perhaps UNICODE?
Q3: What's "+" got to do with it?
Q4: What are the input ranges for A & B?
Q5: How will parms be passed?
Q6: Will the output be going to the screen or to print?
Q7: Should a help system be available?
Q8: Is documentation required?
Q9: What programming language? (You know, it makes a difference...)
Q10: What operating system? (there may be instructions that could save
time...)
Q11: Have the requirements been signed off?
Q12: How soon do they need it?

I'd have had fun with this interviewer...

Todd.


----- Original Message -----
From: "jwkwan2000" <[login to unmask email]>
Newsgroups: bit.listserv.db2-l
To: <[login to unmask email]>
Sent: Thursday, January 09, 2003 3:27 PM
Subject: Non-DB2 Quiz


> My brother told me he had an interview with Microsoft and he was asked the
> following question
>
> How do you write a program to express A*B without using * and +?
>
>
> Regards,
>
> James Kwan
> IBM Certified Solutions Expert
> - DB2 V7.1 Database Administration for OS/390
>
>
>


>



John Maxfield

Re: Non-DB2 Quiz
(in response to Todd Burch)
L 3,A
M 2,B

-----Original Message-----
From: jwkwan2000 [mailto:[login to unmask email]
Sent: Thursday, January 09, 2003 3:27 PM
To: [login to unmask email]
Subject: Non-DB2 Quiz


My brother told me he had an interview with Microsoft and he was asked the
following question

How do you write a program to express A*B without using * and +?


Regards,

James Kwan
IBM Certified Solutions Expert
- DB2 V7.1 Database Administration for OS/390








Cathy Taddei

Re: Non-DB2 Quiz
(in response to Todd Burch)
This would fix my problem with negative numbers:

Neg=0
If ((A<0)&(B>0))|((A>0)&(B<0)) Then Neg = 1
A = ABS(A)
B = ABS(B)
.... <insert previous program>
Answer = X
If Neg = 0 Then Answer = ABS(Answer)

Of course, my solution only works for integers! I wonder if someone came up
with a really elaborate program, would they have run it to see if it
worked?

Still wondering if I qualify to work for Microsoft...

Cathy

On Thu, 9 Jan 2003 16:28:11 -0600, John Maenpaa <[login to unmask email]>
wrote:

>Actually, your solution is what first popped into my head, too. I think
it's
>because the question asked for a program rather than an equation.
>
>Either way, we have some programmatic issues with all of the results so
far.
>Yours didn't handle non-positive input variables and the equations won't
work
>well if B=0.
>
>On Thursday 09 January 2003 04:03 pm, Cathy Taddei wrote:
>> Doh! Maybe I should have spent more than 10 seconds thinking about my
>> solution before implementing it. I wonder if Microsoft would have hired
>> me?
>>
>> On Thu, 9 Jan 2003 21:49:33 -0000, Andy Lankester
>>
>> <[login to unmask email]> wrote:
>> >Or A/(1/B)
>> >
>> >> -----Original Message-----
>> >>
>> >> My brother told me he had an interview with Microsoft and he
>> >> was asked the following question
>> >>
>> >> How do you write a program to express A*B without using * and +?
>> >>
>> >>
>> >> Regards,
>> >>
>> >> James Kwan
>> >> IBM Certified Solutions Expert
>> >> - DB2 V7.1 Database Administration for OS/390
>--
>John Maenpaa
>Yevich, Lawson and Associates
>www.ylassoc.com
>



Todd Burch

Re: Non-DB2 Quiz
(in response to John Maxfield)
Hi John. Actually, you might would get an S0C4 in your program loading
from location X'000A' :-)

Todd.


----- Original Message -----
From: "Maxfield, John" <[login to unmask email]>
Newsgroups: bit.listserv.db2-l
To: <[login to unmask email]>
Sent: Thursday, January 09, 2003 5:43 PM
Subject: Re: Non-DB2 Quiz


> L 3,A
> M 2,B
>
> -----Original Message-----
> From: jwkwan2000 [mailto:[login to unmask email]
> Sent: Thursday, January 09, 2003 3:27 PM
> To: [login to unmask email]
> Subject: Non-DB2 Quiz
>
>
> My brother told me he had an interview with Microsoft and he was asked the
> following question
>
> How do you write a program to express A*B without using * and +?
>
>
> Regards,
>
> James Kwan
> IBM Certified Solutions Expert
> - DB2 V7.1 Database Administration for OS/390
>
>
>
the
> DB2-L webpage at http://listserv.ylassoc.com. The owners of the list can
be
>
>
>
>


>



teldb2kals

Re: Non-DB2 Quiz
(in response to Cathy Taddei)
Maybe it IS a trick question. The question was "how do you write". How
about "with a pen in my hand" ?


On Thu, 9 Jan 2003 15:27:12 -0600, jwkwan2000 <[login to unmask email]>
wrote:

>My brother told me he had an interview with Microsoft and he was asked the
>following question
>
>How do you write a program to express A*B without using * and +?
>
>
>Regards,
>
>James Kwan
>IBM Certified Solutions Expert
>- DB2 V7.1 Database Administration for OS/390
>



Bernd Oppolzer

Re: Non-DB2 Quiz
(in response to teldb2kals)
perfect answer (LOL), but I guess, the MS people won't like it.

Regards,
Bernd


Am Fre, 10 Jan 2003 schrieben Sie:
> L 3,A
> M 2,B
>
> -----Original Message-----
> From: jwkwan2000 [mailto:[login to unmask email]
> Sent: Thursday, January 09, 2003 3:27 PM
> To: [login to unmask email]
> Subject: Non-DB2 Quiz
>
>
> My brother told me he had an interview with Microsoft and he was asked the
> following question
>
> How do you write a program to express A*B without using * and +?
>
>
> Regards,
>
> James Kwan
> IBM Certified Solutions Expert
> - DB2 V7.1 Database Administration for OS/390
>



Tina Hilton

Re: Non-DB2 Quiz
(in response to Bernd Oppolzer)
Or "with a keyboard".

-----Original Message-----
From: Teldb2kals [mailto:[login to unmask email]
Sent: January 09, 2003 7:37 PM
To: [login to unmask email]
Subject: Re: Non-DB2 Quiz


Maybe it IS a trick question. The question was "how do you write". How
about "with a pen in my hand" ?


On Thu, 9 Jan 2003 15:27:12 -0600, jwkwan2000 <[login to unmask email]>
wrote:

>My brother told me he had an interview with Microsoft and he was asked the
>following question
>
>How do you write a program to express A*B without using * and +?
>
>
>Regards,
>
>James Kwan
>IBM Certified Solutions Expert
>- DB2 V7.1 Database Administration for OS/390
>








Randy Bright

Re: Non-DB2 Quiz
(in response to Tina Hilton)
You are one clever dude, John. A little geeky, but clever.

Randy Bright



-----Original Message-----
From: Maxfield, John [mailto:[login to unmask email]
Sent: Thursday, January 09, 2003 5:44 PM
To: [login to unmask email]
Subject: Re: Non-DB2 Quiz


L 3,A
M 2,B

-----Original Message-----
From: jwkwan2000 [mailto:[login to unmask email]
Sent: Thursday, January 09, 2003 3:27 PM
To: [login to unmask email]
Subject: Non-DB2 Quiz


My brother told me he had an interview with Microsoft and he was asked the
following question

How do you write a program to express A*B without using * and +?


Regards,

James Kwan
IBM Certified Solutions Expert
- DB2 V7.1 Database Administration for OS/390













John McKown

Re: Non-DB2 Quiz
(in response to Randy Bright)
Which may not yield the identical result on any existant hardware.
Especially if A and B are integers and the division is integer division. Or
if B is zero, then A*B is 0, but A/(1/B) yields a divide-by-zero error.
Therefore one cannot say that A*B is A/(1/B) for every numeric A & B (fails
if B=0).

--
John McKown
Senior Technical Specialist
UICI Insurance Center
Applications & Solutions Team
+1.817.255.3225


> -----Original Message-----
> From: Bill Johnson [mailto:[login to unmask email]
> Sent: Thursday, January 09, 2003 3:44 PM
> To: [login to unmask email]
> Subject: Re: Non-DB2 Quiz
>
>
> How about A / (1 / B)
>
> Bill Johnson



Lockwood Lyon

Re: Non-DB2 Quiz
(in response to John McKown)
>
> (A / ( 1 / B) )
>

Hmmm. What if B = 0 ?

- Lockwood Lyon
Meijer Stores

-----Original Message-----
From: jwkwan2000 [mailto:[login to unmask email]
Sent: Thursday, January 09, 2003 3:27 PM
To: [login to unmask email]
Subject: Non-DB2 Quiz


My brother told me he had an interview with Microsoft and he was asked the
following question

How do you write a program to express A*B without using * and +?


Regards,

James Kwan
IBM Certified Solutions Expert
- DB2 V7.1 Database Administration for OS/390


the




the





Andy Lankester

Re: Non-DB2 Quiz
(in response to Lockwood Lyon)
Mmm... maybe it wasn't such a bad question after all!!

Andy

> -----Original Message-----
> From: DB2 Data Base Discussion List
> [mailto:[login to unmask email] On Behalf Of Todd Burch
> Sent: 10 January 2003 00:06
> To: [login to unmask email]
> Subject: Re: Non-DB2 Quiz
>
>
> Hi John. Actually, you might would get an S0C4 in your
> program loading
> from location X'000A' :-)
>
> Todd.
>
>
> ----- Original Message -----
> From: "Maxfield, John" <[login to unmask email]>
> Newsgroups: bit.listserv.db2-l
> To: <[login to unmask email]>
> Sent: Thursday, January 09, 2003 5:43 PM
> Subject: Re: Non-DB2 Quiz
>
>
> > L 3,A
> > M 2,B
> >
> > -----Original Message-----
> > From: jwkwan2000 [mailto:[login to unmask email]
> > Sent: Thursday, January 09, 2003 3:27 PM
> > To: [login to unmask email]
> > Subject: Non-DB2 Quiz
> >
> >
> > My brother told me he had an interview with Microsoft and
> he was asked
> > the following question
> >
> > How do you write a program to express A*B without using * and +?
> >
> >
> > Regards,
> >
> > James Kwan
> > IBM Certified Solutions Expert
> > - DB2 V7.1 Database Administration for OS/390
> >
> >
> >
> > visit
> the
> > DB2-L webpage at http://listserv.ylassoc.com. The owners of
> the list
> > can
> be
> >
> >
> >
> >
> > visit
> the DB2-L webpage at http://listserv.ylassoc.com. The owners
> of the list can
> >
>
>
> To change your subscription options or to cancel your
> subscription visit the DB2-L webpage at
> http://listserv.ylassoc.com. The owners of the > list can be
>
>



John Maxfield

Re: Non-DB2 Quiz
(in response to Andy Lankester)
"A" is a label as implied. If it weren't you'd get an assembly error.

-----Original Message-----
From: Todd Burch [mailto:[login to unmask email]
Sent: Thursday, January 09, 2003 6:06 PM
To: [login to unmask email]
Subject: Re: Non-DB2 Quiz


Hi John. Actually, you might would get an S0C4 in your program loading
from location X'000A' :-)

Todd.


----- Original Message -----
From: "Maxfield, John" <[login to unmask email]>
Newsgroups: bit.listserv.db2-l
To: <[login to unmask email]>
Sent: Thursday, January 09, 2003 5:43 PM
Subject: Re: Non-DB2 Quiz


> L 3,A
> M 2,B
>
> -----Original Message-----
> From: jwkwan2000 [mailto:[login to unmask email]
> Sent: Thursday, January 09, 2003 3:27 PM
> To: [login to unmask email]
> Subject: Non-DB2 Quiz
>
>
> My brother told me he had an interview with Microsoft and he was asked the
> following question
>
> How do you write a program to express A*B without using * and +?
>
>
> Regards,
>
> James Kwan
> IBM Certified Solutions Expert
> - DB2 V7.1 Database Administration for OS/390
>
>
>
the
> DB2-L webpage at http://listserv.ylassoc.com. The owners of the list can
be
>
>
>
>


>