NEW
Font size
WorksheetsPPS PYTHON QUIZ
Total questions: 20
Worksheet time: 20mins
Who developed the Python language?
Zim Den
Guido van Rossum
Niene Stom
Wick van Rossum
What do we use to define a block of code in Python language?
Key
Brackets
Indentation
None of these
Which character is used in Python to make a single line comment?
/
//
#
!
Which of the following statements is correct regarding the object-oriented programming concept in Python?
Classes are real-world entities while objects are not real
Objects are real-world entities while classes are not real
Both objects and classes are real-world entities
All of the above
Study the following function:
any([5>8, 6>3, 3>1])
False
True
Invalid code
None of these
Study the following code:
>>>"javatpoint"[5:]
javatpoint
java
point
None of these
Study the following program:
i = 1:
while True:
if i%3 == 0:
break
print(i)
1 2 3
3 2 1
1 2
Invalid syntax
Which of the following option is not a core data type in the python language?
Dictionary
Lists
Class
All of the above
Which of the following data types is shown below?
Dictionary
Tuple
List
Stack
Study the following program:
print(print(print("javatpoint")))
javatpoint None None
None None javatpoint
None javatpoint None
Javatpoint
Study the following program:
a = '1 2'
print(a * 2)
print(a * 0)
print(a * -2)
1 2 1 2
2 4
0
-1 -2 -1 -2
Study the following expression:
str = [(1, 1), (2, 2), (3, 3)]
What type of data is in this expression?
String type
Array lists
List of tuples
str lists
Which of the following code will create a set in python language?
1. thisset = (("apple", "banana", "cherry"))
2. thisset = ("car", "bike", "123")
3. thisset = {}
1 only
1 and 2 both
1, 2, and 3 will create a set
None of the these
Which of the following statements would create a tuple in python?
mytuple = ("apple", "banana", "cherry")
mytuple[123] = ("apple", "banana", "cherry")
mytuple = ("2" * ("apple", "banana", "cherry"))
None of the these
To add a new element to a list we use which Python command?
list1.addEnd(5)
list1.addLast(5)
list1.append(5)
list1.add(5)
What will be the output of the following Python code?
>>>list1 = [1, 3]
>>>list2 = list1
>>>list1[0] = 4
>>>print(list2)
[1, 4]
[1, 3, 4]
[4, 3]
[1, 3]
What will be the output of the following Python code snippet?
z=set('abc$de') 'a' in z
Error
True
False
No output
What will be the output of the following Python code?
>>> str1 = 'hello'
>>> str2 = ','
>>> str3 = 'world'
>>> str1[-1:]
olleh
hello
h
o
What is the purpose of NumPy in Python?
To do numerical calculations
To do scientific computing
Both A and B
None of the mentioned above
NumPy arrays can be ___.
Indexed
Sliced
Iterated
All of the mentioned above
