Python QuestionsBy Kritika Papne / March 20, 2023 0 votes, 0 avg 656 123456789101112131415 Python Questions 1 / 15 1. Which of the following functions can help us to find the version of python that we are currently working on? A. sys.version(1) B. sys.version(0) C. sys.version() D. sys.version 2 / 15 2. Which of the following statements are used in Exception Handling in Python? A. try B. except C. finally D. All of the above 3 / 15 3. The list.index(x[, start[, end]]) is used to ___. A. Return zero-based index in the list B. Raises a ValueError if there is no such item C. Both A and B D. None of the mentioned above 4 / 15 4. Which of the following functions can be used to read data from a file using a file descriptor? A. os.reader() B. os.read() C. os.quick_read() D. os.scan() 5 / 15 5. Which of the following types of loops are not supported in Python? A. for B. while C. do-while D. All of the above 6 / 15 6. Which of the following is used to define a block of code in Python language? A. Indentation B. Keys C. Brackets D. All of the above 7 / 15 7. How can assertions be disabled in Python? A. passing -O when running python B. assertions are disabled by default C. both A and B are wrong D. Assertions cannot be disabled in python 8 / 15 8. What will be the output of the following code snippet? square = lambda x: x ** 2 a = [] for i in range(5): a.append(square(i)) print(a) A. [0, 1, 4, 9, 16] B. [1, 4, 9, 16, 25] C. [0, 1, 2, 3, 4] D. [1, 2, 3, 4, 5] 9 / 15 9. Which of the following is a Python tuple? A. {1, 2, 3} B. {} C. [1, 2, 3] D. (1, 2, 3) 10 / 15 10. Which one of the following syntaxes is the correct syntax to read from a simple text file stored in ”d:python.txt”? A. Infile = open(file=''d:\python.txt'', ''r'') B. Infile = open(''d:python.txt'',''r'') C. Infile = open(''d:\python.txt'', ''r'') D. Infile = open.file(''d:\python.txt'',''r'') 11 / 15 11. What will be the output of the following Python function? float(‘-infinity’) float(‘inf’) A. –inf Inf B. –infinity Inf C. Error Error D. Error Junk value 12 / 15 12. The process of pickling in Python includes ____________ A. conversion of a Python object hierarchy into byte stream B. conversion of a datatable into a list C. conversion of a byte stream into Python object hierarchy D. conversion of a list into a datatable 13 / 15 13. What is called when a function is defined inside a class? A. Module B. Class C. Another Function D. Method 14 / 15 14. What will be the output of the following Python code? places = ['Bangalore', 'Mumbai', 'Delhi'] places1 = places places2 = places[:] places1[1]="Pune" places2[2]="Hyderabad" print(places) A. [‘Bangalore’, ‘Pune’, ‘Hyderabad’] B. [‘Bangalore’, ‘Pune’, ‘Delhi’] C. [‘Bangalore’, ‘Mumbai’, ‘Delhi’] D. [‘Bangalore’, ‘Mumbai’, ‘Hyderabad’] 15 / 15 15. What will be the datatype of the var in the below code snippet? var = 10 print(type(var)) var = "Hello" print(type(var)) A. str and int B. int and int C. str and str D. int and str Your score isThe average score is 40% LinkedIn Facebook VKontakte 0% Restart quiz By WordPress Quiz plugin Written by Shubhranshu Shekhar, who has trained 20000+ students in coding. Kritika Papne