Explore topic-wise InterviewSolutions in Current Affairs.

This section includes 7 InterviewSolutions, each offering curated multiple-choice questions to sharpen your Current Affairs knowledge and support exam preparation. Choose a topic below to get started.

1.

What Is A Dbrm, Plan ?

Answer»

DBRM: Data BASE Request MODULE, has the SQL statements extracted from the host language PROGRAM by the pre-compiler.
PLAN: A RESULT of the BIND process. It has the executable code for the SQL statements in the DBRM.

DBRM: Data Base Request Module, has the SQL statements extracted from the host language program by the pre-compiler.
PLAN: A result of the BIND process. It has the executable code for the SQL statements in the DBRM.

2.

What Is Alter ?

Answer»

SQL COMMAND USED to CHANGE the DEFINITION of DB2 objects.

SQL command used to change the definition of DB2 objects.

3.

How Does Db2 Determine What Lock-size To Use?

Answer»

1. Based on the lock-size GIVEN while CREATING the tablespace
2. Programmer can direct the DB2 what lock-size to use
3. If lock-size ANY is specified, DB2 usually chooses a lock-size of PAGE

1. Based on the lock-size given while creating the tablespace
2. Programmer can direct the DB2 what lock-size to use
3. If lock-size ANY is specified, DB2 usually chooses a lock-size of PAGE

4.

What Are The Various Locking Levels Available?

Answer»

PAGE, TABLE, TABLESPACE

PAGE, TABLE, TABLESPACE

5.

Where Do You Specify Them ?

Answer»

ISOLATION LEVEL is a PARAMETER for the BIND PROCESS.

ISOLATION LEVEL is a parameter for the bind process.

6.

What Is The Difference Between Cs And Rr Isolation Levels?

Answer»

CS: RELEASES the lock on a page after use
RR: RETAINS all LOCKS acquired till END of transaction

CS: Releases the lock on a page after use
RR: Retains all locks acquired till end of transaction

7.

What Are The Isolation Levels Possible ?

Answer»

CS: Cursor Stability
RR: REPEATABLE READ

CS: Cursor Stability
RR: Repeatable Read

8.

How Do You Do The Explain Of A Dynamic Sql Statement?

Answer»

1. Use SPUFI or QMF to EXPLAIN the DYNAMIC SQL STATEMENT
2. Include EXPLAIN command in the EMBEDDED dynamic SQL statements

1. Use SPUFI or QMF to EXPLAIN the dynamic SQL statement
2. Include EXPLAIN command in the embedded dynamic SQL statements

9.

Explain Has Output With Matchcols = 0. What Does It Mean?

Answer»

A NON MATCHING INDEX SCAN if ACCESSTYPE = I.

A non matching index scan if ACCESSTYPE = I.

10.

Where Is The Output Of Explain Stored?

Answer»

In userid.PLAN_TABLE

In userid.PLAN_TABLE

11.

What Do You Need To Do Before You Do Explain?

Answer»

MAKE SURE that the PLAN_TABLE is CREATED under the AUTHID.

Make sure that the PLAN_TABLE is created under the AUTHID.

12.

What Is Explain?

Answer»

EXPLAIN is USED to DISPLAY the access path as DETERMINED by the optimizer for a SQL statement. It can be used in SPUFI (for single SQL statement) or in BIND step (for embedded SQL ).

EXPLAIN is used to display the access path as determined by the optimizer for a SQL statement. It can be used in SPUFI (for single SQL statement) or in BIND step (for embedded SQL ).

13.

How Can You Quickly Find Out The # Of Rows Updated After An Update Statement?

Answer»

CHECK the VALUE STORED in SQLERRD(3).

Check the value stored in SQLERRD(3).

14.

Name Some Fields From Sqlca.

Answer»

SQLCODE, SQLERRM, SQLERRD

SQLCODE, SQLERRM, SQLERRD

15.

How Is A Typical Db2 Batch Program Executed ?

Answer»

1. Use DSN utility to run a DB2 batch program from NATIVE TSO.

An example is SHOWN:
DSN SYSTEM(DSP3)
RUN PROGRAM(EDD470BD) PLAN(EDD470BD) LIB('ED 01T.OBJ.LOADLIB')
END
2. Use IKJEFT01 utility program to run the above DSN COMMAND in a JCL.

1. Use DSN utility to run a DB2 batch program from native TSO.

An example is shown:
DSN SYSTEM(DSP3)
RUN PROGRAM(EDD470BD) PLAN(EDD470BD) LIB('ED 01T.OBJ.LOADLIB')
END
2. Use IKJEFT01 utility program to run the above DSN command in a JCL.

16.

Will Precompile Of An Db2-cobol Program Bomb, If Db2 Is Down?

Answer»

No. Because the PRECOMPILER does not REFER to the DB2 CATALOGUE TABLES.

No. Because the precompiler does not refer to the DB2 catalogue tables.

17.

Is Declare Table In Dclgen Necessary? Why It Used?

Answer»

It not necessary to have DECLARE TABLE STATEMENT in DCLGEN. This is USED by the pre-compiler to validate the table-name, view-name, COLUMN name ETC., during pre-compile.

It not necessary to have DECLARE TABLE statement in DCLGEN. This is used by the pre-compiler to validate the table-name, view-name, column name etc., during pre-compile.

18.

Is It Mandatory To Use Dclgen? If Not, Why Would You Use It At All?

Answer»

It is not mandatory to use DCLGEN.
USING DCLGEN, helps detect wrongly spelt column names etc. during the pre-compile stage itself ( because of the DECLARE TABLE ). DCLGEN being a tool, would generate accurate HOST variable definitions for the table reducing chances of error.

It is not mandatory to use DCLGEN.
Using DCLGEN, helps detect wrongly spelt column names etc. during the pre-compile stage itself ( because of the DECLARE TABLE ). DCLGEN being a tool, would generate accurate host variable definitions for the table reducing chances of error.

19.

What Are The Contents Of A Dclgen?

Answer»
  1. EXEC SQL DECLARE TABLE statement which GIVES the layout of the table/view in terms of DB2 datatypes.
  2. A host LANGUAGE copy BOOK that gives the host variable definitions for the column names.

20.

What Is Dclgen

Answer»

Declarations GENerator: USED to create the host LANGUAGE COPY books for the table DEFINITIONS. Also creates the DECLARE table.

Declarations GENerator: used to create the host language copy books for the table definitions. Also creates the DECLARE table.

21.

What Is The Cobol Picture Clause For A Db2 Column Defined As Decimal(11,2)?

Answer»

PIC S9(9)V99 COMP-3.
NOTE: In DECIMAL(11,2), 11 indicates the size of the data TYPE and 2 indicates the PRECISION.

PIC S9(9)V99 COMP-3.
Note: In DECIMAL(11,2), 11 indicates the size of the data type and 2 indicates the precision.

22.

What Is The Cobol Picture Clause Of The Following Db2 Data Types: Date, Time, Timestamp?

Answer»

DATE: PIC X(10)
TIME : PIC X(08)
TIMESTAMP: PIC X(26)

DATE: PIC X(10)
TIME : PIC X(08)
TIMESTAMP: PIC X(26)

23.

What Is The Physical Storage Length Of Each Of The Following Db2 Data Types: Date, Time, Timestamp?

Answer»

DATE: 4bytes
TIME: 3bytes
TIMESTAMP: 10BYTES

DATE: 4bytes
TIME: 3bytes
TIMESTAMP: 10bytes

24.

How Do You Leave The Cursor Open After Issuing A Commit? ( For Db2 2.3 Or Above Only )

Answer»

USE WITH HOLD option in DECLARE CURSOR statement. But, it has not effect in psuedo-conversational CICS programs.

Use WITH HOLD option in DECLARE CURSOR statement. But, it has not effect in psuedo-conversational CICS programs.

25.

When You Commit, Is The Cursor Closed?

Answer»

Yes.

Yes.

26.

Can You Have More Than One Cursor Open At Any One Time In A Program?

Answer»

Yes.

Yes.

27.

Is Declare Cursor Executable?

Answer»

No.

No.

28.

What Happens When You Say Open Cursor?

Answer»

If there is an ORDER BY clause, rows are FETCHED, sorted and made available for the FETCH statement. Other WISE simply the cursor is placed on the first ROW.

If there is an ORDER BY clause, rows are fetched, sorted and made available for the FETCH statement. Other wise simply the cursor is placed on the first row.

29.

How Do You Specify And Use A Cursor In A Cobol Program?

Answer»

USE DECLARE CURSOR statement either in working storage or in procedure division(before OPEN cursor), to SPECIFY the SELECT statement. Then use OPEN, FETCH ROWS in a loop and finally CLOSE.

Use DECLARE CURSOR statement either in working storage or in procedure division(before open cursor), to specify the SELECT statement. Then use OPEN, FETCH rows in a loop and finally CLOSE.

30.

How Would You Retrieve Rows From A Db2 Table In Embedded Sql?

Answer»

EITHER by USING the single ROW SELECT statements, or by using the CURSOR.

Either by using the single row SELECT statements, or by using the CURSOR.

31.

What Is A Cursor? Why Should It Be Used?

Answer»

Cursor is a programming DEVICE that ALLOWS the SELECT to find a set of ROWS but return them one at a time.
Cursor should be used because the host LANGUAGE can DEAL with only one row at a time.

Cursor is a programming device that allows the SELECT to find a set of rows but return them one at a time.
Cursor should be used because the host language can deal with only one row at a time.

32.

What Are Correlated Subqueries?

Answer»

A subquery in which the inner ( nested ) QUERY refers back to the table in the OUTER query. Correlated SUBQUERIES MUST be evaluated for each qualified row of the outer query that is REFERRED to.

A subquery in which the inner ( nested ) query refers back to the table in the outer query. Correlated subqueries must be evaluated for each qualified row of the outer query that is referred to.

33.

Why Select * Is Not Preferred In Embedded Sql Programs?

Answer»

For THREE reasons:

  • If the table STRUCTURE is changed ( a field is ADDED ), the program will have to be modified.
  • Program MIGHT retrieve the COLUMNS which it might not use, leading on I/O over head.
  • The chance of an index only scan is lost.

For three reasons:

34.

What Is The Result Of This Query If No Rows Are Selected:

Answer»

SELECT SUM(SALARY)
FROM EMP
WHERE QUAL=‘MSC’;
NULL

SELECT SUM(SALARY)
FROM EMP
WHERE QUAL=‘MSC’;
NULL

35.

Consider The Employee Table With Column Project Null Able. How Can You Get A List Of Employees Who Are Not Assigned To Any Project?

Answer»

SELECT EMPNO
FROM EMP
WHERE PROJECT IS NULL;

SELECT EMPNO
FROM EMP
WHERE PROJECT IS NULL;

36.

What Do You Accomplish By Group By ... Having Clause?

Answer»

GROUP BY PARTITIONS the selected rows on the distinct values of the column on which you group by.
HAVING selects GROUPs which match the CRITERIA specified

GROUP BY partitions the selected rows on the distinct values of the column on which you group by.
HAVING selects GROUPs which match the criteria specified

37.

What Is The Meaning Of Underscore ( '-' ) In The Like Statement?

Answer»

MATCH for any SINGLE CHARACTER.

Match for any single character.

38.

When Do You Use A Like Statement?

Answer»

To do partial SEARCH e.g. to search employee by name, you NEED not specify the COMPLETE name; using LIKE, you can search for partial STRING matches.

To do partial search e.g. to search employee by name, you need not specify the complete name; using LIKE, you can search for partial string matches.

39.

What Is 'like' Used For In Where Clause? What Are The Wildcard Characters?

Answer»

LIKE is USED for PARTIAL string MATCHES. ‘%’ ( for a string of any character ) and ‘_’ (for any single character ) are the two wild card CHARACTERS.

LIKE is used for partial string matches. ‘%’ ( for a string of any character ) and ‘_’ (for any single character ) are the two wild card characters.

40.

Is Between Inclusive Of The Range Values Specified?

Answer»

Yes.

Yes.

41.

In The Where Clause What Is Between And In?

Answer»

BETWEEN SUPPLIES a RANGE of VALUES while IN supplies a LIST of values.

BETWEEN supplies a range of values while IN supplies a list of values.

42.

What Is The Restriction On Using Union In Embedded Sql?

Answer»

It has to be in a CURSOR.

It has to be in a CURSOR.

43.

What Is Union,union All?

Answer»

UNION : ELIMINATES duplicates
UNION ALL: RETAINS duplicates
Both these are USED to COMBINE the results of different SELECT statements.

UNION : eliminates duplicates
UNION ALL: retains duplicates
Both these are used to combine the results of different SELECT statements.

44.

What Is The Use Of Value Function?

Answer»

1. AVOID -ve SQLCODEs by handling nulls and zeroes in computations
2. Substitute a numeric VALUE for any nulls USED in computation

1. Avoid -ve SQLCODEs by handling nulls and zeroes in computations
2. Substitute a numeric value for any nulls used in computation

45.

How Do You Concatenate The Firstname And Lastname From Emp Table To Give A Complete Name?

Answer»

SELECT FIRSTNAME || ‘ ‘ || LASTNAME FROM EMP;

SELECT FIRSTNAME || ‘ ‘ || LASTNAME FROM EMP;

46.

My Sql Statement Select Avg(salary) From Emp Yields Inaccurate Results. Why?

Answer»

Because SALARY is not declared to have NULLS and the EMPLOYEES for whom the salary is not known are ALSO counted.

Because SALARY is not declared to have NULLs and the employees for whom the salary is not known are also counted.

47.

Can You Use Max On A Char Column?

Answer»

YES.

YES.

48.

What Are Aggregate Functions?

Answer»

Built-in MATHEMATICAL FUNCTIONS for USE in SELECT CLAUSE.

Built-in mathematical functions for use in SELECT clause.

49.

How Do You Retrieve The First 5 Characters Of Firstname Column Of Db2 Table Emp ?

Answer»

SQL QUERY : SELECT SUBSTR(FIRSTNAME,1,5) FROM EMP;

SQL Query : SELECT SUBSTR(FIRSTNAME,1,5) FROM EMP;

50.

How Do You Find The Maximum Value In A Column In Db2?

Answer»

USE SELECT MAX(...) .. in DB2 QUERY

Use SELECT MAX(...) .. in db2 query