Quiz
Untitled
Create a free account to finish this quiz
Save your progress and see your final score.
Already have an account? Sign in
Questions in this quiz (8)
1What is the output of the following?
print("Hello {1} and {0}".format('bin', 'foo'))
- AHello foo and bin
- BHello bin and foo
- CError
- DNone of the mentioned
27. What will be the output?
>>>d = {"john":40, "peter":45}
>>>d["john"]- A40
- B45
- C“john”
- D“peter”
31. What is the output of the following?
i = 2
while True:
if i%3 == 0:
break
print(i)
i += 2- A2 4 6 8 10
- B2 4
- C2 3
- Derror
4What is the output of the code shown below?
def f(x):
yield x+1
print("test")
yield x+2
g=f(9)- AError
- Btest
- Ctest1012
- DNo output
5What is the output of the functions shown below?
divmod(10.5,5)
divmod(2.4,1.2)- A(2.00, 0.50)(2.00, 0.00)
- B(2, 0.5)(2, 0)
- C(2.0, 0.5)(2.0, 0.0)
- D(2, 0.5)(2)
6 What is the output of the following piece of code?
class A():
def disp(self):
print("A disp()")
class B(A):
pass
obj = B()
obj.disp()- AInvalid syntax for inheritance
- BError because when object is created, argument must be passed
- CC. Nothing is printed
- DA disp()
7Which of the following statements is true?
- AThe __new__() method automatically invokes the __init__ method
- BThe __init__ method is defined in the object class
- CThe __eq(other) method is defined in the object class
- DThe __repr__() method is defined in the object class
8What is the output of the code shown below?
def f(x):
def f1(a, b):
print("hello")
if b==0:
print("NO")
return
return f(a, b)
return f1
@f
def f(a, b):
return a%b
f(4,0)- AhelloNO
- BhelloZero Division Error
- CNO
- Dhello
Information
- Description
- Quiz on Untitled, created by raghu Katagall on 23/05/2018.
- Author
- raghu Katagall
- Language
- English
- Views
- 98
- Tags
- Rating
- No ratings yet Rate this quiz