IK Gujral Punjab Technical University, Kapurthala
B.Tech - Computer Science & Engineering (AI & ML)
Course Code: BTAIML 501-20
Course Title: Programming in Python
Document: Important Short & Long Answer Questions
UNIT 1: Introduction to Python Programming Language
Short Answer Questions:
1. What are the main features of Python?
2. Define indentation in Python and its significance.
3. List any three major applications of Python.
4. What is a Python identifier?
5. Explain the difference between compiled and interpreted languages.
Long Answer Questions:
1. Explain the history and origin of Python along with its key features and limitations.
2. Describe the process of installing Python and setting environment variables in detail.
3. Write and explain the structure of a simple Python program with an example.
UNIT 2: Control Structures and Data Types
Short Answer Questions:
1. What is the difference between while and for loops in Python?
2. Define Python control statements with examples.
3. What is a tuple in Python?
4. List any two methods of Python strings.
5. Explain the use of decision-making statements in Python.
Long Answer Questions:
1. Explain the various decision-making statements in Python with suitable examples.
2. Describe Python data types in detail with examples for each.
3. Discuss Python loops and control flow with syntax and examples.
UNIT 3: Functions and Modules
Short Answer Questions:
1. Define a function in Python.
2. What is recursion?
3. Explain the difference between pass-by-value and pass-by-reference.
4. What is a Python module?
5. List any two built-in Python functions.
Long Answer Questions:
1. Explain different types of Python functions with examples.
2. Discuss the concept of modules and packages in Python with examples.
3. Describe the advantages and working of user-defined functions in Python.
UNIT 4: Exception Handling, File Management, and OOP
Short Answer Questions:
1. What is an exception in Python?
2. Define try, except, and finally blocks.
3. What are file modes in Python?
4. What is an object in Python?
5. Explain the concept of garbage collection.
Long Answer Questions:
1. Explain the process of exception handling in Python with suitable examples.
2. Describe file handling operations in Python including open(), read(), write(), and close().
3. Discuss the concept of OOP in Python and explain classes and objects with examples.
UNIT 5: Iterators, Generators, and Collections
Short Answer Questions:
1. What is an iterator in Python?
2. Define a generator with an example.
3. What is the use of collections in Python?
4. Explain any two collection data types in Python.
5. What is the purpose of the datetime module?
Long Answer Questions:
1. Explain iterators and generators in Python with examples.
2. Discuss the various collection modules available in Python and their uses.
3. Describe the working and use cases of Python’s datetime module.