Home > Archive > SQL server exams > November 2002 > Coco's Question of the Weeks #19





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Coco's Question of the Weeks #19
cocolocopolo

2002-11-05, 2:37 pm

I made a copy on one of the training question from www.courseprep.com
as following:

You're conducting a class to help some junior-level developers hone their database-development skills. You enter a discussion with them about local and global variables, and are trying to clarify the differences between the two. Which of the following statements can you always make about these two kinds of variables? (Select two).

A. Global variables are really functions.
B. All values returned by them are specific to the object context.
C. They use different characters to denote themselves.
D. All values returned by them are specific to the connection context.
E. Both of them are available to call connections.

They show the answers are 'A' and 'E' (with explanation).

But, unfortunately, I just feel confused because I 'think' the answer
must be 'c' and 'D'.

Please advise.
MNF

2002-11-05, 5:28 pm

I would select A) and C)
Answer D) is not correct because some system functions are specific not to connection, but to some other system state.
Eg @@CPU_BUSY (returns the time in milliseconds that the CPU has spent working since Microsoft® SQL Server™ was last started) is server instance specific, not session specific.
I am not sure what they mean in E) by "call connections". But local variables defined in procedure are not available outside the stored procedure, so the answer doesn't look right.
What was their explanation?

Also note , that term "global variables" is out-of-date in T-SQL, but is used in DTS packages with completely different meaning.
cocolocopolo

2002-11-06, 1:22 am

Thanks dear MNF.

I copy/paste 'whole' thing as follows:

You're conducting a class to help some junior-level developers hone their database-development skills. You enter a discussion with them about local and global variables, and you are trying to clarify the differences between the two.
Which of the following statements can you always make about these two kinds of variables? (Select two.)
A. All values returned by them are specific to the connection context.
B. Global variables are really functions.
C. All values returned by them are specific to the object context.
D. Both of them are available to all connections.
E. They use different characters to denote themselves.

Correct Answers: B & D

Explanation:

The variable constructs offered by SQL Server give the developer a great deal of flexibility and resources when developing T-SQL scripts to perform any number of tasks. Variables have two scopes: local (specific to the current connection) and global (equally available to all connections). Both types of variables use the @ character for a prefix, once for local variables and twice for global ones. While both types of variables are equally available to all connections, local variables need to be explicitly declared by a given connection before being referenced.
Each type of variable carries some unique properties. Some global variables, for instance, return values specific to the given connection; @@ERROR, for example, always shows the error code returned by the connection's most recent statement. Some global variables are specific to the current database; @@IDENTITY, for example, always returns the highest identity value generated for any table within the current database and connection.
Sponsored Links





Free Braindumps | MCSE braindumps software forum

Copyright 2003 - 2008 examnotes.net