You are on page 1of 30

Question Bank DB2

Cognizant Academy

Couse Name Test Type Module No.

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

Multiple Choice Questions

Q. No Question

1 Characteristics of a Relational Database 2 Column used to uniquely identify a Tuple

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

7 A relational database is perceived

8 Advantages of Database systems over File management systems are

9 Characteristics of Network Database


10 The database model which can be visualized as upside down tree structure

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

18 The integrity which specifies information allowed in a column is

19 Pre-processor for the host programming language

20 Provides necessary controls for managing concurrent access to data

21 The major components of the complex DB2 internal structure are


22 Which is a collection of direct access volumes, all of the same device type

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

26 IRLM stands for

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

30 Catalogue consists of regular tables which is

31 The database directory is same as Catalogue which is

32 The basic DB2 objects are

33 Database is a collection of

34 Which of the following should be defined for each database?

35 A database can occupy


36 Logical address space on secondary storage to hold one or more tables is called as

37 One of the following option is not a type of tablespace

38 In Simple table space a page can have rows from

39 A Simple tablespace

40 In Segmented tablespace, each segment contains

41 Segmented tablespace

42 Partitioned Table spaces primarily used for

43 Which of the following is LOCKSIZE parameters?


44 Which of the following is not a Tablespace Parameter?

45 The logical derivation of a table from other table/tables is


46 Which is the Unit of I/O operation

47 What is Query Management Facility (QMF) ?


48 Which one supports the online execution of SQL statements from a TSO terminal

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

53 Foreign key constraints are specified using

54 Using ALTER we can change the specifications of

55 Using ALTER command we


56 Which commands grants and Revokes the Table, Plan, Database privileges

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

64 IS NULL clause checks

65 Which of the following Function type is available in DB2


66 Which of the following is an example of Aggregate function 67 Which of the following is an example of Scalar function

68 Duplicates are removed from the result set using

69 Sorting the records are done using

70 Which one of the following is true about ORDER BY?

71 Grouping the records can be done by


72 Eliminating the groups from the Result set is done by using

73 Which of the following is true?

74 Which of the following is true about GROUP BY?

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

79 Only matching rows are retrieved in

80 The inner query can return more than one value when the outer query uses

81 The query which works in Bottom-to-Top fashion is

82 The nested select statement refers back to the columns in Previous Select statements in

83 EXISTS is preferred over IN in correlated sub-query, when

84 Which of the following is true about UNION?

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

95 Host variables can be used in

96 Host variables can be used in

97 DCLGEN can be issued for

98 The output of DCLGEN command contains

99 DCLGEN output is added to the COBOL program using

100 SQLCA is

101 SQLCA is updated

102 SQLCODE = 0 is

103 SQLCODE = 100 is

104 SQLCODE > 0 is

105 SQLCODE < 0 is


106 SQLCA contains which of the following fields?

107 Indicator variables are used for

108 Indicator variables are defined in Working storage as

109 Indicator variable < 0 indicates

110 Failure to code or check null values gives SQLCODE

111 Cursors are used for


112 Which one of the following command is used to define a cursor

113 In cobol, Defining a cursor is done generally in

114 In cobol, opening a cursor is done in

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

123 Which one of the following is the input to Compilation step?


124 The output of Binding step is

125 Binding does which one of the following

126 When Binding a DBRM to a Package, Plan contains

127 Package is

128 Which of the following is a characteristic of a Package

129 The binding parameter Isolation specifies


130 Which of the following is a type of Isolation level

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?

138 For execution of a DB2 Cobol program we need

139 Which one of the following is a DB2 Utility?


140 The Integrity of DB2 data structures are checked using which of the DB2 utility?

141 Check utility checks the


142 This utility is used to create an imagecopy for the complete tablespace or a partition of tablespace

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.

146 If a job terminates in any phase other than UTILINIT,

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

150 EXPLAIN provides information about

151 Locking services are provided by which of the MVS subsystem 152 Db2 contains how many catalogued tables?

153 Optimizer

154 Optimizer evaluates which of the following factors?

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

Represent ed in terms of Entities and attributes Primary Key Records Entity

Unknown Space Hierarchic al Network Group of Collection records of data

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

option 3 option 1 option 1 option 2 option 1 option 4

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 Buffer services manager Database services Records System services

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

None of the above Data manager Buffer Manager Runtime supervisor

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

None of the above

option 1

accessible by SQL statement s STOGRO UP, DATABAS E, TABLESP ACES STOGRO UP STOGRO UP, TABLESP ACES

not accessible by SQL statement s RECORD S, STOGRO UP, DATABAS E Index

used for internal purpose only STOGRO UP, RECORD S, TABLESP ACES

None of the above

option 1 & option 3

None of the above Entities STOGRO UP, BUFFERP OOL

option 1 option 3

Tables BUFFERP VIEW, OOL, TABLESP TABLESP ACES ACES

option 4

only one disk space

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

option 3 option 3 option 1

Indexspac Dataspac Tablespac e e e Segmente Multiple d Simple 1 table only Decrease s the Concurren cy 2 table only

More than None of 1 table the above

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

option 4 option 4 option 3 option 2

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

GRANT ALTER REVOKE UPDATE CREATE GRANT DCL DDL

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 _

option 1 option 3 & option 4

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 1 option 4 option 1 option 2

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

Default sorting is Descendi ng SEGREG ATE BY HAVING clause

None of the above ARRANG E BY None of the above

option 4 option 2 option 3

WHERE is used on a column as well as aggregate d data

GROUP BY cannot HAVING appear is used on without aggregate HAVING d data clause

GROUP BY cannot appear without WHERE 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

can be used interchang None of eably the above

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 1 & None of 2 the above

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 2 option 4 option 1 option 4 option 1 option 2

option 4

option 3 option 2 option 1

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

SQL DECLARE TABLE' All of the statement above

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

Execution Successfu was not l Data not successful execution found

option 3

Execution Successfu was not l Data not successful execution found

option 4

Execution Successfu was not l Data not successful execution found

option 1

Execution was not successful SQLCOD E

Successfu l execution SQLERR M

Data not found All of the above

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

option 4 option 2 option 1 option 3 option 4 option 2

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

Checks correctnes s of table & Column definitions and SQL syntax

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

Can be executed if it contains only one Executabl version of e by itself DBRM

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

None of the above

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 4 option 3 option 2 option 1

None of the above ALLOCAT E& DEALLOC ATE

option 1

option 3

All of the above ACTION Only load module All of the above EXPLAIN

option 4 option 2

option 2 option 4 option 3

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

option 2 option 3 option 2

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

All of the above None of the above

option 1 option 2 option 3

EXPLAIN CHECK SYSTABL ES SYSPLAN Whether SORT is required

option 2

All of the above

option 4

Runtime Database supervisor manager IRLM 43 35

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

CPU cost I/O cost

Db2 catalog statistics

All of the above

option 4

Runtime Database Db2 supervisor manager catalog

IRLM

option 3

Target Audience : ELT Session : End of Module

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)

Topics Easy Marks Qs 0 0 0

Applicati Difficult Marks Qs 3 1 3 1 3 1 Easy Marks 0 0 0

T1 T2 T3 Total

Difficult Marks Qs 2 1 2 1

18

Category Application wledge + Difficult ehension + Difficult hension + Average Others

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)

Application Easy Average Qs Marks Qs 3 1 3 1 3 1 18(6)

Difficult Marks Qs 3 1 3 1 3 1

Difficult Marks Qs 0 0 3 1

Easy Marks Qs 0 0 0

plication Difficult Marks Qs 0 0 0 6(2)

Total Marks

50(20)

You might also like