Python Set 2 Leave a Comment / By Anil / August 18, 2023 Welcome to your Python Set 2 Read this before do Start Exam: 1- There are 25 Questions and complete it within 30 Minutes. 2- For Best Experience download our Android App from Google Play Store. परीक्षा शुरू करने से पहले इसे पढ़ें: 1- 25 प्रश्न हैं और इसे 30 मिनट के भीतर पूरा करें। 2- बेहतरीन अनुभव के लिए Google Play Store से हमारा Android ऐप डाउनलोड करें। Download App Now 1. What will be the output of the following Python expression? round(4.576) 4.2 4.5 4.8 5 2. What will be the output of the following Python code? print("Hello {0[0]} and {0[1]}".format(('foo', 'bin'))) Hello foo and bin Hello (‘foo’, ‘bin’) and (‘foo’, ‘bin’) Hello foo None of these 3. Which of the following is the use of the function id() in python? The id function in python returns the identity of the objectc Every object does not have a unique id in Python Both A & B All of the above 4. Which of the following is true for variable names in Python? all private members must have leading and trailing underscores unlimited length underscore and ampersand are the only two special characters allowed none of the mentioned 5. What is Python code-compiled or interpreted? Neither compiled nor interpreted Only compiled Only interpreted The code is both compiled and interpreted 6. Which keyword is used for function in Python language? def Fun Define Function 7. " What will be the output of the following Python code snippet if x=1? x<<2" 2 4 6 8 8. " What are the values of the following Python expressions? 2**(3**2) (2**3)**2 2**3**2" 512, 512, 512 64, 64, 64 512, 64, 512 64, 512, 64 9. Which of the following is the use of function in python? One can’t create our own functions Functions are reusable pieces of programs Functions do not provide better modularity for applications All of the above 10. The process of pickling in Python includes ____________ conversion of a datatable into a list conversion of a byte stream into Python object hierarchy conversion of a list into a datatable conversion of a Python object hierarchy into byte stream 11. Which of the following functions can help us to find the version of python that we are currently working on? sys.version(0) sys.version sys.version(1) sys.version() 12. What is the order in which namespaces in Python looks for an identifier? Python first searches for the built-in namespace, then local and finally the global namespace Python searches for the global namespace, followed by the local namespace and finally the built-in namespace. First, the python searches for the built-in namespace, then the global namespace and then the local namespace Python first searches for local namespace, then global namespace and finally the built-in namespace 13. Which of the following is not a keyword used in Python language? Eval Assert Nonlocal Pass 14. "What will be the value of the following Python expression? 4 + 3 % 5" 3 6 7 9 15. Which of the following is a Python tuple? (1, 2, 3) {1, 2, 3} [1, 2, 3] Both B & C 16. "What will be the output of the following Python code? i = 1 while True: if i%3 == 0: break print(i) i + = 1" 23 34 123 None of these 17. Is Python case sensitive when dealing with identifiers? yes no yes & no All options right 18. What is the function of pickling in python? Conversion of list into database Conversion of a python object Conversion of database into list Conversion of byte stream into python object hierarchy 19. "What will be the output of the following Python code? def foo(): try: return 1 finally: return 2 k = foo() print(k)" 1 2 Both Options None of these 20. Which of the following is a feature of Python DocString? Docstrings can be accessed by the __doc__ attribute on objects It provides a convenient way of associating documentation with Python modules, functions, classes, and methods In Python all functions should have a docstring All of the mentioned 21. "What will be the output of the following Python code? x = [[0], [1]] print((' '.join(list(map(str, x))),))" [0] [1] (‘[0] [1]’,) (’01’) (’0’) 22. Who developed Python Programming Language? Guido van Rossum Wick van Rossum Niene Stom Rasmus Lerdorf 23. Python supports the creation of anonymous functions at runtime, using a construct called __________ anonymous lambda pi none of the mentioned 24. What is the order of precedence in python? Exponential, Parentheses, Division, Multiplication, Addition, Subtraction Parentheses, Exponential, Multiplication, Division, Subtraction, Addition Parentheses, Exponential, Multiplication, Division, Addition, Subtraction Exponential, Parentheses, Multiplication, Division, Addition, Subtraction 25. "What will be the output of the following Python code snippet? z=set('abc$de') 'a' in z" FALSE TRUE Both A & B None of these Related Posts (You May Also Read):