DB2 Question
DB2 Question
Cognizant Academy
DB2 <Pre-Test/ Post-Test> Module Name Topics Covered Database & RDBMS concepts DB2 Overview DB2 objects and Data types INTRODUCTION TO DB2 Introduction to SQL Tools - QMF and SPUFI SQL - DDL SQL - DCL SQL - DML (Simple Select) Functions Sorting & Grouping records QUERYING DATABASE AND Joins & Subqueries OTHER DB2 OBJECTS Correlated Subquery & Union SQL - DML (Update & Delete) Indexes View, Alias & Synonyms Coding the Application Pre-compilation Compiling & Linking APPLICATION Binding PROGRAMMING Execution Application Development Guidelines DB2 Utilities DB2 Security, Catalog Tables and Optimizer
Q. No Question
3 Entity-Relationship model is a logical representation of 4 The row that contains an entry for each attribute is called 5 The value of Null is
6 DB2 is a
11 Hierarchical Database handles Column or combination of columns which has unique values but not selected as primary key and is not 12 part of primary key is 13 Column of a table used to establish relationship with other table and present itself in all the tables is 14 How many normalization are possible?
15 Normalization is done to remove Every foreign key in the first table must either match a primary key in the second table or wholly null is
16 called
17 Rule that states no column that is part of primary key can have a null value is
The Subsystem which controls connections to other MVS subsystems and handles system start-up, 23 shutdown and operator communication is
24 The sub components which does the definition, retrieval and update of DB2 data
25 Part of MVS subsystem and general purpose lock manager that aids in Data integrity
27 When the Program executes first time the control goes to the This component does all the operations such as search, retrieval, update index maintenance and
28 Physical database
29 Component responsible for the physical transfer of data between external storage and Virtual Memory
33 Database is a collection of
39 A Simple tablespace
41 Segmented tablespace
49 SQL is composed of
50 Which of the following is a example of DDL 51 Which of the following is a example of DCL 52 Which of the following is a example of DML
57 What happens when a column is omitted in the INSERT statement and the Column is not NULL?
58 Single row select is possible using which one of the following in the WHERE clause
59 Multi row select is possible using which one of the following in the WHERE clause
60 Which of the Clauses can be used in conjunction with WHERE clause?
"SELECT * FROM EMP WHERE EMPNO BETWEEN '150' AND '200'". Above query selects 61 employees with EMPNO
"SELECT * FROM EMP WHERE EMPNO IN ('150' , '200')". Above query selects employees with
62 EMPNO
63 Which of the following special characters are used along with LIKE clause
75 The difference between Having and Where clause For one or more tables being joined, both matching and non matching rows are returned. This type of
76 join is called
77 All rows from the 1rst table plus matching rows in the 2nd table are retrieved in
78 All rows from the 2nd table plus matching rows in the 1st table are retrieved in
80 The inner query can return more than one value when the outer query uses
82 The nested select statement refers back to the columns in Previous Select statements in
85 UNION can be replaced by following logical operator if the selects are from only one table
86 For selecting data from multiples tables the following is used
It combines 2 sets of rows into a single set composed of all the rows in either or both of original sets 87 without duplicates
88 Which one of the following is the Index parameters?
89 This command is used to give another name for the table, which is private to the uses who created it
90 It is the local name provided for the remote tables.
91 In Dynamic SQL
92 Host variables is a 93 Host variables are used in embedded SQL prefixed wih 94 Which of the following is used to produce Host variables
100 SQLCA is
102 SQLCODE = 0 is
Following command is used to return data from result table one row at a time and assigns the value to 115 Host variable
116 This command releases all the resources used by the cursor
117 The cursor should be defined with which of the following clause for Updation?
118 Update cursors cannot be used if Select statement contains
119 Following command registers the current unit of work The SQL statements and DB2 related INCLUDE members are commented out and it is replaced by
120 CALL statement in
121 DBRM is created after If there is a mismatch between the Timestamp in modified source code and DBRM, it gives runtime 122 error of
127 Package is
131 The Page lock is released as soon as another page is accessed in which of the following Isolation?
132 All page locks are released only when COMMIT is executed in which of following Isolation
Retrieved row or page is locked until the end of Unit of work. No other program can modify the data but 133 new rows can be inserted. This type of locking is called
134 These parameters specifies when to Acquire and Release Tablespace locks
135 Which of the following Acquire and Release parameter is most preferred for DB2 batch program?
136 VALIDATE parameter refers to the method of checking 137 Which one of the following is NOT a Binding parameter?
Every successful execution of COPY utility places atlease one row that indicates the status of Image 143 copy, in which table?
144 The Utility to restore the Db2 Tablespaces and indexes to a specific instance is
145 The bulk inserts into DB2 table are accomplished using this Utility.
This utility is used to collect statistical information about DB2 tables, tablespaces, partitions, indexes 147 and columns Using this utility, we can obtain the details of the access path chosen by Db2 optimizer for SQL 148 statements When EXPLAIN is requested, the access path that DB2 chooses are put in coded format into the 149 following table
151 Locking services are provided by which of the MVS subsystem 152 Db2 contains how many catalogued tables?
153 Optimizer
Optimizer gets the information pertaining to the state of tables that will be accessed by SQL statements 155 from
Option 1
Option 2
Option 3
Option 4
Correct Answer
Child Tables were It supports allowed to many to have many more than relationshi one ps parent Composit Alternate e Key Key Tables Data Tuple Domain Zero Relational database As a set of tables
A single table acts as a root Foreign Key Entities Relation None of the above None of the above None of the above
option 3
Data redundan Single cy View Child tables were allowed to have more than one parent
Data Concurren dependen option 1 & option cy cy option 3 Child may only have one parent but a parent can have multiple option 1 & option children 2 None of the above option 2 1-1 Relationsh ip option 1 Alternate Key option 4 Alternate Key option 3 2 option 2
Network model supports many-tomany relationshi ps Hierarchic Network al 1-M M-1 relationshi Relationsh p ip Foreign Composit Key e Key Composit Unique e Key Key 3 5
Can be visualized an upside down tree of data Relational M-M Relationsh ip Unique Key Foreign Key 4
Partial Multi functional Transitive valued dependen dependen dependen All of the cies cies cies above Entity integrity Entity integrity Entity integrity Data manager System service. System services Tablespac e Referentia Domain l Integrity integrity Referentia Domain l Integrity integrity Referentia l Integrity Buffer manager Locking service None of the above None of the above
option 4
option 2
option 1
Domain None of integrity the above Precompil er Bind Distribute Database d data service facility
option 3 option 3
option 2
Database Locking services service Locking service Runtime supervisor IMS Resource Lock Manager
Database System services services Database manager Inter Resource Location Manager Buffer manager Inter resource Locking Manager File manager File manager
Data option 1 & option manager 2 Storage Group option 4 Distribute d data facility option 3 Distribute d data facility option 2
IRLM
option 4
option 1
Runtime Buffer supervisor Manager Runtime Data supervisor manager DiskMana Buffer ger manager
option 1
option 2
File manager not accessible accessible accessible by SQL by by SQL statement applicatio statement s n program s
option 2
option 1
accessible by SQL statement s STOGRO UP, DATABAS E, TABLESP ACES STOGRO UP STOGRO UP, TABLESP ACES
used for internal purpose only STOGRO UP, RECORD S, TABLESP ACES
option 1 option 3
option 4
More than one disk space but disk spaces should be in same STOGRO UP
More than one disk space and disk spaces need not be in same STOGRO None of UP the above None of the above Partitione d
Indexspac Dataspac Tablespac e e e Segmente Multiple d Simple 1 table only Decrease s the Concurren cy 2 table only
option 3
Increases Decrease the Increases s Concurren Redundan redundan cy cy cy Rows Rows Rows from from only from only many None of 1 table 2 tables tables the above Decrease Increases Decrease s the Increases the s Concurren Redundan Concurren redundan cy cy cy cy Small tables Very large More than None of tables 1 table the above
option 1
option 1
option 3
option 2
TABLESP PAGE ACE ANY LOCKSIZ E PCTFREE ERASE Records Record Active set View Page
All of the above INDEX None of the above None of the above
Byte It allows end users to enter SQL Used for queries to developer produce a s to check variety of It is an SQL reports MVS- and statement and VMs or view graphs as based table a result of query tool details this query Embedde Query d SQL SPUFI Manager DDL DCL
Primary key can change the width of a column Privilege & Revoke INSERT fails Foreign Key Foreign Key BETWEE N > 150 & < 200
Foreign key can change datatype of the column Grant & Revoke Zero is inserted Alternate Key Alternate Key IS NULL >=150 & <=200
It supports the online execution of SQL statement s from a TSO option 1 & option terminal 3 All of the above option 2 All of the DML above option 4 option 2 & option REVOKE CREATE 4 DROP DELETE option 1 DELETE DROP option 3 None of DML the above option 2 Primary and Foreign None of key the above option 3 cannot cannot change change the width datatype of a of the option 3 & option column column 4 Grant & None of Drop the above option 2 Space is None of inserted the above option 1 Primary Option 1 & option 2 & option Key 3 3 Primary Option 1 & Key 2 option 1 All of the IN above option 4 >150 & >=150 & <=200 <200 option 2
in the in the range 150 range 151 None of 150 & 200 to 200 to 199 the above NULL values only * NULL & SPACES % NULL & ZERO _
All of the above All of the Aggregate Scalar Arithmetic above TIMESTA AVG DECIMAL HEX MP COUNT LENGTH SUM MIN NO DUPLICA None of TES UNIQUE DISTINCT the above ORDER GROUP ARRANG BY BY SORT BY E BY
option 3 option 1
Only Column Only number in Column the Select name can column be list can be specified specified along with along with ORDER ORDER BY BY ORDER GROUP BY BY WHERE WITH clause clause
GROUP BY cannot HAVING appear is used on without aggregate HAVING d data clause
option 2
GROUP BY cannot be used if there is no aggregate function in Select list Having is used on aggregate data and Where is used on column
GROUP BY cannot be used if the column on which grouping is done, is not in Select list Having is used on column and Where is used on aggregate d data
No other Table column apart from Grouping column can appear in the Select All of the list above
option 4
option 1
Right All of the Inner Join Outer join Outer Join above Left outer Right Full Outer join Outer Join Inner Join join Left outer Right Full Outer join Outer Join Inner Join join Left outer Right join Outer Join NonEquality equality operators operators Noncorrelated Correlated subquery subquery Noncorrelated Correlated subquery subquery there is a need to check only Column the value existence returned of by nested matching query do criteria not matter Full Outer Inner Join join Comparati ve None of operators the above Option 1 & None of 2 the above Option 1 & None of 2 the above
option 2
option 1
option 2
option 3
option 4
option 1
option 2
option 3
Each column of the first result set must be either same data type as correspon The two ding result set column in should the contain second or It retrieves same no. convertibl distinct All of the columns e record above None of AND OR NOT the above UNION All of the UNION JOIN ALL above UNION None of UNION ALL JOIN the above FREEPA All of the CLUSTER ERASE GE above SYNONY None of M ALIAS VIEWS the above SYNONY None of M ALIAS VIEWS the above Statement s can Access Hard change Path is not coded in throughou determine the t the d before applicatio program Option 1 & execution n program execution 3 Defined in SQL Working Columns statement Storage None of in Table s variable the above : ^ % DCLGEN QMF SPUFI Platinum in the in the INTO Column WHERE clause of list of clause of Option SELECT SELECT SELECT 1&3 input of input of SET VALUES INTO clause of clause of clause of All of the UPDATE INSERT FETCH above Single Multiple Single Multiple table table view View
option 4
option 4
option 4 option 1
Host structure COPY statement DB2 Communi cation area after the execution of program Successfu l execution with warning Successfu l execution with warning Successfu l execution with warning Successfu l execution with warning SQLWAR N
Host variable
option 4
INCLUDE ADD None of statement Statement the above Contains Host variables after each SQL statement execution
option 2
Executabl None of e SQL the above after each update statement execution after each insert statement execution
option 1
option 2
option 3
option 4
option 1
option 2 option 4
Checking successful completio Checking n of SQL null values statement Alphanum Numeric eric variable variable Valid Null value value is is retrieved retrieved
Checking how many records updated COMP variable Spaces are retrieved
Checking how many records deleted Signed numeric variable Zero is retrieved
option 1
option 3
option 2
-805 -818 Column Row level Set level level processin processin processin None of g g g the above DECLARE DEFINE InputProcedure Output division section InputWorking Output Storage section Section Get Fetch OPEN Working Storage Section File section Retrieve ASSIGN File section Procedure division Select
-305
-811
option 1
option 2 option 1
option 3
Close Release Where current of Set ORDER BY UNION Rollback Linking Step Commit
Deallocate Free For None of update of the above All of the JOIN above None of Update the above
Compilati Precompil Binding on step ation step step Linking Step -811 None of the above None of the above
option 3
Precompil Compilati Binding ation step on step step -805 -818 Modified Object source module code DBRM Applicatio Load Object n Plan module module -913
option 1 option 3
option 2 option 1
Performs authorizati Creates on applicatio All of the validation n Plan above Reference to Physical location of Reference None of Package to DBRM the above
option 4
Access Path
option 2
Has to be bound to a Plan before execution Remote data access is Increases Versioning not Bind time is possible possible Mode of creating How to Mode of the use the Page applicatio DB2 locking n Plan resource Cursor Repeatabl Read Stability e Read Stability Repeatabl Read Cursor e Read Stability Stability Read Repeatabl Cursor Stability e Read Stability Read Repeatabl Cursor Stability e Read Stability ACQUIRE ACQUIRE AND AND VALIDAT RELEASE E parameter parameter s s ACTION USE & ALLOCAT DEALLOC E & USE & ATE COMMIT COMMIT DB2 Existence access of the Validity of authorizati table table on FLAG AUTHID DEGREE Plan & Plan & DBRM & Object Load Load module module module RECOVE CHECK R LOAD VALIDAT RUNSTA E TS CHECK
option 3
None of the above How the rows should be retrieved All of the above Uncommit ed Read Uncommit ed Read Uncommit ed Read
option 2
option 1
option 3
All of the above ACTION Only load module All of the above EXPLAIN
option 4 option 2
Delete invalid rows and Referentia copies l integrity Consisten them to between cy of DB2 exception All of the two tables indexes table above RECOVE COPY LOAD REORG R SYSIBM.S SYSIBM.S YSPROC SYSIBM.S YSROUTI EDURES YSCOPY NES RESTOR RECOVE E REORG R COPY LOAD INSERT SYSIBM.S YSUTILITI ES LOAD None of the above
option 4 option 1
The table space must restored first using RECOVE R utility REORG RUNSTA TS SYSPRO CEDURE S Type of access of particular tables
LOAD utility The table automatic space ally takes needs to care of be Restoratio reorganize n of table d space RUNSTA RECOVE TS R REORG PLAN_TA BLE Order in which tables are joined
option 2
option 4
Buffer manager 48 38
option 3 option 1
determine s most efficient optimizes way to the SQL access code data
estimates the cost of physically retrieving and writing the None of option 2 & option data the above 3
option 4
IRLM
option 3
Category Application Knowledge + Difficult Comprehension + Difficult Comprehension + Average Others Knowledge Average Marks Qs 1 1 1 1 1 1 7(5) Comprehension Easy Average Marks Qs Marks Qs 0 2 1 0 2 1 0 0 13(5)
T1 T2 T3 Total
Difficult Marks Qs 2 1 2 1
18
Weigtage 3 2 3 2 1 Application Easy Average Marks Qs Marks Qs 0 0 0 3 1 0 0 6(2) Application Average Marks Qs 0 3 1 3 1 6(2)
Difficult Marks Qs 3 1 3 1 3 1
Difficult Marks Qs 0 0 3 1
Easy Marks Qs 0 0 0
Total Marks
50(20)