Python Revision - VII
Python Revision - VII
Questions and Answers
1. What is Python?
Ans: Python is a high-level programming language known for its readability and ease of use.
Ans: Python is a high-level programming language known for its readability and ease of use.
2. Where is Python used?
Ans: Python is widely used in fields such as web development, data analysis, artificial intelligence, and scientific computing.
Ans: Python is widely used in fields such as web development, data analysis, artificial intelligence, and scientific computing.
3. Why should we learn Python
Ans: Python is easy to learn, versatile, and applicable in various domains.
Ans: Python is easy to learn, versatile, and applicable in various domains.
4. Who created Python and when
Ans: Python was created by Guido van Rossum and first released in 1991.
Ans: Python was created by Guido van Rossum and first released in 1991.
5. What are three numeric types in Python.
Ans: Data types in Python include int for integers, float for decimals, str for strings, list for ordered collections, and dict for key-value pairs.
Ans: Data types in Python include int for integers, float for decimals, str for strings, list for ordered collections, and dict for key-value pairs.
6. What are variables in Python?
Ans: Variables in Python store data values and can be assigned without a specified type.
Ans: Variables in Python store data values and can be assigned without a specified type.
7. What are some common data types in Python?
Ans: Common data types include int, float, str, list, and dict.
Ans: Common data types include int, float, str, list, and dict.
8. What are strings?
Ans: Strings are sequences of characters enclosed in quotes, representing text.
Ans: Strings are sequences of characters enclosed in quotes, representing text.
9. Name the 2 types of operations to work with strings.
The two types of operations to work with strings are concatenation (joining strings together) and slicing (extracting a portion of a string).
The two types of operations to work with strings are concatenation (joining strings together) and slicing (extracting a portion of a string).
10. What are three numeric types in Python?
Ans: The numeric types in Python are int, float, and complex.
Ans: The numeric types in Python are int, float, and complex.
11. What are operators in Python?
Ans: Operators perform operations on variables and values, such as arithmetic operators (+, -, *, /) and comparison operators (==, !=, >, <).
Ans: Operators perform operations on variables and values, such as arithmetic operators (+, -, *, /) and comparison operators (==, !=, >, <).
12. What is a pre-defined function? Give an example.
Ans: Pre-defined functions are built-in functions like print(), which output text to the console.
Ans: Pre-defined functions are built-in functions like print(), which output text to the console.
13. How do you call a function in Python?
Ans: To call a function in Python, you use its name followed by parentheses, e.g., function_name().
Ans: To call a function in Python, you use its name followed by parentheses, e.g., function_name().
True or False Questions
Fill in the Blanks
Match the Following
Term | Definition |
---|---|
1. Python | A) A high-level programming language |
2. int | B) Represents whole numbers |
3. str | C) Represents a sequence of characters |
4. float | D) Represents decimal numbers |
5. def | E) Used to define a function |
6. list | F) A mutable sequence of items |
7. dict | G) Stores data in key-value pairs |
8. len() | H) Returns the length of an object |
9. return | I) Used to exit a function and return a value |
10. tuple | J) An immutable sequence of items |
Comments
Post a Comment