Table of contents | |
Multiple Choice Questions (MCQs) | |
HOTS (Higher Order Thinking Skills) Questions | |
Fill in the Blanks | |
True/False | |
Hands-On Questions |
Q.1. Which of the following is not a type of data model?
(a) Relational data model
(b) Hierarchical data model
(c) Network data model
(d) Logical data model
Ans. (d)
Q.2. In a relational data model, a table is also known as:
(a) Entity
(b) Attribute
(c) Tuple
(d) Relation
Ans. (d)
Q.3. Which data model represents data as a collection of objects with attributes and methods?
(a) Hierarchical data model
(b) Object-oriented data model
(c) Relational data model
(d) Network data model
Ans. (b)
Q.4. True or False: The hierarchical data model allows a parent node to have multiple child nodes.
(a) True
(b) False
Ans. (a)
Q.5. Which of the following is an example of a semi-structured data model?
(a) XML
(b) Relational database
(c) JSON
(d) SQL
Ans. (c)
Q.1. Explain the concept of a hierarchical data model and provide an example scenario where it can be useful.
A hierarchical data model organizes data in a tree-like structure where each parent node can have multiple child nodes. For example, in a company's organizational structure, the CEO can be the root node, followed by departments as parent nodes, and employees as child nodes. This model is useful when there is a clear hierarchical relationship between entities.
Q.2. Discuss the advantages and disadvantages of using a relational data model for organizing and storing data.
Advantages of the relational data model include data integrity, scalability, and ease of data retrieval through SQL queries. Disadvantages include complexity for representing certain types of relationships and performance issues with large-scale databases.
Q.3. Compare and contrast the object-oriented data model and the relational data model in terms of their structure and capabilities.
The object-oriented data model represents data as a collection of objects with attributes and methods, whereas the relational data model represents data as tables with rows and columns. The object-oriented model supports concepts like inheritance and polymorphism, while the relational model relies on set theory. The choice between the two models depends on the nature of the data and the requirements of the application.
Q.4. Consider a scenario where you have a large dataset with complex relationships between entities. Which data model would you choose to represent and store this data, and why?
For a large dataset with complex relationships between entities, a graph data model would be suitable. The graph model allows for flexible relationships between entities and efficient traversal of the data. This model can handle scenarios like social networks, recommendation systems, and network analysis.
Q.5. Explain the concept of a logical data model and discuss its significance in database design.
A logical data model represents the structure and relationships of data in a specific database management system, independent of the physical implementation. It defines the entities, attributes, and relationships in the database and provides a high-level view of the data organization. It serves as a blueprint for creating the physical database schema.
1. In the __________ data model, data is organized in a tree-like structure with parent-child relationships.
Hierarchical
2. The process of converting a conceptual data model into a physical data model is known as __________.
Physical database design
3. The __________ data model represents data as a set of tables with rows and columns.
Relational
4. A __________ key is a unique identifier for a record in a relational database table.
Primary
5. In an object-oriented data model, objects are instances of __________ defined by classes.
Classes
1. The network data model allows a record to have multiple parent records.
True
2. A primary key in a relational database can be null.
False
3. The logical data model represents the structure and relationships of data in a specific database management system.
True
4. The object-oriented data model supports inheritance and polymorphism.
True
5. The relational data model is based on the mathematical theory of sets.
True
Q.1. Consider the following relational data model representing a bookstore:
Author (AuthorID, Name, Country)
Book (ISBN, Title, AuthorID, Price)
Write a SQL query to retrieve the names of authors who have written books with a price greater than $50.
SELECT Name FROM Author JOIN Book ON Author.AuthorID = Book.AuthorID WHERE Price > 50;
Q.2. Create a class diagram for a simple banking system using the object-oriented data model. Include classes for Bank, Account, and Customer. The Bank class should have a method to create a new account for a customer.
Here is a class diagram for a simple banking system using the object-oriented data model:
+-----------------+ +---------------+ +---------------+
| Bank | | Account | | Customer |
+-----------------+ +---------------+ +---------------+
| - bankName | | - accountNumber| | - customerId |
| - accounts |<>-----| - balance | | - name |
| | | - customer | | - address |
| | +---------------+ +---------------+
| + createAccount()|
+-----------------+
Q.3. Convert the following hierarchical data model into a relational data model:
Employee
- EmployeeID
- Name
- Department
- DepartmentID
- Name
- Manager
- ManagerID
- Name
Relational data model representation:
Employee (EmployeeID, Name, DepartmentID)
Department (DepartmentID, Name, ManagerID)
Manager (ManagerID, Name)
Q.4. Use JSON notation to represent the following data structure:
Person
- Name: John
- Age: 30
- Address
- Street: 123 Main St
- City: New York
- State: NY
JSON representation:
{
"Person": {
"Name": "John",
"Age": 30,
"Address": {
"Street": "123 Main St",
"City": "New York",
"State": "NY"
}
}
}
Q.5. Design a network data model to represent a social media network where users can have multiple friends and post messages on their timeline. Each message should have a timestamp and can be commented on by other users.
Network data model representation:
User (UserID, Name)
Friend (UserID, FriendID)
Message (MessageID, UserID, Content, Timestamp)
Comment (CommentID, MessageID, UserID, Content, Timestamp)
75 videos|44 docs
|
|
Explore Courses for Software Development exam
|