Time Left : 00 : 30 : 00

What will be the output of the following Python code snippet?

print('ab cd-ef'.title())



Correct Answer : C

What will be the output of the following Python code?

print("abcdef".center(10, '12'))

 

Correct Answer : D

To concatenate two strings to a third what statements are applicable?

Correct Answer : C

What will be the output of the following Python expression?

round(4.576)

 

Correct Answer : B

What is output of print(math.pow(3, 2))?

Correct Answer : A

Is the following Python code valid?

>>> a=(1,2,3)
>>> b=a.update(4,)

 

Correct Answer : C

Which of the following Boolean expressions is not logically equivalent to the other three?

Correct Answer : D

What will be the output of the following Python function?

any([2>8, 4>2, 1>2])

 

Correct Answer : B

Operators with the same precedence are evaluated in which manner?

Correct Answer : A

What is the return value of trunc()?

Correct Answer : A

In order to store values in terms of key and value we use what core data type

Correct Answer : D

What will be the output of the following Python code?

>>> import collections
>>> b=dict()
>>> b=collections.defaultdict(lambda: 7)
>>> b[4]

 

Correct Answer : D

What is the value of the following expression?

8/4/2, 8/(4/2)

 

Correct Answer : A

What will be the output of the following Python code?

print("ab\tcd\tef".expandtabs(4))



Correct Answer : D

The difference between the functions discard and remove is that:

Correct Answer : D

What are the two main types of functions in Python?

Correct Answer : C

What will be the output of the following Python code?

b=[2,3,4,5]
a=list(filter(lambda x:x%2,b))
print(a)

 

Correct Answer : C

What will be the output of the following Python code?

>>>str="hello"
>>>str[:2]
>>>

 

Correct Answer : A

What will be the output of the following Python code?

names1 = ['Amir', 'Bala', 'Chales']
 
if 'amir' in names1:
    print(1)
else:
    print(2)



Correct Answer : C

What will be the output of the following Python code?

print("Hello {name1} and {name2}".format('foo', 'bin'))

 

Correct Answer : C

What will be the value of the following Python expression?

bin(10-2)+bin(12^4)



Correct Answer : D

What will be the output of the following Python statement?

>>>"a"+"bc"

 

Correct Answer : D

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))

 

Correct Answer : A

What will be the output of the following Python code?

print("abcdef".find("cd") == "cd" in "abcdef")

 

Correct Answer : B

What will be the output of the python code shown below for various styles of format specifiers?

x=1234
res='integers:...%d...%-6d...%06d' %(x, x, x)
res

 

Correct Answer : A

To which of the following the “in” operator can be used to check if an item is in it?

Correct Answer : D

What will be the output of the following Python code?

myList = [1, 5, 5, 5, 5, 1]
max = myList[0]
indexOfMax = 0
for i in range(1, len(myList)):
    if myList[i] > max:
        max = myList[i]
        indexOfMax = i
 
>>>print(indexOfMax)

 

Correct Answer : A

To insert 5 to the third position in list1, we use which command?

Correct Answer : B

Who developed Python Programming Language?

Correct Answer : C

What will be the output of the following Python code snippet?

not(10<20) and not(10>30)

 

Correct Answer : B