0% found this document useful (0 votes)
5 views

Database Administration and Object-Oriented Programming CA

Uploaded by

yinfadivan82
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Database Administration and Object-Oriented Programming CA

Uploaded by

yinfadivan82
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Practical Examination: Database Administration and Object-Oriented

Programming
Total Marks: 100
Duration: 2 Hours
SECTION A: Database Administration (50 Marks)
Task 1: Create a Database (2 Marks)
• Create a new database named SchoolManagement.
Task 2: Create Tables (25 Marks)
• Create the following two tables with specified attributes and constraints:
1. Students
• StudentID (Primary Key, Integer, Not Null)
• StudentName (Varchar(100), Not Null)
• Age (Integer, Not Null)
• ClassID (Integer, Foreign Key, Not Null)
2. Classes
• ClassID (Primary Key, Integer, Not Null)
• ClassName (Varchar(100), Not Null)
• RoomNumber (Varchar(10))
• Establish a relationship between Students and Classes using ClassID as a
foreign key.
Task 3: Populate Tables with Data (10 Marks)
• Insert the first 10 records into each table, ensuring that the data is consistent with
the foreign key constraints.
Task 4: Queries (13 Marks)
• Write and execute the following SQL queries:
1. Retrieve all students who are older than 12 years.
2. List the class name and room number along with the names of all students
in each class.
3. Find the class with the most students and display the class name and the
number of students.
Classes Table Data

ClassID ClassName RoomNumber

1 Mathematics 101A

2 English 102B

3 History 103C

4 Science 104D

5 Physical Education 105E

6 Art 106F

7 Music 107G

8 Computing 108H

9 Geography 109I

10 Literature 110J
Students Table Data

StudentID StudentName Age ClassID

1 Alice Johnson 14 1

2 Bob Smith 13 2

3 Charlie Daniels 15 3

4 David Wilson 12 4

5 Emily Thompson 14 5

6 Fiona Graham 13 6

7 George King 15 7

8 Hannah Lee 12 8

9 Ian Morris 14 9

10 Jane Perry 13 10

11 Kyle Ray 12 1

12 Laura Newman 14 2

SECTION B: Object-Oriented Programming (50 Marks)


Task 1: Define Classes and Objects (20 Marks)
• Create a Person class with the following properties and methods:
• Properties: name, age
• A constructor that initializes the name and age properties.
• A method display() that prints the name and age of the person.
• Create a Student class that inherits from the Person class and adds:
• A property studentID.
• A constructor that initializes all properties (use super() for name and age).
• Override the display() method to include studentID.
Task 2: Implement Inheritance (10 Marks)
• Create an Employee class derived from Person, including:
• A property employeeID.
• A constructor that initializes all properties.
• A method to display all details of the employee.
Task 3: Object Creation and Method Invocation (10 Marks)
• Instantiate two Student objects and one Employee object, supplying appropriate
values for each.
• Call the display() method on all created objects to demonstrate functionality.
Task 4: Conceptual Questions (10 Marks)
• Answer the following questions:
1. What is polymorphism? Provide a code example demonstrating
polymorphism in the context of the display() method.
2. Explain the difference between overloading and overriding with examples.

Instructions:
• Write clear and executable SQL commands and code.
• Comment your code to explain your logic where necessary.
• Ensure your solutions are efficient and adhere to standard practices.

You might also like