DB2 Programming MCQs

DB2 Programming MCQs

The following DB2 Programming MCQs have been compiled by our experts through research, in order to test your knowledge of the subject of DB2 Programming. We encourage you to answer these 100+ multiple-choice questions to assess your proficiency.
Please continue by scrolling down.

1: Which of the following is true about locking

A.   The data (row) is locked until a commit is executed to release the updated data.

B.   All of the above

C.   Locking prevents concurrent users from accessing inconsistent data.

D.   Locking is a process that is used to ensure data integrity.

2: When you don't know the format of an SQL statement within a program you're writing, what is a good option?

A.   Dynamic SQL.

B.   T-SQL.

C.   Static SQL.

D.   NoSQL.

3: Which statement about tablespaces is true?

A.   Dropping a tablespace will not only remove all tables of the tablespace itself, but also all indexes created on these tables, even tho ugh they are stored separately in their own indexspace.

B.   A tablespace is divided in units called pages , which hold one or more rows of a table. If a row of 8000 bytes is placed in a 4K page, th e row will automatically be split over two pages.

C.   A tablespace is divided in units called pages , which hold one or more rows of a table. If a row of 8000 bytes is placed in a 4K page, the page will automatically be resized to 8K.

D.   When creating a tablespace, one must indicate either the storage group or the bufferpool to be used by this tablespace. If neither is defined, the creation of the tablespace will fail.

4: Which subquery operator compares a single value to every member of set of value.

A.   Any

B.   All

C.   In

D.   Between

5: SELECT empname , paygrade , salary FROM emp, salgrade WHERE salary BETWEEN lowsal AND highsal ORDER BY paygrade The above is an example of a

A.   Outer join

B.   None of the above

C.   Non equi join

D.   Inner join

6: Which of the following statements concerning locking on TABLESPACE level is correct?

A.   When a TABLESPACE is S-locked by another user, a U-lock can be placed. However, an X-lock is not compatible and will have to wait until the S-lock is released.

B.   When a TABLESPACE is S-locked by another user, neither a U lock or an X lock is com- patible on this level. In both cases an I lock (IU lock, IX lock) will be placed to indicate that a U lock or X lock is waiting to be placed.

C.   When a TABLESPACE is S-locked by another user, a U lock can be placed. However, an X lock is not compatible. A IX lock (Intent to eXclusively use) will be placed to indicate that a X lock is waiting to be placed.

D.   When a TABLESPACE is S-locked (Shared use) by another user, a U lock (Update use) can be placed. However, an X lock (eXclusive use) on this level will force the S lock to be dropped, its transaction to be rolled-back to be able to place the X lock.

7: If the SQLCA is included in the program, which of the following host-variables is NOT known and as such unavailable for the program?

A.   SQLSTATE

B.   SQLWARN

C.   SQLCODE

D.   SQLNUM

8: Which of the following is not a DB2 datatype

A.   Vargraphic

B.   Long Vargraphic

C.   Graphic

D.   Long Graphic

9: When a column has an extension of WITH DEFAULT NULL and a unique index is created on this column, what will be the effects on the possible null values in that column?

A.   C & F

B.   There is still a single null allowed, since it is unique as such.

C.   Nulls are no longer allowed, since nulls aren’t unique.

D.   It has no influence on the possible null values; DB2 doesn’t consider nulls when it comes to an index.

10: Given the following cursor declaration: DECLARE CLASSUPDATE CURSOR FOR SELECT CSTITLE FROM T001.CLASSS FOR UPDATE OF CDUR Which of the following embedded SQL statements will use this cursor correctly?

A.   UPDATE T001.CLASSS SET CDUR = 5

B.   UPDATE T001.CLASSS SET CDUR = 5 WHERE CURRENT OF CLASSUPDATE

C.   UPDATE SET CDUR = 5 WHERE CURRENT OF CLASSUPDATE

D.   UPDATE T001.CLASSS C SET C.CSTITLE = 'New Title' WHERE CURRENT OF CLASSUPDATE

11: Consider the following SQL statement, executed by user S001: CREATE VIEW BOSTON_TEAMS AS SELECT * FROM TEAMS WHERE STATE = 'MA' User S002 has INSERT authority on this view, what would happen if he tries to insert a row into this view, where the STATE field of that line contains a value of ‘IN’?

A.   The row will be inserted only if the user has an authority to insert on table S001.TEAMS, but it will never show up in a SELECT on this view.

B.   The row won’t be inserted because the field STATE doesn’t have the value ‘MA’.

C.   The row will be inserted in the table S001.TEAMS, but it will never show up in a SELECT on this view.

D.   You can’t insert into a view, because views don’t contain actual data; they’re just virtual windows on base tables.

12: Which of the following is true about the EXPLAIN command

A.   It can be used in BIND step(for embedded SQL).

B.   EXPLAIN is used to display the access path as determined by the optimizer for a SQL statement

C.   It can be used in SPUFI(for single SQL statement)

D.   C,D & E

13: When declaring a foreign key on a table, referencing an existing primary key with complete definition, what might differ between foreign key and primary key?

A.   The data type of the included columns.

B.   The order of the included columns.

C.   The nullability of one of the included columns.

D.   B & E

14: When a user has a SELECT authorization on a certain base table, and he creates a view on that table alone, then which of the following is true?

A.   He/She only has a SELECT authorization on that view.

B.   He/She will face an authorization error when trying to create the view

C.   He/She can only execute an UPDATE as long as the definition of the view is not exceeded.

D.   He/She also has DELETE authorization on that view because he/she is the creator of the view.

15: Given the statement: CREATE TABLE t1 (c1 INTEGER NOT NULL,c2 INTEGER,PRIMARY KEY(c1),FOREIGN KEY(c2) REFERENCES t2) How many non-unique indexes are defined for table t1?

A.   3

B.   0

C.   1

D.   2

16: When is it necessary to precompile DB2 REXX procedures before running them?

A.   Only sometimes, because they vary from static to dynamic SQL.

B.   Never because they use dynamic SQL.

C.   Every time because they use static SQL.

D.   Only when you're using a Java wrapper.

17: Can static SQL statements be changed without altering the program itself?

A.   Yes, but the program has to be altered.

B.   Yes. DB2 is a fully dynamic program, accepting all forms of SQL.

C.   No.

D.   Yes, but the statements have to be changed as well.

18: SQL statements embedded into an application is called what?

A.   Dynamic SQL.

B.   PL/SQL

C.   T-SQL.

D.   Static SQL.

19: How are ODBC calls binded?

A.   They are not binded because they use standard functions to execute SQL.

B.   They are binded at compile time.

C.   They are pre-process binded.

D.   They are binded using standard functions in SQL.

20: What must be done to a DB2 application before it can run, and why?

A.   It has to be binded first so it can recognize SQL statements.

B.   It has to be compressed first so it can recognize SQL statements.

C.   It has to be encrypted first so it can recognize SQL statements.

D.   It has to be compiled first so it can recognize SQL statements.

21: What is an example of a benefit of using the Java programming language?

A.   Once you write the program, it can be used with any other program or software.

B.   There is no benefit to programming with Java.

C.   Once you write the program, it acts like a stored procedure.

D.   Once you develop an application, it can be run anywhere.

22: What is a benefit of concurrency in SQL application programming?

A.   Increase of data conflicts.

B.   Minimization of data access conflicts.

C.   Increasing data access points.

D.   Multi-threaded compiling.

23: Consider the following: DECLARE MYCURS CURSOR FOR SELECT * FROM MYTABLE WHERE COL1 > :NUM Which of the following embedded SQL statements will NOT generate an error?

A.   SELECT MYCURS INTO :HOSTMYTABLE:IND

B.   FETCH MYCURS INTO :HOSTMYTABLE:IND

C.   SELECT * INTO :HOSTMYTABLE:IND FROM MYCURS

D.   FETCH * INTO :HOSTMYTABLE:IND FROM MYTABLE

24: What is the name of the effect when a system continues to receive work, but is down?

A.   Auger effect.

B.   Faraday effect.

C.   Stormdrain effect.

D.   Hutchins effect.

25: When coding in a language that requires a host variable declaration, what must precede it?

A.   ;varchar

B.   ;hostvar

C.   ;iostream.h

D.   ;hostchar

26: Which of the following can be accomplished with a single UPDATE statement?

A.   Updating multiple tables

B.   Updating a view consisting of joined tables

C.   Updating multiple tables based on a WHERE clause

D.   Updating a table based on a sub-select using joined tables

27: What is a lightweight web application created from multiple sources?

A.   A crackup.

B.   A mashup.

C.   A mixup.

D.   A smashup.

28: Which statement about an index is NOT true?

A.   An index has its own INDEX SPACE, automatically created

B.   A clustering index influences the physical sequence of data in the tablespace.

C.   An index always has a balanced tree structure.

D.   The name of an index can be mentioned in a Select statement, to improve the performance of the query.

29: Why would you receive a command response of NORMAL when the attachment facility is not available?

A.   The database was disabled.

B.   The exit was disabled.

C.   The exit was not ENABLE STARTED.

D.   The exit was not enabled.

30: Before executing SQL statements, you want to know whether the CICS attachment facility is available. How do you check?

A.   You check in the CICS configuration file.

B.   Use the EXTRACT EXIT command in your application, or INQUIRE EXITPROGRAM in version 4.0.

C.   You shut down DB2 and check in the CICS kernal.

D.   You check in the CICS configuration menu.

31: What are two examples of steps that must be taken before coding an application with embedded static or dynamic SQL statements?

A.   Transcribe, and bind.

B.   Compile, and bind.

C.   Pretranscribe, and bind.

D.   Precompile, and bind.

32: How many indexes will be created by the following statement? Create table Smarterer { Col1 int not null primary key, Col2 char (64), Col3 char (32), Col4 int not null, Constraint c4 unique (Col4,Col1) }

A.   3

B.   2

C.   1

D.   0

33: What's the output of a DB2 Bind

A.   DB2 Application plan

B.   DB2 Catalog

C.   Database request module

D.   Load Module

34: What must a SELECT statement be coded within?

A.   A STATIC CURSOR

B.   A DECLARE CURSOR.

C.   A SELECT CURSOR

D.   A DEFINE CURSOR

35: How does one prepare a Java program that contains JDBC methods?

A.   Use the “javago” command.

B.   Use the “javac” command.

C.   Use the “DB2java” command.

D.   Use the “JBDC” command.

36: Which of the following is not one of the types of authorizations associated with a DB2 user?

A.   Current SQLID

B.   Primary Authorization ID

C.   SQL Authorization ID

D.   Secondary Authorization ID

37: What are the three primary development environments for DB2?

A.   WebSphere Studio, Adobe Acrobat Studio, and IBM Optim Development Studio.

B.   PhotoData Studio, Microsoft Visual Studio, and IBM Optim Development Studio.

C.   Silverlight Studio, Microsoft Visual Studio, and IBM Optim Development Studio.

D.   WebSphere Studio, Microsoft Visual Studio, and IBM Optim Development Studio.

38: What technique can DB2 use to more effectively interpret data from EXPLAIN tables?

A.   Networked processing.

B.   Parallel processing.

C.   Unilateral processing.

D.   Quadratic processing.

39: Which of the following is the correct syntax for an input variable of a PARMLIST string?

A.   DCL SINTAR BIN FAXED(15);

B.   (15)DCL SINTVAR BIN FIXED;

C.   DCL SINvTAR BIN FIXED(15);

D.   DCL SINTVAR BIN FIXED(15);

40: What are three examples of languages you can use to program in DB2?

A.   HTML, MSDOS, Python.

B.   PHP, Ruby on Rails, and Haskell.

C.   Perl, Python, and PL/SQL.

D.   COBOL, Fortran, and Perl.

41: What is SQLCA used for?

A.   It parses stored procedures.

B.   It checks the code of SQL statements.

C.   It checks the execution of SQL statements.

D.   It checks the locking of SQL statements.

42: What is a host structure?

A.   A group of host variables that an SQL statement can refer to by using a single name.

B.   A single host variable that an SQL statement can refer to by using a single name.

C.   A variable group of hosts that an SQL statement can refer to by using any name.

D.   A group of host variables that an SQL statement can process.

43: Which of the following DB2 objects allows multiple users to access data in a table with each only being able to access certain subsets of the data?

A.   Mirrored Tables

B.   Indexes

C.   Aliases

D.   Views

44: What is a stored procedure?

A.   An SQL statement to execute a program.

B.   A program to execute SQL statements.

C.   A method for using wrappers to encode SQL.

D.   An SQL statement.

45: Which of the following statements eliminates all but one of each set of repeated rows inthe final result table?

A.   SELECT DISTINCT * FROM t1

B.   SELECT UNIQUE * FROM t1

C.   SELECT * FROM DISTINCT T1

D.   SELECT UNIQUE (*) FROM t1

46: A role is a database entity that groups together one or more privileges. Which of the following is true for a "role"

A.   All of the above

B.   A role cannot be a primary authorization ID.

C.   A role cannot be set by using a SET CURRENT SQLID statement.

D.   A role can be the schema qualifier of an object. However, when it is used as a schema qualifier, a role is considered to be a character string and does not add any implicit schema privileges (ALTERIN, CREATEIN, or DROPIN) to this role.

47: A declared temporary table is used for which of the following purposes?

A.   To store intermediate results

B.   To share result sets between applications

C.   To create a backup copy of a database or table space

D.   To provide an area for database manager sorts

48: What type of SQL operator would you use to combine the results of 2 Select statements while retaining the duplicates

A.   Inner Join

B.   Intersect

C.   Union All

D.   Union

49: Which of the following occurs if a DB2 procedure or application ends abnormally during an active unit of work?

A.   The unit of wok moves to pending state

B.   The unit of work moves to CHECK_PENDING

C.   The unit of work remains active

D.   The unit of work is rolled back

50: Which of the following is an example of a programming method not used in DB2 programming?

A.   Hadoop

B.   OBDC

C.   Dynamic SQL.

D.   Static SQL