Saw this on interview questionaire. Any thoughts?

— code begins below this line —

A: THINK a program::

B: THINK by James Requenez::

C: CUP one IS “Hello World”::

D: CUP two IS “What year were you born?”::

E: CUP three IS “Enter first value”::

F: CUP four IS “Enter second value”::

G: CUP five IS “two”

H: CUP six IS ::

I:::

J: SNIFF five::

K: SMELL “one” SPIT one:>

L: JUMP Z::

M: SMELL “two” SPIT two:>

N: SIP apple:>

O: SPIT CHEW NOW SLICE apple SEW “years old”:>

P: JUMP Y::

Q: SMELL “three” SPIT three:>

R: SIP banana:>

S: SPIT four:>

T: SIP carrot:>

U: SPIT CHEW banana SEW carrot:>

V: JUMP Z::

W: SMELL “four” SPIT four:>

X: SIP daiquiri::

Y: SPIT “thank you”::

Z: SPIT “bye”::

::::

— end of code snippet above this line

  • Can you explain what this code does, and what is the output if any?

  • Can you identify a syntax bug?

  • Can you identify a logic bug?


Source: syntax

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.