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

Python Important Theory Questions

The document outlines an introduction to Python, covering essential topics such as data types, control flow statements, strings, lists, tuples, dictionaries, file handling, and Python packages like NumPy and Pandas. It includes both short and long answer questions designed to test understanding of Python concepts, syntax, and functionalities. Each unit provides a comprehensive overview of key programming principles and practices in Python.

Uploaded by

silaniwal
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 views5 pages

Python Important Theory Questions

The document outlines an introduction to Python, covering essential topics such as data types, control flow statements, strings, lists, tuples, dictionaries, file handling, and Python packages like NumPy and Pandas. It includes both short and long answer questions designed to test understanding of Python concepts, syntax, and functionalities. Each unit provides a comprehensive overview of key programming principles and practices in Python.

Uploaded by

silaniwal
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

UNIT 1 — Introduction to Python (Theory

Questions)

Short Answer
1. What is Python? Mention its features.
2. Why is Python called a high-level and interpreted language?
3. What is an identifier? Write the rules of naming identifiers.
4. What are variables? How is Python dynamically typed?
5. What are keywords? Give any five examples.
6. What is indentation in Python? Why is it important?
7. What is the difference between mutable and immutable data types?
8. Define module. What are built-in and external modules?
9. Explain the working of logical operators with an example.
[Link] is PIP? Write its basic commands.
[Link] is the purpose of the id() function?

Long Answer
1. Explain Python data types with examples.
2. Recall how Python handles type conversion and differentiate between
implicit and explicit typecasting with examples.
3. Describe variable scope (local vs global) with examples.
4. Explain mutable and immutable objects with a suitable program.
5. What are modules? Explain types of modules with examples.
6. Discuss indentation errors in Python with examples.
UNIT 2 — Control Flow Statements
(Theory Questions)

Short Answer
1. What is a statement? Explain sequence, selection, and iteration.
2. What is the purpose of the if statement? Give syntax.
3. What is an if-elif-else ladder?
4. What are nested if statements? Give an example.
5. Explain while loop with syntax.
6. Explain for loop with range() function.
7. What is the difference between break and continue?
8. What is the pass statement? When is it used?
9. Define a Compound Statement with an example.
[Link] is the difference between entry-controlled and exit-controlled
loops?
[Link] flow control with examples.

Long Answer
1. Explain all decision-making statements in Python with examples.
2. Describe operator precedence, Python indentation, and type conversion
in Python with suitable examples.
3. Explain while and for loop with flowcharts.
4. Describe loop control statements (break, continue, pass) with examples.
5. Explain nested-if with real-world applications.
6. Describe the working of range() with different examples.
UNIT 3 — Strings, Lists, Tuples,
Dictionaries (Theory Questions)
(String traversal, slicing, methods, ASCII, list features, list operations)
Short Answer
1. What is a string in Python? How is it stored?
2. Explain string indexing and slicing with examples.
3. What is string immutability?
4. What are string operators? Explain any two.
5. What is the purpose of the ord() and chr() functions?
6. What is a list? Mention its features.
7. What is list mutability?
8. Illustrate string indexing using both positive and negative indices.
9. What is list slicing?
[Link] is a dictionary? How is it different from a list?
[Link] is a tuple? How is it different from a list?
Long Answer
1. Explain different ways to traverse a string.
2. Discuss important string functions (capitalize, count, find, replace, split,
join).
3. Explain list operations: concatenation, replication, traversal, slicing.
4. Compare list, tuple, and dictionary.
5. Explain ASCII value comparison and lexicographical ordering in strings.
UNIT 4 — File Handling (Theory
Questions)
Short Answer
1. What is a file? Why is file handling needed?
2. Explain different file modes (r, w, a, r+, etc.).
3. What is the difference between read(), readline(), and readlines()?
4. What is the purpose of the close() function?
5. What is a file pointer? Explain seek() and tell().
6. Why is with open() recommended?
7. What is writelines()?
8. List the advantages of using the with statement in Python.
9. What is the difference between text mode and binary mode?
[Link] is an exception? Give examples of file-related errors.
[Link] happens when you try to open a non-existent file in read mode?

Long Answer
1. Explain file handling steps in Python with syntax and examples.
2. Explain all file opening modes in detail.
3. List all text-file reading methods (read, readline, readlines) and compare
their usage with suitable examples.
4. Describe how to read and write files in Python using all methods.
5. Explain file pointer manipulation with seek() and tell().
6. Explain exception handling in file operations.
UNIT 5 — Python Packages: NumPy,
Pandas, Matplotlib (Theory Questions)

Short Answer
1. What is a Python package? How is it different from a module?
2. What is NumPy? Why is it faster than Python lists?
3. What is a NumPy array? Explain its features.
4. What is the difference between Python lists and NumPy arrays?
5. What is array broadcasting?
6. Explain ndim, shape, size, and dtype attributes.
7. What is array slicing?
8. What is Pandas? Why is it used?
9. Differentiate between Series and DataFrame.
[Link] is the use of loc and iloc?

Long Answer
1. Explain NumPy arrays and their advantages over Python lists.
2. Describe the structure and purpose of Pandas Series and DataFrames
and explain their role in data analysis with suitable examples.
3. Describe array operations (mathematical, slicing, reshaping, splitting).
4. Explain Pandas Series and DataFrames with examples.
5. Explain reading and writing data with Pandas.
6. Describe NumPy arrays and discuss how they differ from Python lists in
terms of speed, memory, and functionality with examples.
7. Discuss the role of Python scientific libraries (NumPy, Pandas,
Matplotlib).

You might also like