1) What is a correct syntax to output 'Hello World' in Python? a) print('Hello World') b) echo 'Hello World' c) printf('Hello World') d) cout << 'Hello World' e) System.out.println('Hello World') f) Console.WriteLine('Hello World') 2) How do you insert COMMENTS in Python code? a) // This is a comment b) # This is a comment c) <!-- This is a comment --> d) /* This is a comment */ e) REM This is a comment f) COMMENT This is a comment 3) Which of the following is a mutable data type in Python? a) Tuple b) List c) String d) Integer e) Float f) Boolean 4) How do you start a function in Python? a) function myFunction() b) def myFunction() c) create myFunction() d) start myFunction() e) begin myFunction() f) init myFunction() 5) Which keyword is used for function in Python? a) func b) define c) def d) function e) declare f) create 6) How do you create a variable with the numeric value 5? a) x = 5 b) int x = 5 c) x := 5 d) x <- 5 e) x == 5 f) x = 5.0 7) Which operator is used to multiply numbers in Python? a) * b) x c) ^ d) % e) & f) @ 8) Which of the following is a valid variable name in Python? a) 1variable b) variable_1 c) variable-1 d) variable 1 e) variable.one f) variable#1 9) What is the output of print(2 ** 3)? a) 6 b) 8 c) 9 d) 5 e) 4 f) 10 10) Which method can be used to remove any whitespace from both ends of a string? a) strip() b) trim() c) cut() d) remove() e) delete() f) erase() 11) Which of the following is used to define a block of code in Python? a) {} b) () c) [] d) Indentation e) <> f) // 12) What is the correct file extension for Python files? a) .py b) .python c) .pt d) .pyt e) .pyth f) .p 13) How do you create a dictionary in Python? a) {key: value} b) [key: value] c) (key: value) d) <key: value> e) key: value f) key = value 14) Which of the following is not a Python data type? a) Set b) Array c) List d) Tuple e) Dictionary f) String 15) Which function is used to get the length of a list in Python? a) length() b) len() c) size() d) count() e) measure() f) getLength() 16) What is the output of print(10 // 3)? a) 3.33 b) 3 c) 3.0 d) 4 e) 2 f) 2.5 17) Which keyword is used to create a class in Python? a) class b) Class c) define d) create e) object f) new 18) How do you create a set in Python? a) set() b) {} c) [] d) () e) <> f) set{} 19) What is the correct syntax to import a module named 'math'? a) import math b) include math c) require math d) use math e) load math f) attach math 20) Which of the following is used to handle exceptions in Python? a) try/except b) catch/throw c) handle/error d) try/catch e) begin/rescue f) error/handle

аутор

Табела

Визуелни стил

Поставке

АИ Енханцед: Ова активност садржи садржај који генерише АИ. Учи више.

Промени шаблон

Врати аутоматски сачувано: ?