NEW
Font size
WorksheetsQUIZ-A-THON PYTHON LEVEL 1
Total questions: 20
Worksheet time: 10mins
What will be the output of the following code? print(type(10))
A)
B)
C)
D)
What is the correct way to create a variable x with the value 5 in Python?
A) int x = 5
B) x = int(5)
C) x == 5
D) x = 5
What will be the output of the following code? x = [1, 2, 3] print(x[3])
A) 3
B) 1
C) IndexError
D) None
What will be the output of the following code? print(bool(0))
A) True
B) False
C) 0
D) None
Which of the following is used to create a comment in Python?
A) // This is a comment
B) # This is a comment
C) /* This is a comment */
D)
What is the output of the following code? print("2" + "3")
A) 5
B) 23
C) 6
D) Error
What does the len() function do in Python?
A) Returns the length of a variable name
B) Returns the length of an integer
C) Returns the length of an object
D) Returns the sum of all elements in a list
Which of the following will result in a syntax error?
A) print("Hello")
B) 10 = x
C) x, y = 5, 10
D) print(10 + 5)
What is the output of the following code? x = 10 y = 5 print(x > y and y < x)
A) True
B) False
C) Error
D) None
Which of the following data types is immutable in Python?
A) List
B) Dictionary
C) Tuple
D) Set
What will be the output of the following code? x = [1, 2, 3] y = x y.append(4) print(x)
A) [1, 2, 3]
B) [1, 2, 3, 4]
C) None
D) Error
Which of the following is not a valid keyword in Python?
A) try
B) finally
C) catch
D) with
What will be the output of the following code? print(5 / 2)
A) 2
B) 2.5
C) 3
D) Error
How do you create an empty dictionary in Python?
A) d = []
B) d = ()
C) d = {}
D) d = dict{}
What will be the output of the following code? print("Hello"[1])
A) H
B) e
C) l
D) Error
What will be the output of the following code? print(2 ** 3)
A) 6
B) 8
C) 9
D) Error
Which of the following will result in the same output? x = 10
A) print(x == 10)
B) print(x = 10)
C) print(x = x + 10)
D) print(x != 10)
What is the output of the following code? x = "hello" print(x.upper())
A) HELLO
B) hello
C) Error
D) Hello
Which of these is used to terminate a loop in Python?
A) continue
B) break
C) return
D) end
What will be the output of the following code? print("Python"[-1])
A) P
B) n
C) h
D) Error
