Python test Welcome to your Python test What is a correct syntax to output "Hello World" in Python? echo("Hello World"); print("Hello World") p("Hello World") echo "Hello World" How do you create a variable with the floating number 2.8? x = float(2.8) x = 2.8 Both the other answers are correct What is the correct file extension for Python files? .py .pyt pt pyth How do you create a variable with the numeric value 5? x = 5 x = int(5) Both the other answers are incorrect Both the other answers are correct Which one is NOT a legal variable name? my-var my_var _myvar Myvar How do you insert COMMENTS in Python code? #This is a comment /*This is a comment*/ //This is a comment What is a correct syntax to return the first character in a string? x = "Hello"[0] x = "Hello".sub(0, 1) x = sub("Hello", 0, 1) In Python, 'Hello', is the same as "Hello" True False What is the correct way to create a function in Python? def myFunction(): create myFunction(): function myfunction(): Which method can be used to remove any whitespace from both the beginning and the end of a string? strip() ptrim() trim() len() Which method can be used to return a string in upper case letters? upper() uppercase() toUpperCase() upperCase() Which method can be used to replace parts of a string? repl() replace() replaceString( switch( Which operator is used to multiply numbers? * x # % Which operator can be used to compare two values? == = >< Which of these collections defines a LIST? ["apple", "banana", "cherry"] {"apple", "banana", "cherry"} {"name": "apple", "color": "green"} ("apple", "banana", "cherry") Which of these collections defines a TUPLE? ("apple", "banana", "cherry") {"name": "apple", "color": "green"} ["apple", "banana", "cherry"] {"apple", "banana", "cherry"} Which of these collections defines a SET? {"name": "apple", "color": "green"} {"apple", "banana", "cherry"} ("apple", "banana", "cherry") ["apple", "banana", "cherry"] Which of these collections defines a DICTIONARY? {"name": "apple", "color": "green"} ("apple", "banana", "cherry") ["apple", "banana", "cherry"] {"apple", "banana", "cherry"} Which collection is ordered, changeable, and allows duplicate members? SET LIST DICTIONARY TUPLE What will be the value of the following Python expression? 4 + 3 % 5 0 7 2 4 1 Which of the following is used to define a block of code in Python language? Indentation Key Brackets Which of the following character is used to give single-line comments in Python? // # ! /* What will be the output of the following Python code? i = 1 while True: if i%3 == 0: break print(i) Â i + = 1 1 2 3 error 1 2 none of the mentioned Time is Up! Time's up