| 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. Which way among them is used to create an event loop ?

Correct Answer is : Window.mainloop()

2. Which is the special symbol used in python to add comments?

Correct Answer is : #

3. Select the correct function among them which can be used to write the data to perform for a binary output?

Correct Answer is : Dump

4. What is output for −2 * 2 **3

Correct Answer is : 16

5. What is the output of the following code? import math def main(): math.cos(math.pi) main() print(main())

Correct Answer is : None

6. What is the output of the code shown? l=list('HELLO') 'first={0[0]}, third={0[2]}'.format(l)

Correct Answer is : ‘first=H, third=L’

7. What is the output of the code shown below? l=list('HELLO') p=l[0], l[-1], l[1:3] 'a={0}, b={1}, c={2}'.format(*p)

Correct Answer is : “a=H, b=O, c=[‘E’, ‘L’]”

8. Fill in the blanks: The formatting method {1:<10} represents the ___________ positional argument, _________ justified in a 10 character wide field.

Correct Answer is : second, left

9. What is the output of the following code? hex(255), int('FF', 16), 0xFF

Correct Answer is : (‘0xff’, 255, 255)

10. The output of the two codes shown below is the same. State whether this statement is true or false. bin((2**16)-1) '{}'.format(bin((2**16)-1))

Correct Answer is : TRUE

11. What is the output of the code shown below? '{a}{b}{a}'.format(a='hello', b='world')

Correct Answer is : ‘helloworldhello’

12. What is the output of the code shown below? D=dict(p='san', q='foundry') '{p}{q}'.format(**D)

Correct Answer is : sanfoundry

13. What is the output of the code shown below? 'The {} side {1} {2}'.format('bright', 'of', 'life')

Correct Answer is : Error

14. The output of the code shown below is: '{0:f}, {1:2f}, {2:05.2f}'.format(1.23456, 1.23456, 1.23456)

Correct Answer is : ‘1.234560, 1.234560, 01.23’

15. What is the output of the code shown below? '%.2f%s' % (1.2345, 99)

Correct Answer is : ‘1.2399’

16. What is the output of the code shown below? '%s' %((1.23,),)

Correct Answer is : ‘(1.23,)’

17. What is the output of the two codes shown below? '{0}'.format(4.56) '{0}'.format([4.56,])

Correct Answer is : ‘4.56’, ‘[4.56]’

18. What is the type of each element in sys.argv?

Correct Answer is : string

19. What is the length of sys.argv?

Correct Answer is : number of arguments + 1

20. What is the output of the following code? def foo(k): k[0] = 1 q = [0] foo(q) print(q)

Correct Answer is : [1].