1) What is a correct way to declare a Python variable? a) var x = 5 b) #x = 5 c) $x = 5 d) x = 5 2) You can declare string variables with single or double quotes. a) True b) False 3) Variable names are not case-sensitive. a) True b) False 4) Which is NOT a legal variable name? a) my-var = 20 b) my_var = 20 c) Myvar = 20 d) _myvar = 20 5) How can we create a variable named carname and assign the value Volvo to it? a) carname = #Volvo b) carname = "Volvo" 6) How can we create a variable named x and assign the value 50 to it. a) _x = 50 b) x = 50 c) 'x' = 50 7) What is a correct syntax to add the value 'Hello World', to 3 values in one statement? a) x, y, z = 'Hello World' b) x = y = z = 'Hello World' c) x|y|z| = "Hello World" 8) Chose the correct syntax for assign values to multiple variables in one line: a) x, y, z = "Orange", "Apple", "Cherry" b) x + y + z = "Orange", "Apple", "Cherry" 9) What will be the result of a? a) apple b) banana c) cherry 10) Considering the following code, what will be the printed result? a) Hello, World b) Hello World c) HelloWorld 11) Considering the following code, what will be the printed result? a) a + b b) Hello World c) Helloworld 12) Considering the following code, what will be the printed result? a) 45 b) 9 c) 4+5 13) Considering the following code, what will be the printed result? a) Python is awesome b) Pyton is fantastic 14) What keyword we must to insert to make the variable x belong to the global scope. a) int b) global c) string 15) Considering the following code, what will be the printed result? a) Python is awesome b) Python is fantastic

Tabela rankingowa

Motyw

Opcje

Zmień szablon

Przywrócić automatycznie zapisane ćwiczenie: ?