Which of the following is a Python tuple?
Which of the following is a Python tuple?
What arithmetic operators cannot be used with strings in Python?
What arithmetic operators cannot be used with strings in Python?
What will be the output of the following Python program?
z=set('abc')
z.add('san')
z.update(set(['p', 'q']))
z
What will be the output of the following Python program?
z=set('abc')
z.add('san')
z.update(set(['p', 'q']))
z
-
-
-
-
Which module in the python standard library parses options received from the command line?
Which module in the python standard library parses options received from the command line?
What will be the output of the following Python program?
def foo(x):
x[0] = ['def']
x[1] = ['abc']
return id(x)
q = ['abc', 'def']
print(id(q) == foo(q))
What will be the output of the following Python program?
def foo(x):
x[0] = ['def']
x[1] = ['abc']
return id(x)
q = ['abc', 'def']
print(id(q) == foo(q))
What will be the output of the following Python code?
-
class tester:
-
def __init__(self, id):
-
self.id = str(id)
-
id="224"
-
-
>>>temp = tester(12)
-
>>>print(temp.id)
What will be the output of the following Python code?
-
class tester:
-
def __init__(self, id):
-
self.id = str(id)
-
id="224"
-
-
>>>temp = tester(12)
-
>>>print(temp.id)
Which one of the following is not a keyword in Python language?
Which one of the following is not a keyword in Python language?
Which function is called when the following Python program is executed?
f = foo()
format(f)
Which function is called when the following Python program is executed?
f = foo()
format(f)
What will be the output of the following Python statement?
>>>"a"+"bc"
What will be the output of the following Python statement?
>>>"a"+"bc"
What will be the output of the following Python code snippet?
for i in [1, 2, 3, 4][::-1]:
print (i)
What will be the output of the following Python code snippet?
for i in [1, 2, 3, 4][::-1]:
print (i)
What is the order of namespaces in which Python looks for an identifier?
What is the order of namespaces in which Python looks for an identifier?
What will be the output of the following Python code?
print("abc. DEF".capitalize())
What will be the output of the following Python code?
print("abc. DEF".capitalize())
Which of the following statements is used to create an empty set in Python?
Which of the following statements is used to create an empty set in Python?
What will be the value of ‘result’ in following Python program?
list1 = [1,2,3,4]
list2 = [2,4,5,6]
list3 = [2,6,7,8]
result = list()
result.extend(i for i in list1 if i not in (list2+list3) and i not in result)
result.extend(i for i in list2 if i not in (list1+list3) and i not in result)
result.extend(i for i in list3 if i not in (list1+list2) and i not in result)
What will be the value of ‘result’ in following Python program?
list1 = [1,2,3,4]
list2 = [2,4,5,6]
list3 = [2,6,7,8]
result = list()
result.extend(i for i in list1 if i not in (list2+list3) and i not in result)
result.extend(i for i in list2 if i not in (list1+list3) and i not in result)
result.extend(i for i in list3 if i not in (list1+list2) and i not in result)
-
-
-
-
What will be the output of the following Python program?
-
def addItem(listParam):
-
listParam += [1]
-
-
mylist = [1, 2, 3, 4]
-
addItem(mylist)
-
print(len(mylist))
What will be the output of the following Python program?
-
def addItem(listParam):
-
listParam += [1]
-
-
mylist = [1, 2, 3, 4]
-
addItem(mylist)
-
print(len(mylist))
What are the two main types of functions in Python?
What are the two main types of functions in Python?
What will be the output of the following Python code?
x = 'abcd'
for i in range(len(x)):
print(i)
What will be the output of the following Python code?
x = 'abcd'
for i in range(len(x)):
print(i)
What will be the output of the following Python program?
i = 0
while i < 5:
print(i)
i += 1
if i == 3:
break
else:
print(0)
What will be the output of the following Python program?
i = 0
while i < 5:
print(i)
i += 1
if i == 3:
break
else:
print(0)
What is the maximum possible length of an identifier in Python?
What is the maximum possible length of an identifier in Python?
Which of the following Python statements will result in the output: 6?
A = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]
Which of the following Python statements will result in the output: 6?
A = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]
Which one of the following is the use of function in python?
Which one of the following is the use of function in python?
What will be the output of the following Python code?
-
>>>list1 = [1, 3]
-
>>>list2 = list1
-
>>>list1[0] = 4
-
>>>print(list2)
What will be the output of the following Python code?
-
>>>list1 = [1, 3]
-
>>>list2 = list1
-
>>>list1[0] = 4
-
>>>print(list2)
What will be the output of the following Python code?
print('*', "abcde".center(6), '*', sep='')
What will be the output of the following Python code?
print('*', "abcde".center(6), '*', sep='')
To add a new element to a list we use which Python command?
To add a new element to a list we use which Python command?
What will be the output of the following Python code?
x = 'abcd'
for i in x:
print(i.upper())
What will be the output of the following Python code?
x = 'abcd'
for i in x:
print(i.upper())
What will be the output of the following Python function?
len(["hello",2, 4, 6])
What will be the output of the following Python function?
len(["hello",2, 4, 6])
What does pip stand for python?
What does pip stand for python?
What will be the output of the following Python code snippet if x=1?
x<<2
What will be the output of the following Python code snippet if x=1?
x<<2
What is the order of precedence in python?
What is the order of precedence in python?
-
-
-
-
Python supports the creation of anonymous functions at runtime, using a construct called __________
Python supports the creation of anonymous functions at runtime, using a construct called __________
Which of the following functions can help us to find the version of python that we are currently working on?
Which of the following functions can help us to find the version of python that we are currently working on?
What will be the output of the following Python code?
i = 1
while True:
if i%3 == 0:
break
print(i)
i + = 1
What will be the output of the following Python code?
i = 1
while True:
if i%3 == 0:
break
print(i)
i + = 1
Which of the following character is used to give single-line comments in Python?
Which of the following character is used to give single-line comments in Python?
Which keyword is used for function in Python language?
Which keyword is used for function in Python language?
Which of the following is used to define a block of code in Python language?
Which of the following is used to define a block of code in Python language?
What will be the value of the following Python expression?
4 + 3 % 5
What will be the value of the following Python expression?
4 + 3 % 5
Which of the following is true for variable names in Python?
Which of the following is true for variable names in Python?
What are the values of the following Python expressions?
2**(3**2)
(2**3)**2
2**3**2
What are the values of the following Python expressions?
2**(3**2)
(2**3)**2
2**3**2
Which of the following is the truncation division operator in Python?
Which of the following is the truncation division operator in Python?
Which of these is the definition for packages in Python?
Which of these is the definition for packages in Python?
What will be the output of the following Python expression if x=56.236?
print("%.2f"%x)
What will be the output of the following Python expression if x=56.236?
print("%.2f"%x)
Which of the following is not a core data type in Python programming?
Which of the following is not a core data type in Python programming?
Which of the following is not a core data type in Python programming?
Which of the following is not a core data type in Python programming?
What will be the output of the following Python function?
min(max(False,-3,-4), 2,7)
What will be the output of the following Python function?
min(max(False,-3,-4), 2,7)
What will be the output of the following Python function?
min(max(False,-3,-4), 2,7)
What will be the output of the following Python function?
min(max(False,-3,-4), 2,7)
The following python program can work with ____ parameters.
def f(x):
def f1(*args, **kwargs):
print("Sanfoundry")
return x(*args, **kwargs)
return f1
The following python program can work with ____ parameters.
def f(x):
def f1(*args, **kwargs):
print("Sanfoundry")
return x(*args, **kwargs)
return f1
Which of the following is the use of id() function in python?
Which of the following is the use of id() function in python?
Which of the following functions is a built-in function in python?
Which of the following functions is a built-in function in python?
What will be the output of the following Python code?
l=[1, 0, 2, 0, 'hello', '', []]
list(filter(bool, l))
What will be the output of the following Python code?
l=[1, 0, 2, 0, 'hello', '', []]
list(filter(bool, l))
-
-
-
-
All keywords in Python are in _________
All keywords in Python are in _________