Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Operator Logika

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.
Apa hasil dari kode ini? sensor_left = True sensor_right = False print(sensor_left and not sensor_right)
a)
True
b)
False
c)
Error
d)
None
2.
Kode mana yang benar untuk mengecek tombol start dan tombol stop tidak ditekan secara bersamaan? start_pressed = True stop_pressed = False print(____)
a)
start_pressed and stop_pressed
b)
start_pressed or stop_pressed
c)
start_pressed and not stop_pressed
d)
not start_pressed and not stop_pressed
3.
Apa output dari kode ini? distance = 25 print(distance < 20 or distance > 30)
a)
True
b)
False
c)
Error
4.
Output apa yang muncul? robot_ready = True emergency_stop = False print(not robot_ready or emergency_stop)
a)
True
b)
False
c)
Error
5.
Apakah kode ini error? Jika iya, kenapa? print(sensorA and sensorB or)
a)
Ya, operator `or` tidak punya operand di kanan
b)
Tidak error
c)
`and` harus diganti `or`
d)
Tidak ada output
6.
Lengkapi kode berikut supaya outputnya True saat sensorA dan sensorB aktif, dan tombol start tidak ditekan. sensorA = True sensorB = True start = False print(sensorA ____ sensorB ____ not start)
a)
and, and
b)
or, or
c)
and, or
d)
or, and
7.
Apa output kode ini? print((not True) == False)
a)
True
b)
False
c)
Error
8.
Nilai apa yang dicetak? a = False b = True print(a or b and not a)
a)
True
b)
False
c)
Error
9.
Output apa dari kode ini? buttonA = True buttonB = True print(buttonA and buttonB and not False)
a)
True
b)
False
c)
Error
10.
Apa yang salah dari kode ini? print(True or and False)
a)
Syntax error karena `or and` berurutan tanpa operand
b)
Output True
c)
Output False
d)
Tidak error
11.
Output apa dari kode ini? sensor = False print(not sensor and True)
a)
True
b)
False
c)
Error
12.

Jika variabel battery_low = True dan charging = False, nilai apa yang dicetak? print(not battery_low or charging)

a)
True
b)
False
c)
Error
13.
Lengkapi ekspresi supaya outputnya True saat tombol mode ditekan dan tombol start juga ditekan: mode = True start = True print(____)
a)
mode and start
b)
mode or start
c)
not mode and start
d)
not mode or not start
14.
Apa output dari kode berikut? print((5 > 3) and (2 == 2) and not (4 < 1))
a)
True
b)
False
c)
Error
15.
Output kode ini? print((True and False) or (False or True))
a)
True
b)
False
c)
Error
16.
Apa hasil dari kode ini? print(not (True and False))
a)
True
b)
False
c)
Error
17.
Outputnya? print((not False) and (False or True))
a)
True
b)
False
c)
Error
18.
Apa hasil berikut? print(True and not (False or True))
a)
True
b)
False
c)
Error
19.
Manakah yang menghasilkan error? A. print(True and False) B. print(True or False) C. print(True && False) D. print(not True)
a)
A
b)
B
c)
C
d)
D
20.
Output apa yang muncul? buttonX = False buttonY = True print(buttonX or buttonY and not buttonX)
a)
True
b)
False
c)
Error