0% found this document useful (0 votes)
19 views1 page

Python Qna

Uploaded by

test.shakeb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views1 page

Python Qna

Uploaded by

test.shakeb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Python Q&A;

Q1: What are Python’s key features?


A: Interpreted, dynamically typed, object-oriented, extensive libraries, easy syntax, portable.

Q2: Difference between list and tuple?


A: List is mutable (can be changed), Tuple is immutable (cannot be changed).

Q3: What is PEP 8?


A: Python Enhancement Proposal 8 – guidelines for writing clean, readable Python code.

Q4: Explain Python’s memory management.


A: Managed by Python Memory Manager using reference counting + garbage collection.

Q5: What is a Python decorator?


A: A function that modifies another function without changing its code, using '@'. Example:
@staticmethod.

Q6: Difference between shallow copy and deep copy?


A: Shallow copy copies references, changes affect original. Deep copy creates independent copy.

Q7: How are exceptions handled in Python?


A: Using try, except, else, finally blocks.

Q8: What are Python generators?


A: Functions using 'yield' to return values one at a time, memory efficient.

Q9: How to install external libraries?


A: Using pip -> pip install library_name

Q10: Write a Python program to reverse a string.


A: s = 'hello' print(s[::-1]) # Output: 'olleh'

You might also like