NTA UGC NET Computer Science Questions with Solutions | SQL, ER Model, Keys
Prepare for NTA UGC NET Computer Science with these carefully curated questions covering SQL queries, relational algebra, entity-relationship models, foreign keys, normalization, and more. This comprehensive guide provides concept clarity and includes essential topics like referential integrity, joins (INNER and FULL), subqueries, and SQL operations. These questions are structured to help you understand the core DBMS concepts required for success in the exam. Whether you’re revising ER Models, SQL syntax, or entity relationships, this blog ensures you’re well-prepared to tackle the exam confidently. Start practicing now and excel in your preparation journey.
Question 1
Let R1(a, b, c) and R2(x, y, z) be two relations in which a is the foreign key of R1 that refers to the primary key of R2. Consider the following four options.
- Insert into R1
- Insert into R2
- Delete from R1
- Delete from R2
Which of the following is correct about the referential integrity constraint with respect to above?
- Operations a and b will cause violation
- Operations b and c will cause violation
- Operations c and d will cause violation
- Operations d and a will cause violation
Question 2
Consider the following ORACLE relations:
One (x, y) = { < 2, 5 >, < 1, 6 >, < 1, 6 >, < 1, 6 >, < 4, 8 >, < 4, 8 > }
Two (x, y) = { < 2, 55 >, < 1, 1 >, < 4, 4 >, < 1, 6 >, < 4, 8 >, < 4, 8 >, < 9, 9 >, < 1, 6 > }
Consider the following two SQL queries SQ1 and SQ2:
SQ1: SELECT * FROM One EXCEPT (SELECT * FROM Two); SQ2: SELECT * FROM One EXCEPT ALL (SELECT * FROM Two);
For each of the SQL queries, what is the cardinality (number of rows) of the result obtained when applied to the instances above?
- 2 and 1 respectively
- 1 and 2 respectively
- 2 and 2 respectively
- 1 and 1 respectively
Question 3
Referential integrity is directly related to:
- Relation key
- Foreign key
- Primary key
- Candidate key
Question 4
Consider the table student (stuid, name, course, marks). Which one of the following two queries is correct to find the highest marks student in course 5?
Q.1: Select S.stuid from student S where not exist (select * from student e where e.course ='5' and e.marks ≥ s.marks); Q.2: select s.stu.id From student S where s.marks > any (select distinct marks from student S where s.course = 5);
- Q.1
- Q.2
- Both Q.1 and Q.2
- Neither Q.1 nor Q.2
Question 5
Division operation is ideally suited to handle queries of the type:
- Customers who have no account in any of the branches in Delhi.
- Customers who have an account at all branches in Delhi.
- Customers who have an account in at least one branch in Delhi.
- Customers who have only joint account in any one branch in Delhi.
Question 6
Which of the following is true?
- I. Implementation of self-join is possible in SQL with table alias.
- II. Outer-join operation is basic operation in relational algebra.
- III. Natural join and outer join operations are equivalent.
- I and II are correct.
- II and III are correct.
- Only III is correct.
- Only I is correct.
Question 7
Consider a “CUSTOMERS” database table having a column “CITY” filled with all the names of Indian cities (in capital letters). The SQL statement that finds all cities that have “GAR” somewhere in its name, is:
select * from customers where city='%GAR%';
select * from customers where city='$GAR$';
select * from customers where city like '%GAR%';
select * from customers where city as'%GAR';
Question 8
Consider the following database table:
Create table test( one integer, two integer, primary key(one), unique(two), check(one>=1 and <=10), check(two>=1 and <=5) );
How many data records/tuples at most can this table contain?
- 5
- 10
- 15
- 50
Question 9
Consider the following three SQL queries (Assume the data in the people table):
- Select Name from people where Age > 21;
- Select Name from people where Height > 180;
- Select Name from people where (Age > 21) or (Height > 180);
If the SQL queries a and b above, return 10 rows and 7 rows in the result set respectively, then what is one possible number of rows returned by the SQL query c?
- 3
- 7
- 10
- 21
Question 10
Suppose ORACLE relation R(A, B) currently has tuples {(1,2), (1,3), (3,4)} and relation S(B, C) currently has {(2,5), (4,6), (7,8)}. Consider the following two SQL queries SQ1 and SQ2:
SQ1: Select * From R Full Join S On R.B=S.B; SQ2: Select * From R Inner Join S On R.B=S.B;
The numbers of tuples in the result of the SQL query SQ1 and the SQL query SQ2 are given by:
- 2 and 6 respectively
- 6 and 2 respectively
- 2 and 4 respectively
- 4 and 2 respectively
Question 11
Consider the following relation:
Works(emp_name, company_name, salary)
Here, emp_name is primary key.
Consider the following SQL query:
Select emp name From works T where salary > (select avg(salary) from works S where T.company name = S.company name)
The above query is for following:
- Find the highest paid employee who earns more than the average salary of all employees of his company.
- Find the highest paid employee who earns more than the average salary of all the employees of all the companies.
- Find all employees who earn more than the average salary of all employees all the companies.
- Find all employees who earn more than the average salary of all employees of their company.
Question 12
Given two tables:
EMPLOYEE (EID, ENAME, DEPTNO) DEPARTMENT (DEPTNO, DEPTNAME)
Find the most appropriate statement of the given query:
Select count (*) 'total' from EMPLOYEE where DEPTNO IN (D1,D2) group by DEPTNO having count (*) >5
- Total number of employees in each department D1 and D2
- Total number of employees of department D1 and D2 if their total is > 5
- Display total number of employees in both departments D1 and D2
- The output of the query must have at least two rows
Question 13
Given two relations R1(A, B) and R2(C, D), the result of the following query:
Select distinct A, B From R1, R2
Is guaranteed to be same as R1 provided one of the following condition is satisfied.
- R1 has no duplicates and R2 is empty.
- R1 has no duplicates and R2 is non-empty.
- Both R1 and R2 have no duplicates.
- R2 has no duplicates and R1 is non-empty.
Question 14
For a weak entity set to be meaningful, it must be associated with another entity set in combination with some of their attribute values, is called as:
- Neighbour Set
- Strong Entity Set
- Owner Entity Set
- Weak Set
Question 15
Let R1(a, b, c) and R2(x, y, z) be two relations in which a is the foreign key of R1 that refers to the primary key of R2. Consider the following four options:
- Insert into R1
- Insert into R2
- Delete from R1
- Delete from R2
Which of the following is correct about the referential integrity constraint with respect to above?
- Operations a and b will cause violation
- Operations b and c will cause violation
- Operations c and d will cause violation
- Operations d and a will cause violation
Question 16
An entity has:
- (i) a set of properties
- (ii) a set of properties and values for all the properties
- (iii) a set of properties and the values for some set of properties may non-uniquely identify an entity
- (iv) a set of properties and the values for some set of properties may uniquely identify an entity
Which of the above are valid?
- (i) only
- (ii) only
- (iii) only
- (iv) only
Question 17
Let E1 and E2 be two entities in E-R diagram with simple single valued attributes. R1 and R2 are two relationships between E1 and E2 where R1 is one-many and R2 is many-many. R1 and R2 do not have any attribute of their own. How many minimum number of tables are required to represent this situation in the Relational Model?
- 4
- 3
- 2
- 1
Question 18
Which of the following statements is false about weak entity set?
- Weak entities can be deleted automatically when their strong entity is deleted
- Weak entity set avoids the data duplication and consequent possible inconsistencies caused by duplicating the key of the strong entity
- A weak entity set has no primary keys unless attributes of the strong entity set on which it depends are included
- Tuples in a weak entity set are not partitioned according to their relationship with tuples with a strong entity set
Question 19
An entity instance is a single occurrence of an ______.
- Entity type
- Relationship type
- Entity and relationship type
- None of these
Question 20
Relations produced from E-R Model will always be in ______.
- 1 NF
- 2 NF
- 3 NF
- 4 NF
Question 21
Let M and N be two entities in an E-R diagram with simple single value attributes. R1 and R2 are two relationships between M and N, where as R1 is one-to-many and R2 is many-to-many.
The minimum number of tables required to represent M, N, R1, and R2 in the relational model are __________.
- 4
- 6
- 7
- 3
Question 22
What kind of mechanism is to be taken into account for converting a weak entity set into strong entity set in entity-relationship diagram?
- Generalization
- Aggregation
- Specialization
- Adding suitable attributes
Tag:1NF, 2NF, 3NF, Cardinality SQL, Data Records in Tables, DBMS Exam Questions, DBMS Important Questions, DBMS MCQs, DBMS Tables, Entity Set and Relationship, Entity-Relationship Model, ER Model Questions, Foreign Key MCQs, Normalization DBMS, NTA NET DBMS, NTA NET Practice Questions, NTA UGC NET Questions, NTA UGC NET Solutions, Oracle SQL Questions, Primary Key DBMS, RDBMS Questions, Referential Integrity, Referential Integrity Constraints, relational algebra, SQL Aggregation, SQL Conditions, SQL Constraints, SQL Count Queries, SQL Division Operation, SQL Full Join, SQL Inner Join, SQL Join Questions, SQL LIKE Clause, SQL Natural Join, SQL Outer Join, SQL Practice Questions, SQL Queries, SQL Queries UGC NET, SQL Query Questions, SQL SELECT Statement, SQL Self Join, SQL Subqueries, SQL Syntax Examples, SQL Table Relations, Strong Entity Set, UGC NET Computer Science, Weak Entity Relationships, Weak Entity Set