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

DBMS mcq

The document contains a series of multiple-choice questions related to Database Management Systems (DBMS), covering topics such as data types, SQL functions, constraints, and entity-relationship diagrams. Each question is followed by a detailed explanation of the correct answer, providing insights into key concepts and best practices in DBMS. The content is designed to aid in exam preparation for students studying DBMS.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
6 views

DBMS mcq

The document contains a series of multiple-choice questions related to Database Management Systems (DBMS), covering topics such as data types, SQL functions, constraints, and entity-relationship diagrams. Each question is followed by a detailed explanation of the correct answer, providing insights into key concepts and best practices in DBMS. The content is designed to aid in exam preparation for students studying DBMS.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 22
DBMS Questions Latest DBMS MCQ Objective Questions ee Eee Eero) De eer Start Complete Exam Preparation ono ces pores bdr Question Benk pees Download App Question 1: View this Question Online > A table Student has two text fields defined as below: firstname varchar(10) lastname char(10) If firstname stores value as ‘sachin’ and lastname stores value as ‘kumar’, then firstname will consume characters space and lastname will consume characters space. Answer (Detailed Solution Below) Option 2: , 10 coaching India’s Super Teachers for all govt. exams Under One Roof Crees DBMS Question 1 Detailed Solution The correct answer is 6 and 10, ) Key Points The firstname field is defined as varchar(10). This means it can store up to 10 characters, but it will only use as much space as needed for the’actual d 4 plus one byte for length information. The lastname field is defined as Clat{10). This means it always uses a fixed space of 10 characters, padding with spa: 3 if neeeteary. Given that the firstname “sachin is 6 characters long, it will consume 6 characters of space plus 1 byte for length, making it a total of 7 bytes. Given that the lastname “kumar” is 5 characters long, it will consume a fixed space of 10 characters, including 5 trailing spaces. ©; Additional Information The varchar type is variable-length, meening it only uses as much space as needed for the data stored, plus one or two bytes for length information. The char type is fixed-length, meaning it always uses the defined amount of space regardless of the actual length of the data stored. Using varchar is generally more space-efficient when the length of the data varies significantly. Using char is beneficial when the data length is relatively constant, as it can be faster for the database to process Rea eae Ree eas oad Rea Cres teras otra Download App Question 2: % View this Question Online > What is the difference between COUNT(*) and COUNT(column_name) in a SQL query? 1. COUNT?) counts all. rows, while COUNT(column_name) counts only non-null values in the specified column . 2. CONTE) counts only distinct values, while COUNT(column_name) counts all duplicate values. 4. There is no difference; they both do the same thing. NT(*) is faster than COUNT(column_name). Answer (Detailed Solution Below) Option 1: COUNT(*) counts all rows, while COUNT(column_name) counts only non-null values in the specified column DBMS Question 2 Detailed Solution The correct answer is COUNT(*) counts all rows, while COUNT(column_name) counts only non- null values in the specified column. © Key Points ‘COUNT(") is used to count the total number of rows in a table. This includes all rows, regardless of whether any columns contain NULL values. > COUNT(column_name) counts only the rows where the specified column contains non-null values. Rows with NULL values in the specified column are not counted. This di nis useful when you want to count the presence of specific data in a column while ignoring NULL entries. ream sack rae reee ot a al a a | il * COUNT(student_name) will count only these rows Where the student name is not NULL, whereas COUNT(*) will count all OWS regardless of whether the student name is NULL or not. Using COUNT(*) is helpful a @ total row count to understand the table's size or the number of records it holds, &; Additional Information Using COUNT(*) is generally faster and more efficient because it does not need to check for NULL values in a specific column. On the other hand, COUNT(column_name) can be more informative when dealing with sparse data where many rows may have NULL values in the column of interest. Both functions are part of the SQL standard and are widely supported by all relational database management systems (RDBMS). Understanding the difference between these two counting methods can help optimize queries and make them more meaningful depending on the context. ECE erica) Ree a: Start Complete Exam Preparation Te one ie hea co Crests ots Question 3: View this Question Online > Match List-I with List-Il : List List there can exist nly one column Tone oles Ne PRIMARY KEY [ONSTRAINT ombination with| this constraint. utomatically lue is inserted 8) (I) Jwhen user does jot enter a value for the column. lows NULL alues and their DEFAULT . © (ut) fan exist multiple| [ONSTRAINT coger columns with this constraint. Limits values thatlohOose the correct answer from the options given HECK. ‘an be inserted m ayy below: 1. (A)- Gl), B) = 0.(Q- 9, (©) - loa mo 1 2. (A) - lb, ® - (V).C)- 0, ©) - ay) 3. (A) lib. @) - (0. © - WO) - () 4. (A) - 0, (8) - © - 1, O) - IY) Answer (Detailed Solution Below) Option 3: (A) - (IN), (B) ~ (0, (C) - (I), (D) - (IV) G Oo f° DBMS Question 3 Detailed Solution The correct answer is Option 3. XO o Key Points UNIQUE CONSTRAINT (A) - (Ill): Allows NUBD\alues \d there can exist multiple columns with this constraint. PRIMARY KEY CONSTRAINT (8) - (I): Does not allow NULL value and there can exist only one column or one combination with this constraint. DEFAULT CONSTRAINT (c) - (II): Automatically value is inserted when user does not enter a value for the column. CHECK CONSTRAINT (0) - (IV): Limits values that can be inserted into a column ofa table. & Additional Information Unique Constraint; This constraint ensures that all values in a column are different. It allows NULL values, but the presence of multiple NULLS is permissible because NULL is not considered equal to NULL. Primary Key Constraint: This constraint uniquely identifies each record ina table, Primary keys must contain unique values and cannot contain NULL values. A table can have only one primary key. Default Constraint: This constraint assigns a default value to a column when no value is specified during an insert operation. it ensures that a column always has a value. Check Constraint: This constraint limits the values that can be placed in a column, It ensures that the data in a column meets a specific condition. India’s #1 Learning Platform eles Start Complete Exam Preparation Pron co Mock Tests ed rete Cresta xtoes Download App Question 4: View this Question Online > Aggregate functions can be used with clause They can not be used with clause. 1, WHERE,HAVING 2. HAVING, WHERE 3. GROUP BY,HAVING. 4. SELECT.HAVING a Answer (Detailed Solution Below) Option 1: WHERE,HAVING DBMS Question 4 Detailed Solution The correct answer is WHERE, HAVING. © Key Points Aggregate functions are used to perform calculations on a set of values to return a single scalar value. Common aggregate functions include SUMQ, AVGQ, COUNT(, MAX0, and MINQ. ‘These functions are often used in conjunction with the HAVING clause to filter grouped records. z The WHERE clause is used to filter records before any groupings are made. > Therefore, aggregate functions cannot be used in the WHERE clause because it operates on individual rows before grouping. j Instead, aggregate functions should be used with the HAVING clause, which’filters groups after the aggregate calculations are performed. ; Additional Information The SELECT statement is used to seléct data from a database, and it can include aggregate functions to summarize data, ~S The GROUP BY clause is u: range identical data into groups. Although the GROUP BY clause & olten used with aggregate functions, it itself does not filter records, which is the role of the HAVING clause, Example: SELECT department, COUNT(*) as employee_count FROM employees GROUP BY department HAVING COUNT(*) > 195 This query counts the number of employees in each department and only returns departments with more than 10 employees. eee ane aca eC nto PS elem Ce cms Lebel) =) Daily Live Download App Question 5: View this Question Online > Amit wants to be familiar with SQL. One of his friends Anand suggest him to execute following sql commands. (A) Create Table Student (8) Use Database DB (Q Select * from Student (D) Insert into Student In which order Amit néeds to run above commands. A. (9, (0) 2. (A), (8) (0). 3. (8), (A), (0). (QO 4. (©, (B), (0), (A) Answer (Detailed Solution Below) Option 3 : (B), (A), (0), () DBMS Question § Detailed Solution The correct answer is Option 3. © Key Points To become familiar with SQL, Amit needs to execute the commands in @ specific order to ensure they are performed correctly and without errors, The command (B) Use Database DB is executed first to select the database in which the operations will be performed. The command (A) Create Table Students executed next to create the table structure within the selected datal The command (D) incoearucen is executed third to populate the table with data. The command (C) Select * from Studentis executed last to retrieve and display the data from the table. &; Additional Information Executing the commands in the correct order ensures the database and table are properly set up before attempting to insert or retieve data. Using the USE statement ensures that subsequent operations are performed on the correct database. Creating the table first is essential to define the structure before inserting data. Inserting data is necessary before any data retrieval operations can be performed. fop DBMS MC@ Objective Questions CEE ABR hart) Start Complete Exam Preparation Pon Practice ba foe Question Benk Download App ce Question € few this Question Online > Fifth-Generation languages are the __. 1. Assembly languages 2. Machine languages 3. - based languages 4, High level language 5. None of the above Answer (Detailed Solution Below) Option 3: constraint based languages DBMS Question 6 Detailed Solution The correct answer is constraint-based languages. Programming languages are classified in variety of Ways and generation is one of them. Generation are further ClB8ifjied as: First-generation, second-generation, third-generation, fourth-generation, fifth.g ion. Fifth generation language is applied to logic and constraint-based languages like Prolog. © Additional Information Assembly languages — Second-generation * Machine languages ~ First-generation * High Level language — Third-generation Fd ieee a RU Rarity Slee) CR Cim cielo) pets Perey at Download App ‘Question 7 View this Question Online > Find minimum number of tables required for converting the following entity relationship diagram into relational database? a? 2 er Answer (Detailed Solution Below) Option 3:3 DBMS Question 7 Detailed Solution Rules for finding a minimum number of tables required for an ER diagram: 1)A strong entity with single or composite attributes requires one table. 2) A strong entity with multivalued attributes requires two tables. 3) In the case of many to many relations between two entities, 3 tables are required. oo Explanation: There is one to many relationships between Riand Rz. So, Q for two entities. But, entity R, contains multivalued attribute B, due to whic this is also needed. Here we have 1 to Many relation so we requi Ges Attribute B being multi-valued, we remove the multi-valued attribute B to convert the given entity-relationship diagram into a database. As relational database do not allow multi-valued attributes. We have to So, the number of tables is as below: RI RI2R2 A table for B (Multi-valued attribute) So, a total of 3 tables are required for the given entity relational diagram. So, option 3 is the correct answer. Eee ecu) AS Tame) CR Ck deity ote ae rears Glia ers re Jownload App Question 8 y 1/06,00,449+ View this Question Online > Consider the relation X(P, Q, 8, S, T, U) with the following set of functional dependencies Fe{ {P,R} = {S, Th, {P,S, U} > {, R) t Which of the following is the trivial functional dependency in F*, where F* is closure of F? 1. PRCT 2 PRR T} 3S} 8} za‘ {P,S, U} = (Qh Answer (Detailed Solution Below) Option 3: {P, S} + (S} DBMS Question 8 Detailed Solution Concept: The closure of F. denoted as F*. is the set of al! regular FD. that can be derived from. For trivial functional dependency, Let A and be two sets consists of attributes of a relation AaB Explanation: ation 1 {P, RE {S, Th eResD Not a trivial functional dependency Ontion 2: CR-RT {P, R} # AR, Th Not a trivial functional dependency Option 3: P.5}= 8) P9328 Itis a trivial functional dependency Option 4: PSU) + {P, S, U} 2 {Q} Not a trivial functional dependency NOTE: 2 — superset 2 not superset eS Eee ane ca ees Poton Practice ae Genes estrestrs as Download App ‘Question 9 View this Question Online > Which symbol denote derived attributes in ER Model? 1. Double ellipse > 2. Dashed ellipse 3. Squared ellipse 4, Ellipsé with attribute name underlined a Answer (Detailed Solution Below) Option 2: Dashed ellipse DBMS Question 9 Detailed Solution Concept: An attribute thet can be derived from other attributes of the entity type is known as a derived attribute, derived attribute is represented by a dashed eclipse. Explanation: In the ER model, Option 1: Double ellipse O Multivalued attribute Option 2: Dashed ellipse Derived attribute Option 4: llipse with attribute name underlined Key attribute Eee Terie STS Sele eee Cm lel) one f Pad Cresieacoug pres Download App ‘Question 10 ‘Wew this Question Ontine > An ER model of a database consists of entity types A and B. These are connected by a relationship R which does not have its own attribute. Under which one of the following conditions, can the relational table for R be merged with that of A? 1. Relationship R is one-to-many and the participation of A in Ris total. 2. Relationship is one-to-many and the participation of A in Ris partial. 3 A... Ris many-to-one and the participation of A in Ris total. 4. Relationship R is many-to-one and the participation of A in R is partial Answer (Velailed Solulion below) Option 3: Relationship R is many-to-one and the participation of A in R is total. DBMS Question 10 Detailed Solution Concept: Total participation: It specifies that each entity in the entity set must compulsorily participate in at least one relationship instance in that relationship set. Partial participation: It specifies that each entity in the entity set may or may not participate in the relationship instance in that relationship set. g Explanation: A HKe> 1p! In one to many or many to one relation, the relation between two entities is merged on the many side with total participation. As, itis given that relationship R doesn’t have its own attributes. So, it must be combined with entity A. So, the relation must be many to one and there should be total participation of A in R. #1 Learning Platform Start Complete Exam Preparation Clea etd mac Download App ‘Question 11 View this Question Online > Consider the following statements $1 and S2 about the felational data model: s relation scheme can have at most one foreign key. foreign key in a relatian schema Meesaaet be used to refer to tuples of R. Which one of the following choices is correct? 1._S1 is true and S2 is false. 2 % ‘Sand 82 are true. 3. Both S1 and S2 are false. 4. $1 is false and S2 is true. Answer (Detailed Solution Below) Option 3: Both $1 and S2 are false. DBMS Question 11 Detailed Solution Answer: Option 3 Concept: Foreign Key :is the set of attributes in a particular relation whose yalues are belongs to primary key of same relation or other relation. Explanation: Statement 4: A relation scheme sqanere at mostone foreign key. There is no such restriction on ho y number of Foreign keys a particular relation can have. A relation can have a8 many number of Foreign keys as Required, So this statement is false. Statement 2: foreign key in a relation scheme R cannot be used to refer to tuples of R. There is no such constraint. Foreign key can be used to refer to primary key of the same relation. Self-referencing relations are examples of such foreign key. So this statement is also false. So option 3 is the correct answer. ee aE art een cs Start Complete Exam Preparation Dos cien oo Crested jownload App Question 12 View this Question Online > Consider the relation scheme R = (E, F, G, H, I,J, KL, M, N)-and the set of functional dependencies {(E, F} + (G}, {F} = 1, J}, {E, H} + {K, Ly, {K} > (Mp. {I > {N}} on R. What is the key for R ? 1. {€, Ft 2. {FH} « 46 Answer (Detailed Solution Below) Option 2: {€, F, H} DBMS Question 12 Detailed Solution Function Dependencies: {(E, F) = (G}. {F} = 1, JB {E,W} AK. U, (K} = {M), {0 = (ND Option 4: {E, F} ERY SERGI Since K, L, M and N is missing in RHS -. is not a key Also, {E} cannot be a key because {E) is subset of {E, F} ™ Option 2: (E, F, H} {EF HY =F HG 15K, sitisa key Key for Ris {E, F, H). Important Points: In relation algebra, key is primary key or candidate key. (EF, H, K, Llis super key. SS eee ee eo Seen re Seem eCR Cnet) Gin en eo pos trann oy Question Bank Sao B Download App ‘Question 13 View this Question Online > Consider the following Entity Relationship Diagram (ERD) QualifiedDate Person Cone) Cup Which of the following possible relations will not hold if the above ERD is mapped into a relation i 1. Person (NID, Name) 2. Qualification (NID, ExamiD, QualifiedDate] 3. Exam (ExamID, NID, ExamName) 4. Exam (ExamID, ExamName) ‘Answer (Detailed Solution Below) Option 3: Exam (ExamID, NID, ExamName) DBMS Question 13 Detailed Solution The correct answer is “option 3”. EXPLANATION: ‘On converting the given ER diagram into the relational table, we will get three tables - Entity Table name Primary key Person Person( Name, NID) NID Exam Exam( ExamlD, ExamName ) ExamID Sinalifcdtiond Includes primary key of Qualification ualification( NID, ExamID, | son & Exam ie. NID, QualifiedDate ) ExamID Hence, Exam (ExamID, NID, ExamName) is not a possible relation. eS eee aca) See CR Chieti) aor cg MasterClasses Glee ey) Ponty mca es Crested Bes Download App Question 14 View this Question Online > For a multi-processor architecture, In which protocol a write transaction is forwarded to only those processors that are known to possess a copy of newly altered cache line? 1. Snoopy bus protocol _, 2. cacheNeberency protocol 3. Directory based protocol 4. None of the above Answer (Detailed Solution Below) Option 3: Directory based protocol DBMS Question 14 Detailed Solution Directory-based cache coherence is a type of cache coherence mechanism, where directories are used to manage caches in place of snoopy methods due to their scalability. For a multi-process cture, “ih the directory-based protocol, a write transaction is forwarded to only I ces that are known to possess a copy of newly altered cache line It can be used to target both the performance and scalability of directory systems. ee ane ica @ tse: Start Complete Exam Preparation ets ical) Paar Ponte] UES) Masterclasses Cissten ons ‘Question 15 View this Question Online > What is the full form of SQL? 1. Simple Query Language 2. Structured Queuing Language _ OP aver Language 4, Structured Queuing Lexicon Answer (Detailed Solution Below) Option 3: Structured Query Language cs DBMS Question 15 Detailed Solution © Key Points Nie SQL (Structured Query Language) is a standardi: Inguage that's used to he data in them. ... SQL became the de facto standard programming aes databases after they emerged in the late manage relational databases and perform variou! 1970s and early 1980s. xe> SQL is regularly use ly by database administrators, but also by developers writing data + integration scripts 4 salysts looking to set up and run analytical queries. The uses of SQL include modifying database table and index structures; adding, updating and deleting rows of data; and retrieving subsets of information from within a database for transaction processing and analytics applications. Hence the correct answer is Structured Query Language.

You might also like