Week 1- Python Basic Test

What is the output of the following code? print(2 + 3 * 4 - 6)
8
14
16
18
Which of the following is NOT a valid variable name in Python?
My_variable
123variable
_variable
Variable123
Variable_name
What will be the output of the following code snippet?
x = [1, 2, 3]
y = x
y.append(4)
print(x)
[1, 2, 3]
[1, 2, 3, 4]
[1, 2, 4]
[1, 2, 3, [4]]
What is the correct way to comment a single line in Python?
// This is a comment
# This is a comment
/* This is a comment */
Which of the following is NOT a valid data type in Python?
Int
Float
Boolean
String
List
Tuple
What will be the output of the following code? x = 'Hello' print(x[1:3])
'el'
'He'
'ell'
'H'
Which of the following is used to get user input in Python?
Input()
Get_input()
User_input()
Read_input()
What is the result of the following expression? 5 % 2
2
1
0.5
0
What will be the output of the following code?
x = [1, 2, 3]
y = x
y[0] = 4
print(x)
[1, 2, 3]
[4, 2, 3]
[1, 4, 3]
[4, 2, 3, [4]]
Which of the following is used to repeat a block of code multiple times in Python?
For loop
While loop
If statement
Function
Class
What is the result after the following program executes if the user inputs 2 and 5, respectively?
a = input ()
b = input ()
print (a+b)
It shows (2+5) as a string.
It shows 2+5 as a string.
It shows 7 as a number.
It shows 25 as a string.
Error
What is the result after the following program is executed?

num3 = 3
num4 = 2
num3 **= num4
print (num3 , num4)
It gives an error on line 3.
9 2
3 8
3 2
What is the result when the following program is executed?
for c in range(3):
   print(c, end=' ')
0 1 2
1 2 3
3 2 1
3
What is the result when the following program is executed?
a = ['a','b','c','d','e','f','g','h','i']
print(a[2:-2])
['b', 'c', 'd', 'e', 'f', 'g', 'h']
['b', 'c', 'd', 'e', 'f', 'g']
['c', 'd', 'e', 'f', 'g']
['c', 'd', 'e', 'f', 'g', 'h']
What is the result when the following program is executed?
 
for s in sorted('aAbB'):
   print(s, end=' ')
A A b B
A a B b
A b A B
A B a b
{"name":"Week 1- Python Basic Test", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"What is the output of the following code? print(2 + 3 * 4 - 6), Which of the following is NOT a valid variable name in Python?, What will be the output of the following code snippet? x = [1, 2, 3] y = x y.append(4) print(x)","img":"https://www.quiz-maker.com/3012/images/ogquiz.png"}
Make your own Survey
- it's free to start.