0% found this document useful (0 votes)
90 views7 pages

Sample Question CSE311

For cse 311 (NSU)

Uploaded by

Ahsanul Karim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
90 views7 pages

Sample Question CSE311

For cse 311 (NSU)

Uploaded by

Ahsanul Karim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

North South University, Dept.

of ECE
Sample Questions Final Exam
CSE311 SUM 2024

Q1:
The following relation schemas are given.
Teacher (Tid, name, designation, street, city, Mobile, email, tot_course_money)
Teach (course-id, Tid, semester, year, course-money)
Course (course-id, title, credit-hour)

a. For each course taught by a teacher, a course money is given to him. Write update
statement to update the tot_course_money of all teachers for 2022 and 2023.
b. Write SQL to find Tid, name, semester, year and course title for all teachers of ‘Dhaka’
city and credit hour is 3.
Q2:
The following relation schemas are given.
Student (Sid, name, street, thana, district. Mobile, email, CGPA, age, tot-cred)
Takes (course-id, Sid, semester, year, marks)
Course (course-id, title, credit-hour)
a. Write SQL to find the district, thana wise average marks of all courses with 3 credit-hour
taken by students in 2022 for average marks greater than 90.
b. Write SQL expression to find Sid, name, course-id and title of all students who have taken any
course (course-id) taken by Fatema in Spring 2022.
Q3:
a. Write down any two use of integrity constraint.
b. For the relation
Teacher (Tid, name, designation, street, city, Mobile, email, tot_course_money)
Teach (course-id, Tid, semester, year, course-money)

Create a view T-contact-24 showing all contact information of teachers of ‘Dhaka’ city in year
2024.
Q4:
There are two clerks user c1 and c2 and two managers m1 and m2. There are three roles:
clerk, manager and admin. Clerks can read and insert to person table, manager can read only
and admin can do everything on person table. Implement role based user management and
make m1 as administrator. Change administrator from m1 to m2

Q5:
a. Implement any three types of constraints on the relations below:
Student (Sid, name, street, city. Mobile, email, CGPA, age, tot-cred)
Takes (Sid, course_id, semester, year, grade)

Q6

The following relation schemas are given.

Student (Sid, name, street, thana, district. Mobile, email, CGPA, age, tot-cred)

Takes (course-id, Sid, semester, year, marks)

Course (course-id, title, credit-hour)

There are some student not taking any course and also some courses not taken by any
student. Write SQL to find all information of students and courses.

(Student ⟕ takes) ⟖ course

Q7:

Correct the following algebra

a.  dept_name=“Physics” and salary > 90,000 (instructor)


b.  A1,A2,A3 ….Ak (r)

d.  A, r.B, C, r.D, E ( r.B = s.B ˄ r.D = s.D (r ⋈ s)))


c.  ID, name, salary > 50000 (instructor)

Q8:
Correct the following SQL

SELECT s.Id, nmae


FROM student
WHERE cgpa = 4

SELECT s.Id, name, takes.c-id


FROM student, takes, course
WHERE cgpa = 4

Select name
from instructor
where name = '%dar%'

(select course_id, sec_id from section where sem = ‘Fall’ and year = 2009)
union
(select course_id from section where sem = ‘Spring’ and year = 2010)

select name
from instructor
where salary = null

select dept_name, avg (salary)


from instructor
having avg (salary) > 42000;

select distinct course_id


from section
where semester = ’Fall’ and year= 2009 and
course_id = (select course_id
from section
where semester = ’Spring’ and year= 2010);
Normalization
Q. 1: Given the relation
Book_Pub_Author(Title, PubId, AuId, Price, AuAddress)
The functional dependencies are given below.
1. Key à {Title, PubId, AuId}
2. {Title, PubId, AuID} à {Price}
3. {AuID} à {AuAddress}

Which normal form is the relation? Normalize it up to 3NF.

Q. 2: Given the relation

City_Population(City, Street, HouseNumber, HouseColor, CityPopulation)


1. key à {City, Street, HouseNumber}
2. {City, Street, HouseNumber} à {HouseColor}
3. {City} à {CityPopulation}

Which normal form is the relation? Normalize it up to 3NF.

Q.3. Given the relation R(A, B, C, D, E, F, G, H)

The functional dependencies are given as follows:

ABC à DEFGH
So ABC is the primary key. The other functional dependencies are given as follows:
BC àD
ABC à E
EàF
EàG

Q. Which normal form R is?

Q. Is the relation is 2NF? Why?

Q. Transform it into 2NF.

Q. Is R1 and R2 are in 3NF? Why?


Q. Transform R2 into 3NF.
Q4: The relation schema and the functional dependencies are given as follows:

R(A, B, C, D, E, F, G, H, I)
ABC  DEFGHI
B  G, B  H, D  E, D  I

Normalize up to 3NF.

User Management
Q5:

There three students users S1, S2 and S3, two teacher users T1 and T2 and one departmental
head (Dr. Sajjad) user.

The relational schema has been given as follows:

Student (Sid, name, street, city. Mobile, email, CGPA, age, tot-cred)
Enroll (course-id, Sid, semester, year, grade)
Course (course-id, title, credit-hour)
Teacher (Tid, name, designation, street, city, Mobile, email, salary, date-of-birth)
Offer (course-id, Tid, semester, year, remuneration)

S1, S2 and S3 can insert and update on student and enroll table, T1 and T2 can insert and update
on teacher and offer table and head can insert, delete and update to all tables.

Manage these users by


i. Granting individual privileges
ii. Creating and granting role (st for student, tch for teacher and hd for head).
iii. Give a comparison of these two methods.

Q6:

New head is Dr. Rashed. How can you authorize Dr. rashed by
i. Revoking and Granting individual privileges
ii. Revoking and granting role.

Integrity Constraint
Q7:
Given the schema
Student (Sid, name, street, city. Mobile, email, CGPA, age, tot-cred)
Enroll (course-id, Sid, semester, year, grade)

Define DDL to have the following integrity constraints:


i. The composite primary key will be (course-id, Sid, semester, year).
ii. Semester can be only ‘Spring’, ’Summer’ or ’Fall’.
iii. Year must be higher than 2017.
iv. Grade must be 0 to 4
v. Sid not present in student is not allowed in the enroll table.

View
Q8: create a view st-grade-22 with Sid, name, course-id, grade for year 2022
Q9: create a view st-list-22 with Sid, name for year 2022 using the view st-grade-22.

Student (Sid, name, street, city. Mobile, email, CGPA, age, tot-cred)
Enroll (course-id, Sid, semester, year, grade)
Course (course-id, title, credit-hour)
Teacher (Tid, name, designation, street, city, Mobile, email, salary, date-of-birth)
Offer (course-id, Tid, semester, year, remuneration)
There two student users S1 and S2 and one departmental head user. The relation schema has
been given as follows:
Student (Sid, name, street, city. Mobile, email, CGPA, age, tot-cred)
Enroll (course-id, Sid, semester, year, grade)
Students S1 and S2 can insert on student and insert and delete on enroll table and head can insert,
delete and update to all tables.
Manage these users by
i. Granting individual privileges
ii. Creating and granting role

You might also like