Você está na página 1de 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 SQL INTRODUCTION TO DB2 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 Binding APPLICATION 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 afterbetween the Timestamp in modified source code and DBRM, it gives runtime If there is a mismatch 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 133 but 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 155 statements from

Option 1

Option 2 Option 3 Option 4

Correct Answer

Child Tables It supports were many to allowed to many have more relationshi than one ps parent Composite Alternate Key Key Tables Data Tuple Domain

Represent ed in terms of Entities A single and table acts attributes as a root Primary Key Records Entity Foreign Key Entities Relation None of the above None of the above

option 3

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

Zero Unknown Space Relational Hierarchic database al Network As a set of Group of tables records Data redundanc Single y View

Collection None of of data the above

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

Child tables were allowed to have more than one parent Network

Network model supports many-tomany relationshi ps Hierarchic al

Can be visualized an upside down tree of data Relational

1-M M-1 M-M 1-1 relationshi Relationsh Relationsh Relationsh p ip ip ip Foreign Composite Unique Alternate Key Key Key Key Composite Unique Foreign Alternate Key Key Key Key 3 5 4 2

option 1 option 4 option 3 option 2

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 Referential Domain Integrity integrity Referential Domain Integrity integrity Referential Domain Integrity integrity Buffer manager Locking service Database services Database services None of the above None of the above None of the above

option 4

option 2

option 1

option 3 option 3

Precompil er Bind Database service Buffer manager Records System services

Distributed data facility option 2 Data option 1 & option manager 2 Storage Group option 4 Distributed data facility Distributed data facility

Database Locking services service Locking service

option 3

Database System services services

option 2

Runtime Database Buffer supervisor manager manager IMS Resource Lock Manager Inter Resource Location Manager Inter resource Locking Manager File manager File manager File manager

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 accessible by SQL statement s

option 1

option 2

option 2

not accessible accessible by by SQL application statement None of program s the above

option 1

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

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

used for internal purpose only

None of the above

option 1 & option 3

STOGRO UP, RECORD S, TABLESP None of ACES the above Tables BUFFERP OOL, TABLESP ACES Entities STOGRO UP, BUFFERP OOL

option 1 option 3

STOGRO UP Index STOGRO UP, VIEW, TABLESP TABLESP ACES ACES

option 4

More than More than one disk one disk space and space but disk disk spaces spaces need not should be be in in same same only one STOGRO STOGRO disk space UP UP Indexspac Tablespac e Dataspace e Multiple 1 table only Segmente d Simple 2 table only

None of the above None of the above Partitioned

option 3 option 3 option 1

More than None of 1 table the above

option 3

Decreases Increases the the Increases Decreases Concurren Concurren Redundan redundanc cy cy cy y Rows from Rows from Rows from only 1 only 2 many None of table tables tables the above Decreases the Increases Concurren Redundan cy cy Small tables Increases the Decreases Concurren redundanc cy y

option 1

option 1

option 3

Very large More than None of tables 1 table the above

option 2

PAGE

TABLESP ACE ANY

All of the above INDEX None of the above None of the above

option 4 option 4 option 3 option 2

LOCKSIZ E PCTFREE ERASE Records Record Active set View Page Byte

It allows end users to enter SQL Used for queries to developer produce a s to check variety of SQL reports It is an statement and MVS- and s or view graphs as VM- based table a result of query tool details this query Embedde Query d SQL SPUFI Manager

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 DDL DCL DML above option 4 option 2 & option GRANT ALTER REVOKE CREATE 4 REVOKE UPDATE DROP DELETE option 1 CREATE GRANT DELETE DROP option 3 None of DCL DDL DML the above option 2 Primary and Foreign key cannot change the width of a column Grant & Drop Space is inserted Primary Key Primary Key IN >150 & <=200

Primary key

Foreign key

None of the above

option 3

can can change change the width datatype of a of the column column Privilege & Grant & Revoke Revoke INSERT Zero is fails inserted Foreign Alternate Key Key Foreign Alternate Key Key BETWEE N IS NULL > 150 & < >=150 & 200 <=200

cannot change datatype of the option 3 & option column 4 None of the above option 2 None of the above option 1 Option 1 & option 2 & option 3 3 Option 1 & 2 option 1 All of the above option 4 >=150 & <200 option 2

in the range 150 150 & 200 to 200 * NULL values only

in the range 151 None of to 199 the above option 3 & option option 1 % _ 4

All of the above All of the Aggregate Scalar Arithmetic above TIMESTA AVG DECIMAL HEX MP COUNT LENGTH SUM MIN NO DUPLICA TES UNIQUE ORDER GROUP BY BY None of DISTINCT the above ARRANG SORT BY E BY

NULL & NULL & SPACES ZERO

option 1 option 4 option 1 option 2

option 3 option 1

Only Column Only number in Column the Select name can column list be can be specified specified along with along with ORDER ORDER BY BY ORDER GROUP BY BY WHERE WITH clause clause

Default sorting is Descendin g 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 is appear 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 Full Outer join Outer Join Inner Join join NonComparati Equality equality ve None of operators operators operators the above Noncorrelated Correlated Option 1 & None of subquery subquery 2 the above Noncorrelated Correlated Option 1 & None of subquery subquery 2 the above there is a need to check only the existence of matching criteria

option 2

option 1

option 2

option 3

option 4

option 1

option 2

Column value returned by nested query do Option 1 & None of not matter 2 the above

option 3

Each column of the first result set must be either same data type as The two correspon result set ding should column in contain the It retrieves same no. second or distinct All of the columns convertible 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 FREEPAG All of the CLUSTER ERASE E 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 throughout determine the the d before application program Option 1 & execution program execution 3 Defined in SQL Columns statement in Table s : DCLGEN QMF INTO clause of SELECT input of SET clause of UPDATE Single table in the Column list of SELECT input of VALUES clause of INSERT Multiple table Working Storage variable ^ SPUFI in the WHERE clause of SELECT INTO clause of FETCH Single view

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

option 4

None of the above % Platinum

option 3 option 2 option 1

Option 1&3

option 4

All of the above Multiple View

option 4 option 1

Host structure

Host variable

SQL DECLARE TABLE' All of the statement above

option 4

COPY INCLUDE ADD None of statement statement Statement the above DB2 Contains Communic Host ation area variables after each after the SQL execution statement of program execution

option 2

Executabl None of e SQL the above after each update statement execution after each insert statement execution

option 1

option 2

Successful execution Execution with was not Successful Data not warning successful execution found Successful execution Execution with was not Successful Data not warning successful execution found Successful execution Execution with was not Successful Data not warning successful execution found Successful execution Execution with was not warning successful SQLWAR SQLCOD N E

option 3

option 4

option 1

Successful Data not execution found SQLERR All of the M above

option 2 option 4

Checking successful Checking completion how many Checking of SQL records null values statement updated Numeric variable Alphanum eric COMP variable variable

Checking how many records deleted Signed numeric variable

option 1

option 3

Valid Null value Spaces value is is are Zero is retrieved retrieved retrieved retrieved -305 -811 -805 -818 Column Row level Set level level None of processing processing processing the above DECLARE DEFINE InputProcedure Output division section InputOutput section Get Working Storage Section Fetch OPEN Working Storage Section File section Retrieve ASSIGN File section Procedure division Select

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

Compilatio Precompil Binding n step ation step step

option 3

Precompil Compilatio Binding Linking ation step n step step Step -913 -805 -818 -811 Object module Applicatio n Plan Modified source code Load module None of the above None of the above

option 1 option 3

DBRM Object module

option 2 option 1

Checks correctnes s of table & Column definitions and SQL syntax

Performs authorizati Creates on application All of the validation Plan above

option 4

Access Path

Reference to Physical location of Reference None of Package to DBRM the above

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 None of execution the above

option 3

Remote data access is Increases Versioning not None of Bind time is possible possible the above Mode of creating How to Mode of the use the Page application DB2 locking 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 AND RELEASE parameter s ACQUIRE AND VALIDATE parameter s ACTION 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

option 1

ALLOCAT USE & ALLOCAT E& DEALLOC E & USE & DEALLOC ATE COMMIT COMMIT ATE Existence of the Validity of table table FLAG AUTHID Plan & Object module CHECK Plan & Load module RECOVE R DB2 access authorizati All of the on above DEGREE ACTION DBRM & Load module LOAD Only load module All of the above

option 3

option 4 option 2

option 2 option 4

RUNSTAT VALIDATE S CHECK

EXPLAIN

option 3

Delete invalid rows and Referential copies 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 RECOVE RESTORE 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 RUNSTAT S REORG

LOAD utility The table automatic space ally takes needs to care of be Restoratio reorganize n of table d space RUNSTAT RECOVE S R

All of the above None of the above

option 1 option 2 option 3

EXPLAIN CHECK

SYSPRO CEDURE PLAN_TA SYSTABL S BLE ES SYSPLAN Type of access of particular tables Order in which Whether tables are SORT is joined 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 None of option 2 & option the data the above 3 Db2 catalog statistics All of the above

CPU cost I/O cost

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 ledge + Difficult hension + 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

lication Difficult Marks Qs 0 0 0 6(2)

Total Marks

50(20)

Você também pode gostar