0% found this document useful (0 votes)
3 views3 pages

Python Programming Interview QA BSC

The document provides an overview of Python programming, including its definition, key features, and data types. It explains the differences between lists and tuples, functions, control statements, exception handling, dictionaries, and lambda functions. Each concept is accompanied by examples for clarity.

Uploaded by

jasinjoji6
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)
3 views3 pages

Python Programming Interview QA BSC

The document provides an overview of Python programming, including its definition, key features, and data types. It explains the differences between lists and tuples, functions, control statements, exception handling, dictionaries, and lambda functions. Each concept is accompanied by examples for clarity.

Uploaded by

jasinjoji6
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/ 3

Python Programming Interview Questions and Answers (BSc Computer Science)

1. What is Python?

Python is a high-level, interpreted, and general-purpose programming language. It is known for its simple

syntax, readability, and wide range of libraries.

2. What are Python's key features?

- Easy to learn and read

- Interpreted and dynamically typed

- Supports multiple programming paradigms

- Extensive standard libraries

- Platform-independent

3. What are Python data types?

- Numeric: int, float, complex

- Sequence: list, tuple, range

- Text: str

- Set: set, frozenset

- Mapping: dict

- Boolean: bool

- None: NoneType

4. What is the difference between a list and a tuple?

List:

- Mutable

- Defined with []

- Slower
Python Programming Interview Questions and Answers (BSc Computer Science)

Tuple:

- Immutable

- Defined with ()

- Faster

5. What is a function in Python?

A function is a block of reusable code defined using 'def'.

Example:

def greet(name):

return f"Hello, {name}"

6. What is the difference between 'is' and '==' in Python?

- '==' checks value equality

- 'is' checks identity (memory location)

7. What are Python's control statements?

- Conditional: if, elif, else

- Loops: for, while

- Loop control: break, continue, pass

8. How does exception handling work in Python?

Handled using try, except, else, and finally.


Python Programming Interview Questions and Answers (BSc Computer Science)

Example:

try:

x=1/0

except ZeroDivisionError:

print("Cannot divide by zero")

9. What is a dictionary in Python?

A dictionary is a collection of key-value pairs.

Example:

student = {"name": "Alice", "age": 20}

10. What is a lambda function?

A lambda function is an anonymous function defined using 'lambda'.

Example:

square = lambda x: x * x

You might also like