1. What is Python in 50 to 60 words?
Python is a high-level, interpreted programming language that is easy to learn and use.
It has simple and readable syntax, which makes it popular among beginners and professionals.
Python supports object-oriented programming and is used in web development, data science,
artificial intelligence, automation, and software development. It is platform independent
and has a large standard library.
2. What is the features of Python? (Five points)
1) Easy to Learn and Use
2) Interpreted Language
3) Platform Independent
4) Object-Oriented
5) Large Standard Library
3. What is a token and what are its types?
A token is the smallest individual unit of a program in Python.
Types: Keywords, Identifiers, Literals, Operators, Punctuators.
4. What is the difference between a runtime error and a syntax error?
Syntax Error: Occurs when Python grammar rules are not followed and prevents execution.
Runtime Error: Occurs during execution and stops the program while running.
5. What is the difference between an error and an exception?
Error: Serious problem in program, usually stops execution.
Exception: Runtime problem that can be handled using try and except.
6. What is list?
A list is an ordered, mutable collection of elements written inside square brackets [].
7. What is the difference between pop() and remove()?
pop(): Removes element by index and returns it.
remove(): Removes element by value.
8. What is the difference between append() and extend()?
append(): Adds one element to the end of list.
extend(): Adds multiple elements from another iterable.
9. Why are lists known as mutable data types?
Because their elements can be changed after creation without creating a new list.
10. What is dictionary?
A dictionary is a mutable collection of key-value pairs written inside {}.
11. What is the difference between list and dictionary?
List: Ordered collection accessed by index.
Dictionary: Key-value pairs accessed by keys.
12. How is clear() different from del?
clear(): Removes all elements but keeps the list.
del: Deletes element or entire variable.