85 DBMS & SQL (Computer Science) questions asked in UGC NET previous year papers, each with the correct answer and explanation. Read them free on UTpaper, or attempt the full papers as timed online tests.
Q1UGC NET Computer Science, June 2014 (Paper II & III, Selected Questions)
Searching for an element in the hash table requires O(1) time for the ______ time, whereas for direct addressing it holds for the _______ time.
Aworst-case, average
Bworst-case, worst-case
Caverage, worst-case
Dbest, average
Show answerHide answer
Correct answer: (C) average, worst-case
Explanation
In searching for an element in hash table requires O(1) time for the average time, whereas for direct it holds for the worst-case time. So the correct answer is option (c).
Q2UGC NET Computer Science, June 2014 (Paper II & III, Selected Questions)
A clustering index is created when ______.
APrimary key is declared and ordered
BNo key ordered
CForeign key ordered
DThere is no key and no order
Show answerHide answer
Correct answer: (A) Primary key is declared and ordered
Explanation
Clustered index determines the order in which the rows of a table are stored on disk. If a table has a clustered index. Then the rows of that table will be stored on disk in the same exact order as the clustered index. In some cases, the index is created on non-primary key columns which may not be unique for each record. Clustering index is defined as an ordered data files.
Q3UGC NET Computer Science, June 2014 (Paper II & III, Selected Questions)
Which of the following statements is false?
AAny relation with two attributes is in BCNF.
BA relation in which every key has only one attribute is in 2NF.
CA prime attribute can be transitively dependent on a key in 3NF relation.
DA prime attribute can be transitively dependent on a key in BCNF relation.
Show answerHide answer
Correct answer: (D) A prime attribute can be transitively dependent on a key in BCNF relation.
Explanation
A relation is in BCNF, if and only if, every determinant is a candidate key i.e. the left hand side of every non trivial dependency is a super key or there is a trivial dependency or both. After 3NF, there may arise a situation that two candidate keys are having one attribute in common (overlapping) and this overlapping must be cleared to satisfy BCNF. A prime attribute (an attribute that is a part of a candidate key) can on depend on a super key. So a prime attribute cannot be transitively dependent on a key in BCNF relation. So the false statement is option (d).
Q4UGC NET Computer Science, June 2014 (Paper II & III, Selected Questions)
If h is chosen from a universal collection of hash functions and is used to hash n keys into a table of size m, where n ≤ m, the expected number of collisions involving a particular key K is (b) less than lg n
Aless than 1
Bless than lg n
Cgreater than 1
Dgreater than lg n
Show answerHide answer
Correct answer: (A) less than 1
Explanation
This is a theorem in universal hashing: if h is chosen from a universal collection and is used to hash n keys into a table of size m, where n ≤ m, the expected number of collisions involving a particular key is less than 1. So the answer is (a).
Q5UGC NET Computer Science, June 2014 (Paper II & III, Selected Questions)
The solution of the recurrence relation of T(n) = 3T(floor(n/4)) + n is
AO(n²)
BO(n lg n)
CO(n)
DO(lg n)
Show answerHide answer
Correct answer: (C) O(n)
Explanation
T(n) = 3T(n/4) + n. Here a = 3, b = 4, f(n) = n and n^(log₄3) ≈ n^0.79. Since f(n) = n grows polynomially faster than n^(log₄3), case 3 of the master theorem gives T(n) = Θ(n). So T(n) = O(n) (it is also O(n²), but (c) is the tight bound and the best choice).
Q6UGC NET Computer Science, June 2014 (Paper II & III, Selected Questions)
Which of the following statements is not true about disk-arm scheduling algorithms?
ASSTF (shortest seek time first) algorithm increases performance of FCFS.
BThe number of requests for disk service are not influenced by file allocation method.
CCaching the directories and index blocks in main memory can also help in reducing disk arm movements.
DSCAN and C-SCAN algorithms are less likely to have a starvation problem.
Show answerHide answer
Correct answer: (B) The number of requests for disk service are not influenced by file allocation method.
Explanation
Option (b) is NOT CORRECT as the number of request for disk drive can be greatly influenced by file allocation method.
Q7UGC NET Computer Science, June 2014 (Paper II & III, Selected Questions)
––––––– maintains the list of free disk blocks in the Unix file system
AI-node
BBoot block
CSuper block
DFile allocation table
Show answerHide answer
Correct answer: (C) Super block
Explanation
Super block describes the state of file system, the total size of partition, the block size, pointers to a list of free blocks, the node number of root directory, magic number etc.
Q8UGC NET Computer Science, June 2014 (Paper II & III, Selected Questions)
Consider the schema R = {S, T, U, V} and the dependencies S → T, T → U, U → V and V → S. If R = (R₁ and R₂) be a decomposition such that R₁ ∩ R₂ = φ then the decomposition is
ANot in 2 NF
BIn 2 NF but not in 3 NF
CIn 3 NF but not in 2 NF
DIn both 2 NF and 3 NF
Show answerHide answer
Correct answer: (D) In both 2 NF and 3 NF
Explanation
R₁ ∩ R₂ ≠ φ. This makes the decomposition lossless join, as all the attributes are keys, R₁ ∩ R₂ will be a key of the decomposed relation Now, even the original relation R is in 3NF (Even BCNF) as all the attributes are prime attributes (in fact attribute is a candidate key) Hence, any decomposition will also be in 3NF and 2NF, So the answer is option (d).
Q9UGC NET Computer Science, June 2014 (Paper II & III, Selected Questions)
Consider the following relational schemas for a library database :
Book (Title, Author, Catalog–No, Publisher, Year, Price)
Collection (Title, Author, Catalog–no)
with the following functional dependencies :
I. Title, Author → Catalog–no
II. Catalog–no → Title, Author, Publisher, Year
III. Publisher, Title, Year → Price
Assume (Author, Title) is the key for both schemas. Which one of the following is true?
ABoth Book and Collection are in BCNF.
BBoth Book and Collection are in 3 NF.
CBook is in 2NF and Collection in 3 NF.
DBoth Book and Collection are in 2 NF.
Show answerHide answer
Correct answer: (C) Book is in 2NF and Collection in 3 NF.
Explanation
2NF says that all the non-key attributes should depend the keys, partial dependency (an attribute is defined by a part of a composite key) is not allowed 3NF says that any dependency between non-key attribute should be cleared. BCNF says that all determinants in a table is key for every non trivial (no overlapping attributes) function. In the table book, (Title Author) identifies catalog-no. Which if turn identifies publisher and year further (publisher, Title, Year) identifies price. Now here the dependents are partially dependent on the key attributes on left hand side of (R). So the table book is in 2NF. In the table collection, (Title, Author) determines catalog-no., the only non-key attribute. So it is in 3NF as well as BCNF.
Q10UGC NET Computer Science, June 2014 (Paper II & III, Selected Questions)
Linking to another place in the same or another webpage require two A (Anchor) tags, the first with the ________ attribute and the second with the _______ attribute.
ANAME & LINK
BLINK & HREF
CHREF & NAME
DTARGET & VALUE
Show answerHide answer
Correct answer: (C) HREF & NAME
Explanation
Name attribute specifies the name of an anchor and it is used to create a bookmark inside a document. Syntax : <a name = "value"> ⇒ href attribute specifies the URL of the page the link goes to, and if the href attribute is not present, the <a> tag is not a hyperlink. Syntax : <a href = "URL">
Q11UGC NET Computer Science, June 2014 (Paper II & III, Selected Questions)
Match the following :
List-I
(A) Chomsky Normal form
(B) Greibach Normal form
(C) S-grammar
(D) LL grammar
List-II
(i) S → b S S | a S | c
(ii) S → a S b | ab
(iii) S → AS | a ; A → SA | b
(iv) S → a B S B ; B → b
Codes : A B C D
Aiv iii i ii
Biv iii ii i
Ciii iv i ii
Diii iv ii i
Show answerHide answer
Correct answer: (C) iii iv i ii
Explanation
Chomsky Normal Form : production rules are of the form A → BC or A → a (and S → ε) — grammar (iii).
Greibach Normal Form : production rules are of the form A → aA₁A₂...Aₙ or A → a — grammar (iv).
S-grammar : every production's right-hand side begins with a terminal, and this terminal is different for any two productions with the same left-hand side — grammar (i).
LL grammar : two production rules for the same nonterminal can begin with the same terminal only if their select sets differ — grammar (ii).
So A-iii, B-iv, C-i, D-ii, i.e. option (c).
Q12UGC NET Computer Science, December 2014 (Paper II & III, Selected Questions)
A computer program select an integer in the set {k : 1≤ k ≤10,00,000} at random and prints out the result. This process is repeated 1 million times. What is the probability that the value k = 1 appears in the printout at least once?
A0.5
B0.704
C0.632121
D0.68
Show answerHide answer
Correct answer: (C) 0.632121
Explanation
Probability of k = 1 in one trial = 1/1000000 = 10⁻⁶, so the probability of k ≠ 1 is 1 – 10⁻⁶. Probability that 1 is never printed in 10⁶ printouts = (1 – 10⁻⁶)^(10⁶) ≈ 1/e. Probability that 1 is printed at least once = 1 – (1 – 10⁻⁶)^(10⁶) ≈ 1 – 1/e = 0.632121.
Q13UGC NET Computer Science, December 2014 (Paper II & III, Selected Questions)
For the implementation of a paging scheme, suppose the average process size be x bytes, the page size be y bytes, and each entry requires z bytes. The optimum page size that minimizes the total overhead due to the page table and the internal fragmentation loss is given by :
Ax/2
Bxz/2
C√(2xz)
D√(xz)/2
Show answerHide answer
Correct answer: (C) √(2xz)
Explanation
Average internal fragmentation per process is y/2. A process has x/y pages and each page-table entry needs z bytes, so the page table takes xz/y bytes. Total overhead = xz/y + y/2. Setting d/dy (xz/y + y/2) = –xz/y² + 1/2 = 0 gives y = √(2xz).
Q14UGC NET Computer Science, December 2014 (Paper II & III, Selected Questions)
In a demand paging memory system, page table is held in registers. The time taken to service a page fault is 8 m. sec. if an empty frame is available or if the replaced page is not modified, and it takes 20 m. sec. if the replaced page is modified. What is the average access time to service a page fault assuming that the page to be replaced is modified 70% of the time?
A11.6 m. sec.
B16.4 m. sec.
C28 m. sec.
D14 m. sec.
Show answerHide answer
Correct answer: (B) 16.4 m. sec.
Explanation
Average time to service a page fault = 0.7 × 20 + 0.3 × 8 = 14 + 2.4 = 16.4 m. sec.
Q15UGC NET Computer Science, December 2014 (Paper II & III, Selected Questions)
Which of the following is true?
I. Implementation of self-join is possible is SQL with table alias
II. Outer-join operation is basic operation in relational algebra
III. Natural join and outer join operations are equivalent.
AI and II are correct
BII and III are correct
COnly III is correct
DOnly I is correct
Show answerHide answer
Correct answer: (D) Only I is correct
Explanation
Only I is correct: a self join is implemented on a single table using alias names. Outer join is not a basic relational algebra operation, and natural join and outer join are not equivalent.
Q16UGC NET Computer Science, December 2014 (Paper II & III, Selected Questions)
What kind of mechanism is to be taken into account for converting a weak entity set into strong entity set in entity relationship diagram?
AGeneralization
BAggregation
CSpecialization
DAdding suitable attributes
Show answerHide answer
Correct answer: (D) Adding suitable attributes
Explanation
A weak entity does not have sufficient attributes to form a primary key; it is drawn as a double rectangle in an ER diagram. A weak entity set can be converted into a strong entity set simply by adding suitable attributes.
Q17UGC NET Computer Science, December 2014 (Paper II & III, Selected Questions)
The best normal form of relation scheme R(A, B, C, D) along with the set of functional dependencies F = { AB → C, AB → D, C → A, D →B} is :
ABoyce-Codd Normal form
BThird Normal form
CSecond Normal form
DFirst Normal form
Show answerHide answer
Correct answer: (B) Third Normal form
Explanation
The candidate keys are AB, CD, BC and AD, so A, B, C and D are all prime attributes and the relation is in 3NF. It is not in BCNF because in C → A and D → B the left side is not a superkey. Hence the best normal form is 3NF.
Q18UGC NET Computer Science, December 2014 (Paper II & III, Selected Questions)
Identify the minimal key for relational scheme R(A, B, C, D, E) with functional dependencies F = {A → B, B → C, AC → D}
AA
BAE
CBE
DCE
Show answerHide answer
Correct answer: (B) AE
Explanation
{A}⁺ = {A, B, C, D}, which does not include E, so A alone is not a key. {AE}⁺ = {A, B, C, D, E}, and nothing can be removed from AE, so AE is the minimal key.
Q19UGC NET Computer Science, December 2014 (Paper II & III, Selected Questions)
Which of the following is false ?
AEvery binary relation is never be in BCNF
BEvery BCNF relation is in 3NF
C1 NF, 2 NF, 3 NF and BCNF are based on functional dependencies
DMultivalued dependency (MVD) is a special case of join dependency (JD)
Show answerHide answer
Correct answer: (A) Every binary relation is never be in BCNF
Explanation
Every binary relation (a relation with only 2 attributes) is always in BCNF: if both attributes form the key it is in BCNF, and if one attribute is the key the other is determined by it. So statement (a) is false.
Q20UGC NET Computer Science, June 2015 (Paper II & III, Selected Questions)
The Unix Kernel maintains two key data structures related to processes, the process table and the user structure. Which of the following information is not the part of user structure?
AFile descriptor table
BSystem call state
CScheduling parameters
DKernel stack
Show answerHide answer
Correct answer: (C) Scheduling parameters
Explanation
The Unix Kernel maintains two key data structures related to processes, the process table and the user structure. In user structure there is no place for scheduling parameter process table store the information of all running process. The process table contains process ID's, memory usage of the process, what are file descriptor used in the process.
Q21UGC NET Computer Science, June 2015 (Paper II & III, Selected Questions)
Database applications were built directly on top of file system to overcome the following drawbacks of using file-systems :
(1) Data redundancy and inconsistency
(2) Difficulty in accessing Data
(3) Data isolation
(4) Integrity problems
A(1)
B(1) and (4)
C(1), (2) and (3)
D(1), (2), (3) and (4)
Show answerHide answer
Correct answer: (D) (1), (2), (3) and (4)
Explanation
Traditional file system has all mentioned drawbacks. Database applications built by using tables are used to overcome them. eg : Normalization and integrity constraints reduces redundancy & inconsistency. Select * from table provide easy access to data references, joins etc removes data is action primary & foreign key along with check predicates solves integrity problem
Q22UGC NET Computer Science, June 2015 (Paper II & III, Selected Questions)
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 :
ANeighbor Set
BStrong Entity Set
COwner Entity Set
DWeak Set
Show answerHide answer
Correct answer: (C) Owner Entity Set
Explanation
Every weak entity must be associated with an identifying entity i.e. the weak entity set is said to be existence dependent on the identifying set. The identifying entity set is said to own the weak entity set that it identifies. It is also called owner entity set.
Q23UGC NET Computer Science, June 2015 (Paper II & III, Selected Questions)
Drop Table cannot be used to drop a Table referenced by ______constraint.
(1) Primary key
(2) Sub key
(3) Super key
(4) Foreign key
A(1)
B(1), (2) and (3)
C(4)
D(1) and (4)
Show answerHide answer
Correct answer: (C) (4)
Explanation
If you drop child table first, the foreign key will be dropped as well. If you attempt to drop percent table first you will get an "could not drop object "a" because it is referenced by a foreign key constraint error, Drop table can not be used to drop a table reference by a foreign key constraint. The referencing foreign key constraint or the referencing table must be dropped.
Q24UGC NET Computer Science, June 2015 (Paper II & III, Selected Questions)
Which of the following statements is FALSE about weak entity set?
AWeak entities can be deleted automatically when their strong entity is deleted
BWeak entity set avoids the data duplication and consequent possible inconsistencies caused by duplicating the key of the strong entity
CA weak entity set has no primary keys unless attributes of the strong entity set on which it depends are included
DTuples in a weak entity set are not partitioned according to their relationship with tuples in a strong entity set
Show answerHide answer
Correct answer: (D) Tuples in a weak entity set are not partitioned according to their relationship with tuples in a strong entity set
Explanation
We have weak entities for several reasons : • We want to avoid the data duplication and consequent entity. Possible inconsistencies caused by duplicating the key of strong. • Weak entities be stored physically with their strong entities • Weak entities can be detected automatically when their strong entity is detected. So (d) is incorrect statement, Hence (d) is the answer.
Q25UGC NET Computer Science, June 2015 (Paper II & III, Selected Questions)
An assertion is a predicate expressing a condition we wish database to always satisfy. The correct syntax for Assertion is :
CREATE ASSERTION <assertion name> CHECK <predicate> is the proper syntax. For example, an assertion demanding that there is no more than one president among the employees: CREATE ASSERTION AT_MOST_ONE_PRESIDENT CHECK ((SELECT COUNT(*) FROM EMP e WHERE e.job = 'PRESIDENT') <= 1).
Q26UGC NET Computer Science, June 2015 (Paper II & III, Selected Questions)
In the indexed scheme of blocks to a file, the maximum possible size of the file depends on :
AThe number of blocks used for index and the size of index
BSize of Block and size of Address
CSize of index
DSize of Block
Show answerHide answer
Correct answer: (B) Size of Block and size of Address
Explanation
Number of pointers that can be stored in the index block – which depends on the size of the index block and the size of each address. Size of each data block – because each pointer points to a block, so the larger the block size, the more data each pointer represents.
Q27UGC NET Computer Science, June 2015 (Paper II & III, Selected Questions)
In _____ allocation method for disk block allocation in a file system, insertion and deletion of blocks in a file is easy.
AIndex
BLinked
CContiguous
DBit Map
Show answerHide answer
Correct answer: (B) Linked
Explanation
Just like linked list where insertion, deletion of blocks is easy. In linked allocation only pointer needs to be changed. In linked allocation each file is a linked list of disk blocks. The directory contains a pointer to the first block of the file, for example, a file of 5 blocks which starts at block 4, might continuous at block 7, then block 16, block 10, 8 finally block 27. Each block constrains a pointer to the next block & the last block contains a NIL-pointer. The value-1 may be used for NIL to differential it from block 0.
Q28UGC NET Computer Science, June 2015 (Paper II & III, Selected Questions)
Let E₁ and E₂ be two entities in E-R diagram with simple single valued attributes. R₁ and R₂ are two relationships between E₁ and E₂ where R₁ is one - many and R₂ is many - many. R₁ and R₂ do not have any attribute of their own. How minimum number of tables are required to represent this situation in the Relational model?
A4
B3
C2
D1
Show answerHide answer
Correct answer: (B) 3
Explanation
One table for each entity : 2 R₁ is one to many (No separate table): 0 R₂ is many to many and requires one separate table: 1 Total number of tables: 3
Q29UGC NET Computer Science, June 2015 (Paper II & III, Selected Questions)
The STUDENT information in a university stored in the relation STUDENT (Name, SEX, Marks, DEPT _Name) Consider the following SQL query SELECT DEPT_Name for STUDENT where SEX = 'M' group by DEPT_Name having avg (Marks) > SELECT avg (Marks) STUDENT. It Returns the Name of the Department for which :
AThe average marks of male students is more than the average marks of students in the same Department
BThe average marks of male students is more than the average marks of students in the University
CThe average marks of male students is more than the average marks of male students in the University
DThe average marks of students is more than the average marks of male students in the University
Show answerHide answer
Correct answer: (B) The average marks of male students is more than the average marks of students in the University
Explanation
The average marks of male students is more than the average marks of student in the university.
Q30UGC NET Computer Science, June 2015 (Paper II & III, Selected Questions)
Select the 'False' statement from the following statements about Normal forms :
ALossless preserving decomposition into 3NF is always possible
BLossless preserving decomposition into BCNF is always possible
CAny Relation with two attributes is in BCNF
DBCNF is stronger than 3NF
Show answerHide answer
Correct answer: (C) Any Relation with two attributes is in BCNF
Explanation
Note: statement (c) is actually true (every two-attribute relation is in BCNF); the false statement is (b), so the book's key appears wrong. A BCNF decomposition that is both lossless and dependency preserving is not always possible. Example: R(a, b, c) with FDs ab → c and c → b cannot be decomposed into BCNF while preserving ab → c.
Q31UGC NET Computer Science, June 2015 (Paper II & III, Selected Questions)
The Relation Vendor Order (V_no, V_ord_no, V_name, Qty_sup, unit_price) is in 2NF because :
ANon_key attribute V_name is dependent on V_no which is part of composite key
BNon_key attribute V_name is dependent on Qty_sup
CKey attribute Qty_sup is dependent on primary_key unit price
DKey attribute V_ord_no is dependent on primary_key unit price
Show answerHide answer
Correct answer: (A) Non_key attribute V_name is dependent on V_no which is part of composite key
Explanation
Option (a) is which it is clearly mentioned that partial dependency exists is against 2NF principle. Question seems incomplete, because there is nothing said about functional dependency.
Q32UGC NET Computer Science, June 2015 (Paper II & III, Selected Questions)
Which of the following is false for the programming language PROLOG?
AA PROLOG variable can only be assigned to a value once
BPROLOG is a strongly typed language
CThe scope of a variable in PROLOG is a single clause or rule
DThe scope of a variable in PROLOG is a single query
Show answerHide answer
Correct answer: (B) PROLOG is a strongly typed language
Explanation
Since prolog is a dynamically typed language. Which is to say that programs are not checked for type errors until run time.
Q33UGC NET Computer Science, December 2015 (Paper II & III, Selected Questions)
______ allows selection of the relevant information necessary for the data warehouse.
AThe Top – Down view
BData warehouse view
CData source view
DBusiness query view
Show answerHide answer
Correct answer: (A) The Top – Down view
Explanation
Four views regarding the design of a data warehouse: Top-down view – allows selection of the relevant information necessary for the data warehouse; Data source view – exposes the information being captured, stored and managed by operational systems; Data warehouse view – consists of fact tables and dimension tables; Business query view – sees the data in the warehouse from the view of the end-user.
Q34UGC NET Computer Science, December 2015 (Paper II & III, Selected Questions)
Data which improves the performance and accessibility of the database are called :
AIndexes
BUser data
CApplication metadata
DData dictionary
Show answerHide answer
Correct answer: (A) Indexes
Explanation
Indexes are special lookup tables that the database search engine can use to speed up data retrieval. An index is a pointer to data in a table, very similar to an index at the back of a book.
Q35UGC NET Computer Science, December 2015 (Paper II & III, Selected Questions)
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 :
ASelect * from customers where city = '%GAR%';
BSelect * from customers where city = '$GAR$'
CSelect * from customers where city like '%GAR%';
DSelect * from customers where city as '%GAR'
Show answerHide answer
Correct answer: (C) Select * from customers where city like '%GAR%';
Explanation
The LIKE operator with the % wildcard matches any sequence of characters: Select * from customers where city like '%GAR%';
Q36UGC NET Computer Science, December 2015 (Paper II & III, Selected Questions)
Which of the following statement regarding the features of the object-oriented approach to databases are true?
(1) The ability to develop more realistic models of the real world
(2) The ability to represent the world in a non-geometric way
(3) The ability to develop databases using natural language approaches
(4) The need to split objects into their component parts
(5) The ability to develop database models based on location rather than state and behavior
Codes :
A(1), (2) and (3)
B(2), (3) and (4)
C(1), (4) and (5)
D(3), (4) and (5)
Show answerHide answer
Correct answer: (A) (1), (2) and (3)
Explanation
The following statements are true: (1) the ability to develop more realistic models of the real world; (2) the ability to represent the world in a non-geometric way; (3) the ability to develop databases using natural language approaches. Hence the answer is (a).
Q37UGC NET Computer Science, December 2015 (Paper II & III, Selected Questions)
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 atmost can this table contain?
A5
B10
C15
D50
Show answerHide answer
Correct answer: (A) 5
Explanation
Attribute 'one' can have 10 values from 1 to 10 and attribute 'two' can have 5 values from 1 to 5. Since 'two' is unique, it cannot repeat, and every tuple must have a distinct value of 'two' from only 5 possibilities. So the relation can have at most 5 tuples.
Q38UGC NET Computer Science, December 2015 (Paper II & III, Selected Questions)
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 :
A2 and 6 respectively
B6 and 2 respectively
C2 and 4 respectively
D4 and 2 respectively
Show answerHide answer
Correct answer: (D) 4 and 2 respectively
Explanation
R.B = S.B holds for 2 records (B = 2 and B = 4), so SQ2 (inner join) returns 2 tuples. The full outer join returns the 2 matching tuples plus the unmatched tuple of R (1, 3) and the unmatched tuple of S (7, 8), so SQ1 returns 4 tuples.
Q39UGC NET Computer Science, December 2015 (Paper II & III, Selected Questions)
Consider the following three SQL queries (Assume the data in the people table) :
(1) Select Name from people where Age > 21;
(2) Select Name from people where Height > 180;
(3) Select Name from people where (age > 21) or (Height > 180);
If the SQL queries (1) and (2) above, return 10 row and 7 rows in the result set respectively, then what is one possible number of rows returned by the SQL query (3)?
A3
B7
C10
D21
Show answerHide answer
Correct answer: (C) 10
Explanation
Query (3) returns the union of the two result sets, so it returns between 10 and 17 rows. If all rows are distinct the answer would be 10 + 7 = 17; if set (2) is a subset of set (1), it is 10 + 7 – 7 = 10. Among the options only 10 is possible.
Q40UGC NET Computer Science, June 2016 (Paper II & III, Selected Questions)
Simplified Boolean equation for the following truth table is:
x y z | F
0 0 0 | 0
0 0 1 | 1
0 1 0 | 0
0 1 1 | 1
1 0 0 | 1
1 0 1 | 0
1 1 0 | 1
1 1 1 | 0
Q41UGC NET Computer Science, June 2016 (Paper II & III, Selected Questions)
In RDBMS, the constraint that no key attribute (column) may be NULL is referred to as:
AReferential integrity
BMulti-valued dependency
CEntity Integrity
DFunctional dependency
Show answerHide answer
Correct answer: (C) Entity Integrity
Explanation
The entity integrity constraint states that primary keys cannot be null. There must be a proper value in the primary key field. The basis of referential integrity is foreign keys. A foreign key in one table references a primary key in another table.
Q42UGC NET Computer Science, June 2016 (Paper II & III, Selected Questions)
In a relational database model, NULL values can be used for all but which one of the following?
ATo allow duplicate tuples in the table by filling the primary key column(s) with NULL.
BTo avoid confusion with actual legitimate data values like 0 (zero) for integer columns and '' (the empty string) for string columns.
CTo leave columns in a tuple marked as "unknown" when the actual value is unknown.
DTo fill a column in a tuple when that column does not really "exist" for that particular tuple.
Show answerHide answer
Correct answer: (A) To allow duplicate tuples in the table by filling the primary key column(s) with NULL.
Explanation
The SQL null is the term used to represent a missing value. A null value in a table is a value in a field that appears to be blank. A field with a null value is a field with no value.
Q43UGC NET Computer Science, June 2016 (Paper II & III, Selected Questions)
Consider the following two commands C1 and C2 on the relation R from an SQL database:
C1: drop table R;
C2: delete from R;
Which of the following statements is TRUE?
I. Both C1 and C2 delete the schema for R.
II. C2 retains relation R, but deletes all tuples in R.
III. C1 deletes not only all tuples of R, but also the schema for R.
AI only
BI and II only
CII and III only
DI, II and III
Show answerHide answer
Correct answer: (C) II and III only
Explanation
Drop command remove all tuples of the relation as well as schema also. Delete command in SQL removes tuples from the relation but retain the schema of table in database.
Q44UGC NET Computer Science, June 2016 (Paper II & III, Selected Questions)
Consider the following database table having A, B, C and D as its four attributes and four possible candidate keys (I, II, III, IV) for this table:
A | B | C | D
a₁ | b₁ | c₁ | d₁
a₂ | b₂ | c₃ | d₂
a₃ | b₃ | c₁ | d₃
I: {B} II: {B, C} III: {A, D} IV: {C, D}
If different symbols stand for different values in the table (e.g., d₁ is definitely not equal to d₂), then which of the above could not be the candidate key for the database table?
AI and III only
BIII and IV only
CII only
DI only
Show answerHide answer
Correct answer: (C) II only
Explanation
Attribute B has distinct values in all tuples, so {B} can be a candidate key, and {B, C} is then only a superkey (not minimal), because a candidate key is a minimal superkey. {A, D} and {C, D} have distinct values in all tuples, so both can be candidate keys. Hence only II could not be a candidate key.
Q45UGC NET Computer Science, June 2016 (Paper II & III, Selected Questions)
Which of the following statement(s) is/are FALSE in the context of Relational DBMS?
I. Views in a database system are important because they help with access control by allowing users to see only a particular subset of the data in the database.
II. E-R diagrams are useful to logically model concepts.
III. An update anomaly is when it is not possible to store information unless some other, unrelated information is stored as well.
IV. SQL is a procedural language.
AI and IV only
BIII and IV only
CI, II and III only
DII, III and IV only
Show answerHide answer
Correct answer: (B) III and IV only
Explanation
(i) Views help provide data independence, allow the schema to change without recompiling existing applications, and help with access control by letting users see only a particular subset of the data. (ii) A conceptual ER model may be used as the foundation for logical data models. (iii) Being unable to store information unless other unrelated information is stored is an insertion anomaly, not an update anomaly. (iv) SQL is not a procedural language. Only statements III and IV are false.
Q46UGC NET Computer Science, June 2016 (Paper II & III, Selected Questions)
Which of the following statements concerning Object-Oriented databases are FALSE?
AObjects in an object-oriented database contain not only data but also methods for processing the data.
BObject-oriented databases store computational instructions in the same place as the data.
CObject-oriented databases are more adapt at handling structured (analytical) data than relational databases.
DObject-oriented databases store more types of data than relational databases and access that data faster.
Show answerHide answer
Correct answer: (C) Object-oriented databases are more adapt at handling structured (analytical) data than relational databases.
Explanation
Objects in an object-oriented database contain not only data but also methods for processing the data – correct. Object-oriented databases store computational instructions in the same place as the data – correct. Object-oriented databases are more adept at handling structured (analytical) data than relational databases – incorrect. Object-oriented databases store more types of data than relational databases and access that data faster – correct. So, option (c) is correct.
Q47UGC NET Computer Science, June 2016 (Paper II & III, Selected Questions)
In distributed database, location transparency allows for database users, programmers and administrators to treat the data as if it is at one location. A SQL query with location transparency needs to specify :
AInheritances
BFragments
CLocations
DLocal formats
Show answerHide answer
Correct answer: (B) Fragments
Explanation
With location transparency the user does not need to know where the data is stored, but still needs to know how the data is fragmented; so a SQL query needs to specify fragments. Fragmentation transparency is the highest level, where the user does not even need to know that the database is partitioned.
Q48UGC NET Computer Science, June 2016 (Paper II & III, Selected Questions)
Consider the following ORACLE relations:
R (A, B, C) = {<1, 2, 3>, <1, 2, 0>, <1, 3, 1>, <6, 2, 3>, <1, 4, 2>, <3, 1, 4>}
S (B, C, D) = {<2, 3, 7>, <1, 4, 5>, <1, 2, 3>, <2, 3, 4>, <3, 1, 4>}
Consider the following two SQL queries SQ₁ and SQ₂:
SQ₁: SELECT R.B, AVG (S.B)
FROM R, S
WHERE R.A = S.C AND S.D < 7
GROUP BY R.B;
SQ₂: SELECT DISTINCT S.B, MIN (S.C)
FROM S
GROUP BY S.B
HAVING COUNT (DISTINCT S.D) > 1;
If M is the number of tuples returned by SQ₁ and N is the number of tuples returned by SQ₂ then
AM = 4, N = 2
BM = 5, N = 3
CM = 2, N = 2
DM = 3, N = 3
Show answerHide answer
Correct answer: (A) M = 4, N = 2
Explanation
SQ₁: S tuples with D < 7 have S.C = 4, 2, 3, 1. Joining with R.A: S.C = 1 matches R tuples with A = 1 (R.B = 2, 2, 3, 4) and S.C = 3 matches <3, 1, 4> (R.B = 1). Grouping by R.B gives groups 1, 2, 3, 4, so M = 4.
SQ₂: S.B = 1 has distinct D {5, 3} (count 2), S.B = 2 has {7, 4} (count 2), S.B = 3 has {4} (count 1). The third group is not taken because COUNT(DISTINCT S.D) > 1 fails, so N = 2.
Q49UGC NET Computer Science, June 2016 (Paper II & III, Selected Questions)
Semi-join strategies are techniques for query processing in distributed database system. Which of the following is a semi-join technique?
AOnly the joining attributes are sent from one site to another and then all of the rows are returned
BAll of the attributes are sent from one site to another and then only the required rows are returned
COnly the joining attributes are sent from site to another and then only the required rows are returned
DAll of the attributes are sent from one site to another and then only the required rows are returned.
Show answerHide answer
Correct answer: (C) Only the joining attributes are sent from site to another and then only the required rows are returned
Explanation
Semi-join strategies are techniques for query processing in distributed database system. In which only the joining attributes are sent from one site to another and then only the required rows are returned.
Q50UGC NET Computer Science, June 2016 (Paper II & III, Selected Questions)
Consider the relations R(A, B) and S(B, C) and the following four relational algebra queries over R and S:
I. π_A,B (R ⋈ S)
II. R ⋈ π_B(S)
III. R ∩ (π_A(R) × π_B(S))
IV. π_A,R.B (R × S)
where R.B refers to the column B in table R.
One can determine that:
AI, III and IV are the same query
BII, III and IV are the same query
CI, II and IV are the same query
DI, II and III are the same query
Show answerHide answer
Correct answer: (D) I, II and III are the same query
Explanation
I, II and III all return exactly those tuples of R whose B value appears in S, whereas IV returns every (A, R.B) pair of R as long as S is non-empty. Example: R = {(10, 1), (20, 2)}, S = {(2, 30), (3, 40)}.
(I) R ⋈ S = {(20, 2, 30)}, so π_A,B(R ⋈ S) = {(20, 2)}.
(II) π_B(S) = {(2), (3)}, so R ⋈ π_B(S) = {(20, 2)}.
(III) π_A(R) × π_B(S) = {(10, 2), (10, 3), (20, 2), (20, 3)}, and R ∩ that = {(20, 2)}.
(IV) π_A,R.B(R × S) = {(10, 1), (20, 2)}.
So I, II and III are the same query.
How to use these UGC NET Computer Science questions
Every question here was asked in a real UGC NET paper; the paper and shift are shown on the card, and the number opens the question on its own page. Try each one before tapping Show answer, then attempt the full UGC NET papers as timed tests to check your speed under exam conditions.