R


Basic256 AND OR


15 Programmieraufgaben mit Lösungen


Wird "Ja" ausgegeben oder nicht?

a) IF (100<99) OR (200<300) then print "Ja"
b) IF (100/20<8) OR (200=300) then print "Ja"
c) IF (-2 > -5) AND (-1 > -2) then print "Ja"
d) IF (6/10 = 0.6 ) AND (6/10<0.7) then print "Ja"
e) IF ((1=2) AND (17=18)) OR (20=20) then print "Ja"

f) Lies das Programm:

x=10
y=20
if (y-5>14) AND (x+y=300) then print "1";
if (y/x·5=10) AND (x+x+x+x=4·x) AND (x-y/2=0) then print "2";
if (y+y=4·y) OR (y=14) OR (x=y) then print "3";

Was wird die Ausgabe sein: 1 oder 2 oder 3 oder 12 oder 13 oder 23?

g) Lies das Programm:

# Es wird ein Strich von oben links nach unten rechts gezeichnet:
graphsize 200,100
x=0
y=0
color red
while x<200
circle x,y,5
x=x+1
y=y+0.5
if (x>180) AND (y>30) then color yellow
end while

Wird der Strich kurz vor dem Stillstand unten rechts rot oder gelb sein?

Bei den folgenden Aufgaben h bis o sollst du eine Zahl finden, sodass die if-Bedinung erfüllt wird und auf dem Bildschirm "ja" ausgegeben wird. Wenn es keine solche Zahl gibt, dann schreibe "nicht erfüllbar":

h) if (x>10) AND (x<14) then print "ja"
i) if (x>10) AND (x<7) then print "ja"
j) if (x>10) OR (x<7) then print "ja"
k) if (x=10) AND (x=11) then print "ja"
l) if (x=x) AND (x=4) then print "ja"
m) if (x=x) OR (x=4) then print "ja"
n) if (20x) then print "ja"
o) if (20x) then print "ja"