Take as many assements as you can to improve your validate your skill rating
Total Questions: 20
1. What is the output of this code?
import sys
eval(sys.stdin.readline())
"India"
Correct Answer is : ‘India’
2. What is the output of the code shown below?
import sys
eval(sys.stdin.readline())
Computer
Correct Answer is : Error
3. What is the output of the code shown below?
import sys
sys.argv[0]
Correct Answer is : ‘ ‘
4. What is the output of the code shown below is:
import sys
sys.stderr.write(“hello”)
Correct Answer is : hello5
5. What is the output of the code shown below?
import sys
sys.argv
Correct Answer is : [‘ ‘]
6. To obtain a list of all the functions defined under sys module, which of the following functions can be used?
Correct Answer is : print(dir(sys))
7. The output of the function len(sys.argv) is ____________
Correct Answer is : 1
8. Which of the following is a Python tuple?
Correct Answer is : (1, 2, 3)
9. Suppose t = (1, 2, 4, 3), which of the following is incorrect?
Correct Answer is : t[3] = 45
10. What will be the output?
>>>t=(1,2,4,3)>>>t[1:3]
Correct Answer is : (2, 4)
11. What will be the output?
>>>t=(1,2,4,3)>>>t[1:-1]
Correct Answer is : (2, 4)
12. What will be the output?
>>>t = (1, 2, 4, 3, 8, 9)>>>[t[i] for i in range(0, len(t), 2)]
Correct Answer is : [1, 4, 8].
13. What will be the output?
d = {"john":40, "peter":45}d["john"]
Correct Answer is : 40
14. What will be the output?
>>>t = (1, 2)>>>2 * t
Correct Answer is : (1, 2, 1, 2)
15. What will be the output?
>>>t1 = (1, 2, 4, 3)>>>t2 = (1, 2, 3, 4)>>>t1 < t2
Correct Answer is : FALSE
16. What will be the output?
>>>my_tuple = (1, 2, 3, 4)>>>my_tuple.append( (5, 6, 7) )>>>print len(my_tuple)
Correct Answer is : Error
17. What will be the output?
numberGames = {}numberGames[(1,2,4)] = 8numberGames[(4,2,1)] = 10numberGames[(1,2)] = 12sum = 0for k in numberGames: sum += numberGames[k]print len(numberGames) + sum
Correct Answer is : 33
18. What is the data type of (1)?
Correct Answer is : Integer
19. If a=(1,2,3,4), a[1:-1] is
Correct Answer is : (2,3)
20. What is the output of the following code?
>>> a=(1,2,(4,5))
>>> b=(1,2,(3,4))
>>> a