You are on page 1of 2

PYTHON QUESTIONS 3

1. How To Save An Image Locally Using Python Whose URL Address I Already
Know?
2. What is map function in Python?
3. Is python numpy better than lists?
4. How to get indices of N maximum values in a NumPy array?
5. How do you calculate percentiles with Python/ NumPy?
6. What is the difference between NumPy and SciPy?
7. How do you make 3D plots/visualizations using NumPy/SciPy?
8. Which of the following statements create a dictionary? (Multiple Correct Answers
Possible)

a) d = {}
b) d = {“john”:40, “peter”:45}
c) d = {40:”john”, 45:”peter”}
d) d = (40:”john”, 45:”50”)

9. Which one of these is floor division?


a) /
b) //
c) %
d) None of the mentioned
10. What is the maximum possible length of an identifier?
a) 31 characters
b) 63 characters
c) 79 characters
d) None of the above

11.Why are local variable names beginning with an underscore discouraged ?

a)they are used to indicate a private variables of a class


b) they confuse the interpreter
c) they are used to indicate global variables
d) they slow down execution

12.Which of the following is an invalid statement?


a)abc=1,000,000
b)a b c=1000 2000 3000
c)a,b,c=1000,2000,3000
d) a_b_c = 1,000,000

13.Suppose list1 is [2, 33, 222, 14, 25], What is list1[-1] ?


a)Error
b)None
c)25
d) 2

14.To open a file c:scores.txt for writing, we use


a) outfile = open(“c:scores.txt”, “r”)
b) outfile = open(“c:scores.txt”, “w”)
c) outfile = open(file = “c:scores.txt”, “r”)
d) outfile = open(file = “c:scores.txt”, “o”)

15.When will the else part of try-except-else be executed?


a) always
b) when an exception occurs
c) when no exception occurs
d) when an exception occurs into except block

16.Is there a scanf() or sscanf() equivalent

17.What's a negative index?

18.How do you make an array in Python?

19.What is self?

20.What are the global and local variables in Python?

You might also like