Apa output dari kode berikut?

TA MODUL 2 (VERSI 2)

Quiz
•
Other
•
University
•
Medium
Ibes Ibes
Used 5+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
0 1 2 3 4
0 1 3 4
1 2 3 4
0 1 2 4
Answer explanation
Statement 'continue' melewati iterasi saat i = 2 dan melanjutkan ke iterasi berikutnya.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Dalam Python, bagaimana cara menghentikan perulangan while secara paksa?
exit
break
stop
return
Answer explanation
Statement 'break' digunakan untuk menghentikan perulangan secara paksa.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Lengkapi kode berikut agar menghasilkan fungsi yang valid:
return
yield
pass
Answer explanation
'return' digunakan untuk mengembalikan nilai dari suatu fungsi.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Bagaimana cara yang benar untuk membuat perulangan yang mengiterasi string "Hello"?
for i in range("Hello"):
for i in "Hello":
while i in "Hello":
loop through "Hello":
Answer explanation
String adalah iterable, sehingga bisa langsung diiterasi dengan for loop.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Dalam perulangan for, fungsi range(5) akan menghasilkan:
1, 2, 3, 4, 5
0, 1, 2, 3, 4
0, 1, 2, 3, 4, 5
1, 2, 3, 4
Answer explanation
range(5) menghasilkan sequence dari 0 sampai 4 (5 tidak termasuk).
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Apakah output dari kode berikut?
3
13
23
Error
Answer explanation
a=1, b=2, dan c menggunakan nilai default 10, sehingga 1+2+10=13.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Lengkapi kode berikut agar menghasilkan fungsi lambda yang menjumlahkan dua angka:
add = ____ x,y: x + y
func
lambda
def
function
Answer explanation
'lambda' adalah keyword untuk membuat anonymous function.
Create a free account and access millions of resources
Similar Resources on Quizizz
10 questions
Control Panel Hosting

Quiz
•
University - Professi...
10 questions
Training K1AG

Quiz
•
1st Grade - Professio...
10 questions
Akuntansi Lembaga Kelas XI

Quiz
•
12th Grade - University
10 questions
QUIZ W9 - FUNCTION

Quiz
•
University
10 questions
bababa

Quiz
•
University
10 questions
Guess the Movie Title

Quiz
•
University
15 questions
Python Quiz

Quiz
•
University
10 questions
POST TEST MODULE 4

Quiz
•
University
Popular Resources on Quizizz
15 questions
Character Analysis

Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing

Quiz
•
9th - 12th Grade
10 questions
American Flag

Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension

Quiz
•
5th Grade
30 questions
Linear Inequalities

Quiz
•
9th - 12th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25

Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers

Quiz
•
6th - 8th Grade