RSS Feed

Multiple Choice Questions - Sequence Objects

Multiple Choice Questions - Sequence Objects


1. The default data type for a sequence object is . . . . . .

A) int
B) bigint
C) tinyint
D) decimal

2. Sequence objects can be used as an optional way to generate unique numeric values in a table.

A) True
B) False

3. Sequence numbers are generated outside the scope of transactions; they are . . . . . . . . . . . whether the transaction is committed or rolled back.

A) not consumed
B) consumed

4. Sequence objects are not part of any table definition. They can be used across multiple tables.

A) True
B) False

5. Below a table named P is created. Then a sequence is created. Values are inserted into the table using sequence.
CREATE TABLE P
(
ID int,
Name varchar(255)
);
CREATE SEQUENCE MySequence
AS Integer
Start with 0
Increment by 1

Insert into P values (NEXT VALUE for MySequence, 'AA');
Insert into P values (NEXT VALUE for MySequence, 'BB');
Insert into P values (NEXT VALUE for MySequence, 'CC');

Insert into P values (NEXT VALUE for MySequence, 'AA');
Insert into P values (NEXT VALUE for MySequence, 'BB');
Insert into P values (NEXT VALUE for MySequence, 'CC');
Select * from P;

What will be the values in table P?

A)
ID Name
0 AA
1 BB
2 CC
0 AA
1 BB
2 CC

B)
ID Name
0 AA
1 BB
2 CC
1 AA
2 BB
3 CC

C)
ID Name
0 AA
1 BB
2 CC
3 DD
4 EE
5 FF

D)
ID Name
0 AA
1 BB
2 CC
3 AA
4 BB
5 CC


6. Sequence object can be restarted by using . . . . . . . .

A) NO CYCLE
B) CONTROL SEQUENCE
C) ALTER SEQUENCE
D) RESTART SEQUENCE

7. Apart from T-SQL, you can create and manage sequence objects using the Sequence folder located under the . . . . . . . . . . node for the database in SSMS.

A) Sequence
B) Programability
C) General
D) Tools

8. The . . . . . . . clause specifies that the object should restart from the minimum value when its maximum value is exceeded.

A) Restart
B) MIN_MAX
C) CYCLE
D) None of above

9. A sequence object can be of the following data types . . . . .

A) tinyint
B) smallint
C) bigint
D) decimal
E) numeric
F) a, b, c, d
G) All of above

10. Sequence gives you guarantee that you won't have gaps.

A) True
B) False

Answers