Set A
Q: 1) Consider the following entities and their relationships
Emp (emp_no,emp_name,address,phone,salary)
Dept (dept_no,dept_name,location)
Emp-Dept are related with one-many relationship Create a RDB in 3NF for the above and solve following Using above database write a PHP script which will print a salary statement in the format given below, for a given department. (Accept department name from the user). Deparment Name : _________________
Q: 2) Consider the following entities and their relationships
Doctor (doc_no, doc_name, address, city, area)
Hospital (hosp_no, hosp_name, hosp_city)
Doctor and Hospital are related with many-many relationship. Create a RDB in 3 NF for the above and solve following Using above database, write a PHP script which accepts hospital name and print information about doctors visiting / working in that hospital in tabular format.
Set B
Q: 1) Considerer the following entities and their relationships project(pno integer, p_name char(30), ptype char(20),duration integer) employee (eno integer, e_name char (20), qualification char (15), joindate date) The relationship between project - employee: M-M, with descriptive attributes as start_date (date), no_of_hours_worked (integer). Using above database write a script in PHP to accept a project name from user and display information of employees working on the project.
Q: 2) Consider the following entities and their relationships student (sno integer, s_name char(30), s_class char(10), s_addr char(50)) teacher (tno integer, t_name char (20), qualification char (15),experience integer) The relationship between student-teacher: m-m with descriptive attribute subject.
Using above database write a script in PHP to accept a teacher name from user and display the names of students along with subjects to whom teacher is teaching
Set C
Q: 1) Consider the following entities and their relationships Movie (movie_no, movie_name, release_year) Actor (actor_no, name) Relationship between movie and actor is many – many with attribute rate in Rs. Create a RDB in 3 NF for the above and solve following Using above database, write PHP scripts for the following:(Hint: Create HTML form having three radio buttons)
a) Accept actor name and display the names of the movies in which he has acted.
b) Insert new movie information.
c) Update the release year of a movie. (Accept the movie name from user)
Q: 2) Considerer the following entities and their relationships
Student (Stud_id,name,class)
Competition (c_no,c_name,type)
Relationship between student and competition is many-many with attribute rank and year. Create a RDB in 3NF for the above and solve the following. Using above database write a script in PHP to accept a competition name from user and display information of student who has secured 1 st rank in that competition.
Q: 1) Consider the following entities and their relationships
Emp (emp_no,emp_name,address,phone,salary)
Dept (dept_no,dept_name,location)
Emp-Dept are related with one-many relationship Create a RDB in 3NF for the above and solve following Using above database write a PHP script which will print a salary statement in the format given below, for a given department. (Accept department name from the user). Deparment Name : _________________
Q: 2) Consider the following entities and their relationships
Doctor (doc_no, doc_name, address, city, area)
Hospital (hosp_no, hosp_name, hosp_city)
Doctor and Hospital are related with many-many relationship. Create a RDB in 3 NF for the above and solve following Using above database, write a PHP script which accepts hospital name and print information about doctors visiting / working in that hospital in tabular format.
Set B
Q: 1) Considerer the following entities and their relationships project(pno integer, p_name char(30), ptype char(20),duration integer) employee (eno integer, e_name char (20), qualification char (15), joindate date) The relationship between project - employee: M-M, with descriptive attributes as start_date (date), no_of_hours_worked (integer). Using above database write a script in PHP to accept a project name from user and display information of employees working on the project.
Q: 2) Consider the following entities and their relationships student (sno integer, s_name char(30), s_class char(10), s_addr char(50)) teacher (tno integer, t_name char (20), qualification char (15),experience integer) The relationship between student-teacher: m-m with descriptive attribute subject.
Using above database write a script in PHP to accept a teacher name from user and display the names of students along with subjects to whom teacher is teaching
Set C
Q: 1) Consider the following entities and their relationships Movie (movie_no, movie_name, release_year) Actor (actor_no, name) Relationship between movie and actor is many – many with attribute rate in Rs. Create a RDB in 3 NF for the above and solve following Using above database, write PHP scripts for the following:(Hint: Create HTML form having three radio buttons)
a) Accept actor name and display the names of the movies in which he has acted.
b) Insert new movie information.
c) Update the release year of a movie. (Accept the movie name from user)
Q: 2) Considerer the following entities and their relationships
Student (Stud_id,name,class)
Competition (c_no,c_name,type)
Relationship between student and competition is many-many with attribute rank and year. Create a RDB in 3NF for the above and solve the following. Using above database write a script in PHP to accept a competition name from user and display information of student who has secured 1 st rank in that competition.
12 Comments
Considerer the following entities and their relationships project(pno integer, p_name
ReplyDeletechar(30), ptype char(20),duration integer), employee (eno integer, e_name char (20),
qualification char (15), joindate date) .The relationship between project - employee:
M-M, with descriptive attributes as start_date (date), no_of_hours_worked (integer).
Using above database write a script in PHP to accept a project name from user and
display information of employees working on the project.
2
ReplyDeleteSet b
ReplyDelete2
Set b 1st question
ReplyDeleteSet b
ReplyDelete1questuon
good blog to clear basic concept and questions
ReplyDeleteimport numpy as np
ReplyDeleteimport pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
# Create sales dataset
data = {
'ID': range(1, 501),
'TV': np.random.randint(0, 100, 500),
'Radio': np.random.randint(0, 100, 500),
'Newspaper': np.random.randint(0, 100, 500),
'Sales': np.random.randint(50, 500, 500)
}
sales_df = pd.DataFrame(data)
# Identify independent and target variables
X = sales_df[['TV', 'Radio', 'Newspaper']]
y = sales_df['Sales']
# Split the variables into training and testing sets
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3,
random_state=42)
# Print the shapes of training and testing sets
print("Training set shape:", X_train.shape, y_train.shape)
print("Testing set shape:", X_test.shape, y_test.shape)
# Build simple linear regression model
model = LinearRegression()
model.fit(X_train, y_train)
# Print coefficients
print("Coefficients:", model.coef_)
import pandas as pd
ReplyDeleteimport numpy as np
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
# Create the dataset
np.random.seed(0)
data = {
'ID': np.arange(1, 501),
'flat': np.random.randint(1, 6, 500),
'houses': np.random.randint(1, 6, 500),
'purchases': np.random.randint(100000, 1000000, 500)
}
df = pd.DataFrame(data)
# Split the dataset into independent variables (X) and target variable (y)
X = df[['flat', 'houses']]
y = df['purchases']
# Split the data into training and testing sets
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2,
random_state=42)
# Print the training and testing sets
print("Training set:")
print(X_train.head())
print(y_train.head())
print("\nTesting set:")
print(X_test.head())
print(y_test.head())
# Build a simple linear regression model
model = LinearRegression()
model.fit(X_train, y_train)
# Print the coefficients
print("\nCoefficients:", model.coef_)
# Print the intercept
print("Intercept:", model.intercept_)
s.data, columns=iris.feature_names)ecies']
ReplyDeleteimport pandas as pd
ReplyDeletefrom sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler,LabelEncoder
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score,classification_report
# Sample data for User dataset
data = {
'User ID': [1, 2, 3, 4, 5],
'Gender': ['Male', 'Female', 'Male', 'Female', 'Male'],
'Age': [25, 30, 35, 40, 45],
EstimatedSalary': [50000, 60000, 70000, 80000, 90000],
'Purchased': [0, 1, 0, 1, 0] # Assuming 0 means not purchased, and 1
means purchased
}
# Create DataFrame
user_df = pd.DataFrame(data)
# Display the DataFrame
print(user_df)
le = LabelEncoder()
user_df['Gender'] = le.fit_transform(user_df['Gender'])
# Split data into features (X) and target (y)
X = user_df.drop(columns=['Purchased'])
y = user_df['Purchased']
# Split data into training and testing sets
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2,
random_state=42)
# Scale numerical features
scaler = StandardScaler()
X_train_scaled = scaler.fit_transform(X_train)
X_test_scaled = scaler.transform(X_test)
# Build logistic regression model
model = LogisticRegression()
model.fit(X_train_scaled, y_train)
# Predict on the testing data
y_pred = model.predict(X_test_scaled)
# Evaluate model
accuracy = accuracy_score(y_test, y_pred)
print("Accuracy:", accuracy)
print(classification_report(y_test, y_pred))
Set B Q.2.
import pandas as pd
from sklearn.datasets import load_iris
from sklearn.model_selection import train_t
import pandas as pd
ReplyDeletefrom sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score
# Load iris dataset
iris = load_iris()
iris_df = pd.DataFrame(data=iris.data, columns=iris.feature_names)
iris_df['species'] = iris.target
species_names = {0: 'setosa', 1: 'versicolor', 2: 'virginica'}
for species in range(3):
species_data = iris_df[iris_df['species'] == species]
print(f"Species: {species_names[species]}")
print(species_data.describe())
# Prepare data for logistic regression
X = iris.data
y = iris.target
# Split data into train and test sets
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2,
random_state=42)
# Initialize logistic regression model
model = LogisticRegression(max_iter=1000)
# Fit the model
model.fit(X_train, y_train)
# Predictions
y_pred = model.predict(X_test)
# Calculate accuracy
accuracy = accuracy_score(y_test, y_pred)
print(f"Accuracy of the model: {accuracy}")
Set B Q.1.
# Import necessary libraries
import pandas as pd
from sklearn.model_selection import train_test_split
import pandas as pd
ReplyDeletefrom sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_error
# Load the dataset
fish_data = pd.read_csv("Fish.csv")
# Explore the dataset
print(fish_data.head())
# Preprocessing: No missing values found, no categorical variables
# Split the dataset into features (X) and target variable (y)
X = fish_data[['Length1', 'Length2', 'Length3', 'Height', 'Width']]
y = fish_data['Weight']
# Split the data into training and testing sets
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2,
random_state=42)
# Train the linear regression model
model = LinearRegression()
model.fit(X_train, y_train)
# Evaluate the model
train_rmse = mean_squared_error(y_train, model.predict(X_train),
squared=False)
test_rmse = mean_squared_error(y_test, model.predict(X_test), squared=False)
print(f"Training RMSE: {train_rmse}")
print(f"Testing RMSE: {test_rmse}")
# Make predictions
# Example: Predict the weight of a fish with the given features
new_fish_features = [[25.4, 26.3, 29.1, 7.2, 4.0]] # Example features
predicted_weight = model.predict(new_fish_features)
print(f"Predicted weight of the fish: {predicted_weight[0]}")