Digital : Python Advanced E2 competency
i am not if you can 30/30 but atleast 27 or pass marks there will be like 60.questions you i didn't mentioned all 60 in this blog only 30 are present.check carefully and give the answers.
by doing below course you can E2 competency in digital course 54196
Q1)
Which of the following options is not a server socket method?
bind()
Accept ()
listen()
connect()
Question No. 2
Please select value of after exceuting the below code. What will be value of var2
>>> var1= [1, 2, 3]
>>> var2 =var1
>>>var1.append(4)
>>> var2
Program with indentation and correct output.
var1= [1, 2, 3]
var2 =var1
var1.append(4)
print(var2)
A) [1, 2, 3]
B) [1, 2, 3, 4]
C) var1
D) Error
Q.3)
Which of the following datatypes are Hashable? (Choose two)
1) float
2) dictionary
3) string
4) set
What is the output of the following code?
class A:
def __init__(self, i=1):
self.i=i
class B(A):
def __init__(self, j=2):
super().__init__()
self.j=j
def main():
b = B()
print(b.i, b.j)
main()
1) 01
2) 00
3) 02
4) 12
Q.4)
Upon creation of the 'dumbdbm' database, files with which of the given extensions are created? (Choose two)
1) . bin
2) .Dat
3) .dir
4) .dbm
Q.5)
A user wants to build a ETL in we which should be able to execute the dynamic rules. Which module in Python can be used for dynamic rule execution?
None
Use 'pyregex' module
Use 'regex' module
Use 're' module
Q.6 )
Which of the following options is a correct syntax of the "AttlistDeclHandler" method?
AttlistDeclHandler(elname, attname, base, required)
AttlistDeclHandler(elname, attname, type, default, required)
AttlistDeclHandler(elname, attname, base, default, systemid)
AttlistDeclHandler(elname, attname, type, base)
Q.7)
Which of the following relationship suits best for an Employee and a Person
Inheritance
Association
None of the above
Composition
What is the output of the following code?
class A:
def __init_(self,x):
self.x = x
x =44
a = A(4)
print(a.x)
1) None of the above
2) 4
3) 44
4) Syntax Error
While working in Python 3.4, sockets are by default created in the________mode.
blocking
non-blocking
timeout
What is the output of following code in Python 3.x?
class A:
def __init__(self):
self.calculate(30)
print("i in Class A is", self.i)
def calculate(self, i):
self.i=2* i
class B(A):
def __init__(self):
super().__init__()
def calculate(self, i): self.i=3*i
b= B()
I in Class A is 0"
I in Class A is 90"
I 0 in Class A is 60"
Error
What is the output of the following code in Python 3.x environment?
x="abcdef"
i= "i"
while i in x:
print(i, end= " ")
No Output
Oabcdef
Error
abcdef
Which of the following shell expressions in Python 3.4 will give an error?
>>> import unicodedata >>> unicodedata.name('/‘)
>>> import unicodedata >>> unicodedate.bidirectional(‘\u0660')
>>> import unicodedata >>> unicodedata.decimal(9)
>>> import unicodedata >>> unicodedatacategoryM)
What is the output of the following code?
class A:
def __init__(self, x):
self.x = x
a = A(100)
a.__dict__['y'] = 50
print (a.x + len(a.__dict__))
100
102
101
150
What will be the output of the following line of code in Python 3.4.2?
***print (0x0)+0x8+0xC)
33
9
0xD0x80xC
22
Which of the following Python 142 shel produce the below-given output?
56.25
>>7.5**2
>>7.5^2
>>7.5#2
>>7.512
In which of the following modes of files, the 'tell()' function returns an opaque number that gives the current position of the file object?
text node
both binary and text modes
binary mode
Which of the following shell expressions will give the result as an integer value?
1.>>> (100-45)/(20-25)
2. >>>7.0/4
3. >>>5/4
4. >>> 2 4/2
5.>>>5-2
Lines number 3 and 5
Line number 2
Line number 1
Line number 5
During the execution of the below-given Python/C API function, what will happen when no exception has been raised?
int PyEm ExceptionMatches(PyObject "exc)
It will clear the error indicator.
It will return NULL
It will call "void PyErr_Print()" function
A memory access violation will occur.
What will be the output of the following expression in Python 3.4 shell?
-6.34'zfill(7)
-6.3400
-06.340
-6.34
-006.34
Which of the following exceptions is raised when the sequence subscript is out of range?
exception EOFError
exception IndexError
exception Overflow.rror
exception UnboundLocalError
What is the output of the following code?
class A:
def __init__(self, i = 0):
self.i=i
class B(A):
def __init__(self, j = 0):
self.j=j
def main():
b=B(50)
print(b.i)
print(b.j)
main()
None of the above
50
Attrib Error
00
What will be the output of the below-given code in Python 3.4.2 shell?
str = "example123"
str[::-1]
'321elpmaxe'
3
xample123
example 12
In Python 3.4, a conventional pluggable event loop model is provided by which of the following library modules?
Selectors
Ensurepip
Asyncio
Enum
What will be the output of the following program?
i = [12, 9, 14]
k = [7, 16, 11]
for j in i[:]:
for m in k[:]:
if(j%m == 0):
j = j // 2
m = m / 2
print (j, m)
else:
j = j + m
m = m - j
print (j, m)
print (j, m)
19-12
35-19
46-35
16-9
88.0
19-8
735
23-7
24-22
Which of the following Python/C API functions will NOT always return NULL?
PyObject* PyErr_SetFromErmo(PyObject "type)
PyObject* PyErr_SetFromErmoWithFilename(PyObject "type, const char *filename)
PyObject* PyErr_NewException(char *name, PyObject *base, PyObject *dict)
PyObject* PyErr_Format(PyObject *exception, const char *format, ...)
PyObject* PyErr_SetFromWindowsErr(int ierr)
What will be the output of the following program?
for i in range(1, 6):
if i%4== 0:
print ('x')
elif i%2 == 0 :
print ('x')
else:
print ('xxxxx')
Answers
xxxxx
x
xxxxx
x
Xxxxx
What is the value of variable 'k' in the below shown code?
> k = [ print(i) for i in 'hello' if i not in 'aeiou' ]
[None, None, None] with Python 3.x
[‘h’,’l’,’l’]
[None, None, None] with Python 2.x
[h', 'e'. ‘l’,’l’,’o’]
What will be the output of the following program?
def country(*abc):
if len(abc) == 1:
item = abc[0]
def f(obj):
return obj[item]
else:
def f(obj):
return tuple(obj[item] for item in abc)
return f
selection = []
selection = country(slice(2, None))('AUSTRALIA')
print(selection)
STRALIA
ALIA
USTARLIA
AU
What is the value of variable 'x' in the below shown code?
> x = [i**+1 for i in range(5)]
[0,1,4,9,16]
[0,1,2,3,4]
[1,2,5,10,17]
Error
What is the output of the following Code?
sum([[2,6],[4,3]],[])
O6,9]
None of the above
[2,6,4,3]
[0,0]

No comments