Python Questions March 20, 2023 | No Comments 0 votes, 0 avg 568 123456789101112131415 Python Questions 1 / 15 1. What is Instantiation in terms of OOP terminology? A. Deleting an instance of class B. Modifying an instance of class C. Copying an instance of class D. Creating an instance of class 2 / 15 2. Study the following code: x = [‘XX’, ‘YY’] for i in a: i.lower() print(a) What will be the output of this program? A. [‘XX’, ‘YY’] B. [‘xx’, ‘yy’] C. [XX, yy] D. None of these 3 / 15 3. 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 4 / 15 4. Which of the following statements are used in Exception Handling in Python? A. try B. except C. finally D. All of the above 5 / 15 5. Which keyword is used for function in Python language? A. Function B. def C. Fun D. Define 6 / 15 6. Which of the following is the proper syntax to check if a particular element is present in a list? A. if ele in list B. if not ele not in list C. none of the mentioned D. Both A and B 7 / 15 7. What will be the output of the following Python code? def unpack(a,b,c,d): print(a+d) x = [1,2,3,4] unpack(*x) A. Error B. [1,4] C. [5] D. 5 8 / 15 8. What will be the output of the following Python code? x = "abcdef" i = "a" while i in x: x = x[:-1] print(i, end = " ") A. i i i i i i B. a a a a a a C. a a a a a D. none of the mentioned 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. 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 11 / 15 11. As what datatype are the *kwargs stored, when passed into a function? A. list B. tuple C. dictionary D. none of the above 12 / 15 12. What is called when a function is defined inside a class? A. Module B. Class C. Another Function D. Method 13 / 15 13. Python supports the creation of anonymous functions at runtime, using a construct called __________ A. pi B. anonymous C. lambda D. None of the mentioned 14 / 15 14. time.time() returns ________ A. the current time in milliseconds since midnight B. the current time in milliseconds since midnight, January 1, 1970 GMT (the Unix time) C. the current time D. the current time in milliseconds 15 / 15 15. Which of the following types of loops are not supported in Python? A. for B. while C. do-while D. All of the above Your score isThe average score is 37% LinkedIn Facebook VKontakte 0% Restart quiz By WordPress Quiz plugin Questions, Quiz