UNIT 1
Questions
1. Define Python and list its main features.
2. What are the basic data types in Python?
3. Write the symbols for arithmetic operators in Python.
4. Explain the importance of indentation in Python.
5. Differentiate between int, float, str, and bool data types.
6. Explain type casting in Python with examples.
7. Write a Python program to take user input for name and age, and print a greeting
message.
8. Perform arithmetic operations on two numbers input by the user.
9. Demonstrate using relational and logical operators in a program.
10. Identify and correct errors in the following Python code:
python<br>if x = 5<br>print("Hello")<br>
11. Compare Python with any other programming language in terms of syntax
simplicity and readability.
12. Design a simple calculator program that performs addition, subtraction,
multiplication, and division based on user choice.
UNIT 2
Questions
1. List the types of loops available in Python.
2. What is a lambda function?
3. Define recursion.
4. Explain the difference between if-else and if-elif-else statements.
5. Describe the use of break, continue, and pass in loops.
6. Explain the types of function arguments with examples.
7. Write a program to print all even numbers from 1 to 50 using a for loop.
8. Create a function that calculates the factorial of a number using
Questions
recursion.
9. Use a lambda function to square all numbers in a given list.
10. Given a piece of code with nested loops, trace the output and explain
the flow.
11. Analyze a function and determine the output when multiple types of
arguments are passed.
12. Compare the use of for loop vs while loop in terms of efficiency and
readability.
13. Design a menu-driven program using functions and loops that allows
the user to perform multiple arithmetic operations repeatedly.
UNIT 3
Questions
1. List common string methods in Python.
2. Define list, tuple, set, and dictionary.
3. What is immutability in Python?
4. Explain the difference between a list and a tuple.
5. Describe the differences between sets and lists.
6. Explain the role of keys and values in dictionaries.
7. Write a program to count vowels in a string.
8. Create a list of numbers and use list comprehension to generate a
new list of their squares.
9. Write a program to remove duplicate elements from a list using sets.
10. Access and display all keys and values from a dictionary.
11. Compare slicing a string vs slicing a list and explain the outputs.
12. Analyze a list comprehension expression and explain how it works.
Questions
13. Decide whether a tuple or list is more appropriate for storing a
sequence of constant data and justify.
14. Design a program that accepts a sentence from the user and
generates a dictionary of word frequencies.
UNIT 4
Questions
1. List the file modes available in Python.
2. Name common built-in exceptions.
3. Explain the difference between read(), write(), and append() modes.
4. Describe the purpose of try, except, finally, and raise.
5. Write a program to read content from a file and display it.
6. Write a program to append a line to an existing file.
7. Handle a division by zero exception using try-except.
8. Analyze a code snippet that reads a file line by line and explain why
errors may occur if the file does not exist.
9. Compare using with open() vs manually opening and closing files.
10. Design a program that reads a CSV file, filters rows based on a
condition, and writes the filtered data to a new file while handling
possible exceptions.
OOP Basics
Questions
1. Define class and object.
2. What is a constructor in Python?
Questions
3. Explain instance variables and methods.
4. Describe inheritance, encapsulation, and polymorphism in Python.
5. Create a class Student with attributes name and roll_no and a
method to display them.
6. Implement inheritance: create a class Teacher that inherits from a
class Person.
7. Given a class with multiple methods, analyze which methods can
be overridden and which cannot.
8. Justify the need for encapsulation in a banking system program.
9. Design a class hierarchy for a library system using OOP concepts,
implementing at least inheritance and polymorphism.
6️ Python Libraries and GUI Applications
Tkinter
Questions
1. List commonly used Tkinter widgets.
2. Explain event handling in Tkinter.
3. Create a simple Tkinter window with a label and a button that prints
a message when clicked.
4. Analyze the layout of multiple widgets using pack(), grid(), and
place().
5. Evaluate the advantages of using Tkinter over console-based
applications.
6. Design a small GUI calculator using Tkinter with buttons for
numbers and operations.
Questions
Pandas
Questions
1. Define Series and DataFrame.
2. Explain reading CSV files using Pandas.
3. Create a DataFrame and filter rows where a column value is greater
than 50.
4. Analyze missing values in a DataFrame and explain how to handle
them.
5. Compare .loc[] and .iloc[] for data selection.
6. Design a program to read a CSV, calculate average of a column, and
save the results to a new file.
NumPy
Questions
1. Define a NumPy array.
2. Explain basic array operations like addition, multiplication.
3. Create a 2x3 NumPy array and perform element-wise addition with
another array.
4. Analyze the difference between Python lists and NumPy arrays.
5. Evaluate why NumPy arrays are preferred for numerical
computations.
6. Design a program that generates a random 5x5 matrix and
computes row-wise sum.
Matplotlib
Questions
Questions
1. List the types of plots available in Matplotlib.
2. Explain the difference between a line plot and a bar chart.
3. Plot a line graph for a given set of x and y values.
4. Create a histogram of exam scores.
5. Analyze a plot and identify missing labels, title, or legends.
6. Evaluate how customizing colors and markers can improve data
visualization.
7. Design a combined line and bar plot to visualize sales data over
months.