WorksheetsPython Programming Quiz
Total questions: 25
Worksheet time: 13mins
Which of these is not a core data type?
Lists
Dictionary
Tuples
Class
What data type is the object below ?
D = [1, 23, ‘hello’, 1]
Dictionary
List
Tuple
Array
What is the output of the following code :
print 9//2
4.5
4.0
4
Error
What is the maximum possible length of an identifier?
16
32
64
None of these
Who developed the Python language?
Zim Den
Guido van Rossum
Niene Stom
Wick van Rossum
Which one of the following is the correct extension of the Python file?
.python
.p
.py
None of these
What do we use to define a block of code in Python language?
Key
Brackets
Indentation
parenthesis
Which of the following declarations is incorrect?
_x = 2
__x = 3
__xyz__ = 5
None of these
Which of the following declarations is incorrect in python language?
xyzp = 5,000,000
x y z p = 5000 6000 7000 8000
x,y,z,p = 5000, 6000, 7000, 8000
x_y_z_p = 5,000,000
Which of the following operators is the correct option for power(ab)?
a ^ b
a**b
a ^ ^ b
a ^ * b
What will be the output of this statement?
>>>"a"+"bc"
a+bc
a bc
abc
a
Which of the following is the correct statement?
z = {"x":0, "y":1}
Dictionary z is created
x and y are the keys of dictionary z
0 and 1 are the values of dictionary z
All of the above
Which keyword is used for function?
Fun
define
def
function
Which among these are the special operators in python
Logical Operator
Bitwise operator
Membership operator
Relational operator
Which one is NOT a legal variable name?
my_var
my-var
_myvar
Myvar
What is the correct syntax to output the type of a variable or object in Python?
print(typeof(x))
print(typeof x)
print(typeOf(x))
print(type(x))
In Python, 'Hello', is the same as "Hello"
True
False
What is a correct syntax to return the first character in a string?
x = sub("Hello", 0, 1)
x = "Hello"[0]
x = "Hello".sub(0, 1)
print("3+4")
Which of these is the correct code for creating a list of names?
nameList = John, Harry, Mac, Donald, Colonel, Tony
nameList = ("John", "Harry", "Mac", "Donald", "Colonel", "Tony")
nameList = ["John", "Harry", "Mac", "Donald", "Colonel", "Tony"]
nameList = [John, Harry, Mac, Donald, Colonel, Tony]
Which of the following is the correct output of the call to below line of code?
print(list("hello"))
['h', 'e', 'l', 'l', 'o']
None of these
[h,e,l,l,o]
['h' 'e' 'l' 'l' 'o']
Gjdk is not a good name for a variable, why?
It starts with a capital letter.
It does not contain any spaces.
There are no vowels.
It's meaningless.
