Assignment for Autumn Semester Session 2023 – 2024
Class/Batch MCA -2021
Course Code CS3503
Course Title Python Programming
Faculty In-Charge Dr. Chandrashekhar Azad
Email [Link]@[Link]
Questions:
1. XYZ Corporation is developing a web application that requires interaction with a
relational database. Outline the steps involved in establishing a database connection
using Python and integrating the database into the application.
2. Write codes for data frame for followings:
a) You are given a CSV file containing a large dataset. Write Python code using
Pandas to load the data into a Data Frame and provide an initial exploration of the
dataset, including summary statistics and the first few rows.
b) Your dataset contains missing values and outliers. Describe the techniques you
would use to handle missing data and outliers in a DataFrame using Pandas.
c) Given a DataFrame with multiple columns, write Python code to filter rows based
on a specific condition and select a subset of columns.
d) You have a DataFrame with sales data, and you need to calculate the total sales for
each product category. Provide Python code using Pandas to group the data by
category and calculate the total sales.
e) Explain the concept of merging or joining DataFrames. Provide a scenario and
write Python code to merge two DataFrames based on a common column.
f) Explain how you would handle categorical variables in a DataFrame. Provide
Python code using Pandas to encode categorical variables or create dummy
variables.
3. Discuss the importance of thread synchronization. Provide examples of situations
where race conditions might occur and how you would address them using
synchronization techniques in Python.
4. Explain the concept of daemon threads in Python. Provide an example of when you
might want to use daemon threads and how to create them using the threading
module.
5. Create a Python function that checks the strength of a password based on certain
criteria using regular expressions. Discuss the criteria you consider for a strong
password.
6.
7. Create a Python function that checks the strength of a password based on certain
criteria using regular expressions. Discuss the criteria you consider for a strong
password.
8. Create a Python function that checks the strength of a password based on certain
criteria using regular expressions. Discuss the criteria you consider for a strong
password.
9. Your function receives input from a user, and you want to handle unexpected input
gracefully. Write Python code using try-except blocks to validate user input and
provide informative error messages.
10. You are developing a geometry library in Python. Create an abstract class named
Shape with an abstract method area(). Provide an example of a concrete class Circle
that extends the abstract class and implements the area() method.
11. Design a class hierarchy for a zoo management system. Create a base class Animal
and two subclasses Mammal and Bird. Include common attributes and methods, and
demonstrate how inheritance is used.
12. Your project involves a class hierarchy for a game. Demonstrate the use of the super()
function in Python to call a method from the base class within a derived class.
13. You have a list of names, and you want to create a dictionary where the keys are
names, and the values are the length of each name. Write Python code using
dictionary comprehension to achieve this.
14. Discuss the performance characteristics of lists and tuples in Python. In what
scenarios would you prefer to use a list, and in what scenarios would you prefer to use
a tuple?
15. Explain the concept of immutability in tuples. Provide an example scenario where
using a tuple (rather than a list) is advantageous.
Notes:
Submission deadline: 30/11/2023
Must be Handwritten and submit in NIT Files.