1) Which function is used to display text on the screen? a) read() b) print() c) show() d) output() 2) Which of these is used to take input from the user? a) get() b) input() c) read() d) scan() 3) What is the correct way to assign a value to a variable? a) 5 = x b) x == 5 c) x = 5 d) x + 5 4) Which of these is a string? a) 12 b) 4.5 c) ”Hello” d) True 5) What will this code print? print(3 + 4) a) 34 b) 7 c) 3+4 d) Error 6) What symbol is used for comments in Python? a) //(slash) b) #(Hastag) c) %(percentage) d) ”(double cots) 7) Which operator is used for multiplication? a) / b) + c) * d) — 8) What will this code output? name = Ria print(“Hi” + Ria) a) Hi b) Ria c) Hi Ria d) Hi + Ria 9) Which of these is a list? a) {1,2,3} b) [1,2,3] c) (1,2,3) d) ”1,2,3” 10) What does an if statement do? a) Repeats codes b) Chooses based on a condition c) Prints output d) Joins string 11) Which code correctly defines a function? a) define hello(): b) def hello(): c) func hello: d) function hello(): 12) What will this loop do? for i in range(3): print("Hi") a) Print Hi once b) Print Hi forever c) Print Hi 3 times d) Error 13) What type of data is True? a) int b) str c) bool d) float 14) Which dictionary is written correctly? a) [“name”: “Asha”] b) {“name”: “Asha”} c) (“name”: “Asha”) d) “name”: “Asha” 15) Why is indentation important in Python? a) It makes code colorful b) It decorates the text c) It shows which code belongs to a block d) It adds comments

Tabela rankingowa

Motyw

Opcje

Zmień szablon

Przywrócić automatycznie zapisane ćwiczenie: ?