| Snaprecruit.com

| Snaprecruit.com

Interview question based on skill :

Take as many assements as you can to improve your validate your skill rating

Total Questions: 20

1. What is the output of the code shown? x=3.3456789 '%s' %x, str(x)

Correct Answer is : (‘3.3456789’, ‘3.3456789’)

2. What is the output of the code shown? '%(qty)d more %(food)s' %{'qty':1, 'food': 'spam'}

Correct Answer is : ‘1 more spam’

3. What is the output of the code shown? a='hello' q=10 vars()

Correct Answer is : {‘a’ : ‘hello’, ‘q’ : 10, ……..plus built-in names set by Python….}

4. The output of the code shown below is: s='{0}, {1}, and {2}' s.format('hello', 'good', 'morning')

Correct Answer is : ‘hello, good, and morning’

5. What is the output of the code shown? s='%s, %s & %s' s%('mumbai', 'kolkata', 'delhi')

Correct Answer is : ‘mumbai, kolkata & delhi’

6. What is the output of the code shown below? t = '%(a)s, %(b)s, %(c)s' t % dict(a='hello', b='world', c='universe')

Correct Answer is : ‘hello, world, universe’

7. What is the output of the code shown? '{a}, {0}, {abc}'.format(10, a=2.5, abc=[1, 2])

Correct Answer is : ‘2.5, 10, [1, 2]’

8. What is the output of the code shown below? '{0:.2f}'.format(1.234)

Correct Answer is : ‘1.23’

9. What is the output of the code shown below? '%x %d' %(255, 255)

Correct Answer is : ‘ff, 255’

10. The output of the two codes shown below is the same. State whether true or false. '{0:.2f}'.format(1/3.0) '%.2f'%(1/3.0)

Correct Answer is : TRUE

11. Which of the following is the use of function in python?

Correct Answer is : Functions are reusable pieces of programs

12. Which keyword is use for function?

Correct Answer is : Def

13. What is the output of the below program? def sayHello(): print('Hello World!') sayHello() sayHello()

Correct Answer is : Hello World!

14. What is the output of the below program? def printMax(a, b): if a > b: print(a, 'is maximum') elif a == b: print(a, 'is equal to', b) else: print(b, 'is maximum')printMax(3, 4)

Correct Answer is : 4 is maximum

15. What is the output of the below program ? x = 50def func(x): print('x is', x) x = 2 print('Changed local x to', x)func(x)print('x is now', x)

Correct Answer is : x is now 50

16. What is the output of the below program? x = 50def func(): global x print('x is', x) x = 2 print('Changed global x to', x)func()print('Value of x is', x)

Correct Answer is : x is 50

17. What is the output of below program? def say(message, times = 1): print(message * times)say('Hello')say('World', 5)

Correct Answer is : Hello

18. What is the output of the below program? def func(a, b=5, c=10): print('a is', a, 'and b is', b, 'and c is', c) func(3, 7)func(25, c = 24)func(c = 50, a = 100)

Correct Answer is : a is 3 and b is 7 and c is 10

19. What is the output of below program? def maximum(x, y): if x > y: return x elif x == y: return 'The numbers are equal' else: return y print(maximum(2, 3))

Correct Answer is : 3

20. Which of the following is a features of DocString?

Correct Answer is : All of the mentioned