What is the output? x = 5 y = 3 print(x + y), 8, 15, The print() function is used to display data on the screen., False, True, Which code is correct for storing a name?, name = "Ahmed", name = Ahmed, What is the output? x = 10 y = 2 print(x * y), 12, 20, The value "25" is an Integer in Python., True, False, What is the data type of 100?, Integer, String, What is the data type of "Hello"?, String, Integer, We can change the value of a variable after creating it. age = 17 age = 18, False, True, What is the output? x = 20 y = 5 print(x - y), 25, 15, Which operator is used for multiplication?, *, /, The / operator is used for division., True, False, What is the output? x = 10 y = 5 print(x / y), 15, 2.0, What is the purpose of input()?, To display data on the screen, To receive data from the user, By default, input() returns the user's input as a String., True, False, Which code correctly gets an integer age from the user?, age = print("Enter age: "), age = int(input("Enter age: ")), What is the output? name = "Mona" print(name), Mona, name, This code is correct: name = Ahmed print(name), False, True, What is the output? x = 4 y = 2 print(x + y * 3), 18, 10, What is the output? x = 10 print(x > 5), True, False, The result of 10 > 20 is True., True, False, Which keyword is used to create a condition?, print, if, What is the output? age = 20 if age >= 18: print("Adult"), Adult, Child, The else statement is used when the if condition is False., False, True, What is the output? grade = 40 if grade >= 50: print("Pass") else: print("Fail"), Fail, Pass, What is the output? x = 7 if x == 7: print("Correct") else: print("Wrong"), Correct, Wrong, The == operator is used to compare two values., False, True, Which code correctly prints the numbers from 1 to 5?, for i in range(1, 6): print(i), for i in print(1, 6): range(i), This code prints "Hello" five times. for i in range(5): print("Hello"), False, True, What is the output? x = 10 y = 3 print(x -y), 3, 7, What is the output? score = 80 if score >= 90: print("Excellent") elif score >= 50: print("Pass") else: print("Fail"), Pass, Excellent, What is the output? x = 10 y = 3 print(x % y), 1, 3, What is the output? for i in range(4): print(i), 1, 2, 3, 4, 0, 1, 2, 3, range(2, 6) produces 2, 3, 4, and 5., False, True, What is the output? for i in range(2, 5): print(i + 1), 3, 4, 5, 2, 3, 4, Which keyword stops a loop immediately?, break, stop, The continue statement skips the current loop iteration., False, True, What is the output? for i in range(5): if i == 3: break print(i), 0, 1, 2, 3, 4, 0, 1, 2, What is the output? numbers = [10, 20, 30] print(numbers[1]), 20, 10, The first item in a list has index 1., False, True, What is the output? items = ["pen", "book"] items.append("bag") print(items), ["bag", "pen", "book"], ["pen", "book", "bag"], Which method removes the last item from a list?, pop(), remove_last(), The len() function can be used with lists., False, True, What is the output? numbers = [4, 8, 12] print(len(numbers)), 12, 3, What is the output? colors = ["red", "blue", "green"] colors[1] = "yellow" print(colors), ["red", "yellow", "green"], ["yellow", "blue", "green"], Lists can contain different data types. data = ["Ali", 20, True], False, True, What is the output? count = 0 while count < 3: print(count) count += 1, 0, 1, 2, 1, 2, 3, Which statement increases a variable by 1?, count =+ 1, count += 1, A while loop can become infinite if its condition never becomes False., True, False, What is the output? x = 10 if x > 5: print("A") if x > 8: print("B"), Only A, A and B, What is the output? print(True and False), False, True, The or operator returns True if at least one condition is True., False, True, What is the output? print(not False), True, False, What is the output? def add_numbers(a, b): return a + b print(add_numbers(3, 4)), 7, 12, A function is created using the def keyword., False, True, What is the output? def greet(name): print("Hello", name) greet("Laila"), Hello name, Hello Laila, What does return do inside a function?, Sends a value back from the function, Prints the value automatically, A function can receive more than one parameter., False, True, What is the output? def square(number): return number * number result = square(5) print(result), 25, 10, What is the output? numbers = [1, 2, 3, 4] total = 0 for number in numbers: if number % 2 == 0: total += number print(total), 10, 6, A dictionary stores data using key-value pairs., True, False, What is the output? student = { "name": "Omar", "grade": 90 } if student["grade"] >= 50: print(student["name"], "passed") else: print(student["name"], "failed"), Omar failed, Omar passed
0%
PYTHON QUIZ – 30 QUESTIONS
Del
Del
af
Nardennasr17
Rediger indhold
Gem
Synes om
Trykke
Integrere
Mere
Tildelinger
Rangliste
Vis mere
Vis mindre
Denne rangliste er i øjeblikket privat. Klik på
Del
for at gøre det offentligt.
Denne rangliste er deaktiveret af ressourceejeren.
Denne rangliste er deaktiveret, da dine muligheder er forskellige fra ressourceejerens.
Indstillinger for gendannelse
Åbn boksen
er en åben skabelon. Det genererer ikke resultater for en rangliste.
Log ind påkrævet
Visuel stil
Skrifttyper
Kræver abonnement
Indstillinger
AI-forstærket: Denne aktivitet indeholder indhold genereret af AI.
Lær mere.
Skift skabelon
Vis alle
Åbne resultater
Kopiér link
QR-kode
Slette
Gendan automatisk gemt:
?