Question: Greeting! Hello, there, I'm a new student. Python: Subject. I'm begging, Kindly answers all the questions. it's biggest help for me to grant my request.

Greeting!

Hello, there, I'm a new student. Python: Subject.

I'm begging, Kindly answers all the questions. it's biggest help for me to grant my request. Thanks in advanced. This is the continuation of the exam.

31.) If there is a finally: branch inside the try: block, we can say that:

a.) branches is executed b.) it will be executed when there is no else: branch c.) it will always be executed d.) it won't be executed if no exception is raised

32.) What will be the output of the following snippet?

try: raise Exception except BaseException: print("a",end='') else: print("b",end='') finally: print("c")

a.) ab b.) ac c.) bc d.) a

33.) What will be the output of the following snippet?

class A: def __init__(self,name): self.name = name a = A("class") print(a)

a.) a number b.) class c.) a string ending with a long hexadecimal number d.) name

34.) What will be the output of the following snippet?

try: raise Exception except: print("c") except BaseException: print("a") except Exception: print("b")

a.) c b.) it will an cause error c.) a d.) b

35.) What will be the output of the following snippet?

class X: pass class Y(X): pass class Z(Y): pass x = X() z = Z()

print(isinstance(x,Z),isinstance(z,X))

a.) True False b.) True True c.) False True d.) False False

36.) The following code prints:

x = "\" print(len(x))

a.) 2 b.) the code will cause an error c.) 3 d.) 1

37.) The following code prints:

x = """ """ print(len(x))

a.) 1 b.) 3 c.) 2 d.) the code will cause an error

38.) If the class constructor is declared as below, which one of the assignments is valid?

class Class: def __init__(self): pass

a.) object = Class(None) b.) object = Class(1) c.) object = Class() d.) object = Class(1,2)

39.) What will be the output of the following code?

class A: A = 1 def __init__(self,v = 2): self.v = v + A.A A.A += 1 def set(self,v): self.v += v A.A += 1 return a = A() a.set(2) print(a.v)

a.) 3 b.) 1 c.) 7 d.) 5

40.) What will be the output of the following code?

class A: A = 1 def __init__(self): self.a = 0 print(hasattr(A,'A'))

a.) 1 b.) 0 c.) False d.) True

41.) What will be the result of executing the following code?

class A: pass class B: pass class C(A,B): pass print(issubclass(C,A) and issubclass(C,B))

a.) it will print an empty line b.) it will print False c.) it will print True d.) it will raise an exception

42.) The sys.stdout stream is normally associated with:

a.) a null device b.) the screen c.) the keyboard d.) the printer

43.) What will be the effect of running the following code?

class A: def __init__(self,v): self._a = v + 1 a = A(0) print(a._a)

a.) it will print 1 b.) it will print 0 c.) it will raise an AttributeError exception d.) it will print 2

44.) What will be the result of executing the following code?

class A: def __init__(self): pass def f(self): return 1 def g(): return self.f() a = A() print(a.g())

a.) it will print True b.) it will print 1 c.) it will raise an exception d.) it will print 0

45.) What will be the result of executing the following code?

class A: def a(self): print('a') class B: def a(self): print('b')

class C(A,B): def c(self): self.a() o = C() o.c()

a.) it will print b b.) it will print c c.) it will print a d.) it will raise an exception

46. The Exception class contains a property named args, and it is a:

a.) list b.) tuple c.) dictionary d.) string

47.) What will be the result of executing the following code?

def I(n): s = '' for i in range(n): s += '*' yield s for x in I(3): print(x,end='')

a.) it will print * b.) it will print *** c.) it will print **** d.) it will print ******

48.) What will be the result of executing the following code?

def a(x): def b(): return x + x return b x = a('x') y = a('') print(x() + y())

a.) it will print xx b.) it will print xxxxxx c.) it will print xxxx d.) it will print x

49.) If s is a stream opened in read mode, the following line

q = s.readlines() will assign q as a:

a.) tuple b.) list c.) string d.) dictionary

50.) If you want to write a byte array's content to a stream, you'd use:

a.) writebytearray() method b.) the writefrom() method c.) writeto() method d.) the write() method

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!