Python - take the quiz

What is the output of the following code? print(2 + 3 * 4)
14
20
23
24
Which of the following is NOT a valid variable name in Python?
My_var
123var
_var
Var
MyVar
What will be the output of the following code? x = [1, 2, 3] y = x x.append(4) print(y)
[1, 2, 3]
[1, 2, 3, 4]
[4, 3, 2, 1]
[4, 3, 2]
What is the correct way to open a file named 'data.txt' in Python?
File = open('data.txt')
File = open('data.txt', 'r')
File = open('data.txt', 'w')
File = open('data.txt', 'a')
What is the output of the following code? print(len('python'))
6
5
7
1
Which of the following statements is true about Python?
Python is a compiled language.
Python is an object-oriented programming language.
Python is primarily used for web development.
Python does not support recursion.
Python is a statically-typed language.
What is the result of the following expression? 3 + 2 * 4 / 2 - 1
8
6
7
5
What is the correct way to check if a key exists in a dictionary?
'key' in my_dict
My_dict.contains('key')
My_dict.has_key('key')
My_dict.exists('key')
What will be the output of the following code? x = [1, 2, 3] y = x del x[0] print(y)
[1, 2, 3]
[2, 3]
[3, 2, 1]
[3, 2]
What is the correct way to convert a string to an integer in Python?
Int('42')
'42'.to_int()
Str_to_int('42')
Convert('42', int)
{"name":"Python - take the quiz", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"What is the output of the following code? print(2 + 3 * 4), Which of the following is NOT a valid variable name in Python?, What will be the output of the following code? x = [1, 2, 3] y = x x.append(4) print(y)","img":"https://www.quiz-maker.com/3012/images/ogquiz.png"}
Powered by: Quiz Maker