Which of the following data types has the highest data type precedence?
A. INT
B. VARCHAR
C. DATETIME
D. FLOAT
E. NUMERIC
F. MONEY
ans :- Here is the order of data type precedence of the given options from highest to lowest: DATETIME, FLOAT, NUMERIC, MONEY, INT and VARCHAR.
2) What’s the maximum number of columns can you include in a SELECT statement?
A. 512
B. 1,024
C. 2,048
D. 4,096
ANS
Although the maximum number of columns a table can have is 1,024, the maximum number of columns that can be specified in a SELECT statement is 4,096.
3) Which of the following is NOT a valid description of the public role?
A. The public role captures all default permissions for users in a database.
B. The public role cannot be dropped.
C. The public role is contained in every database, including msdb, tempdb, model, and all user databases except in the master database for security purposes.
D. The public role cannot have users, groups, or roles assigned to it.
ans:-
All of these statements are valid description of the public role except for the third option because the public role is also contained in the master database.
4)
What will be the output of the following statement?
SELECT CHARINDEX(‘is’, ‘Missississippi’, 0)
A. 0
B. 2
C. NULL
D. Statement will generate an error. The CHARDINDEX function only accepts 2 parameters.
Your Answer : D
Correct Answer : B
Explanation:
The CHARINDEX function returns the starting position of the specified expression in a character string. The third parameter of the CHARINDEX functions is the character position to start searching for the first parameter in the second parameter. If the starting location is 0, the search starts at the beginView text definitions are stored in which system table?
A. sysobjects
B. syscolumns
C. syscomments
D. sysviews
Your Answer : A
Correct Answer : C
Explanation:
The syscomments system table contains entries for each view, rule, default, trigger, CHECK constraint, DEFAULT constraint and stored procedure. The text column contains the original SQL definition statements.
ning of the second parameter.
5)
View text definitions are stored in which system table?
A. sysobjects
B. syscolumns
C. syscomments
D. sysviews
Your Answer : A
Correct Answer : C
Explanation:
The syscomments system table contains entries for each view, rule, default, trigger, CHECK constraint, DEFAULT constraint and stored procedure. The text column contains the original SQL definition statements.
6)
What will be the output of the following statement?
SELECT CHARINDEX(‘is’, ‘Missississippi’, 3)
A. 2
B. 5
C. 8
D. 9
E. -1
F. 0
Your Answer : B
Correct Answer : B
Explanation:
The CHARINDEX function returns the starting position of the specified expression in a character string. The third parameter of the CHARINDEX functions is the character position to start searching for the first parameter in the second parameter.
7
What will be the result of the following statement?
SELECT CAST(-1 AS DATETIME)
A. 1900-01-01 00:00:00.000
B. 1899-01-01 00:00:00.000
C. 1899-12-31 00:00:00.000
D. 1752-01-01 00:00:00.000
E. 1752-12-31 00:00:00.000
F. The statement will generate an error. Only positive integer values can be converted to a DATETIME data type.
Your Answer : F
Correct Answer : C
Explanation:
A DATETIME data type is stored internally in SQL Server as two 4-byte integers. The first 4 bytes store the number of days before or after the base date of January 1, 1900. Given this, a value of 0 corresponds to January 1, 1900 and a value of -1 corresponds to 1 day before the base date, December 31, 1899.
What will be the result of the following statement?
SELECT CAST(-1 AS DATETIME)
A. 1900-01-01 00:00:00.000
B. 1899-01-01 00:00:00.000
C. 1899-12-31 00:00:00.000
D. 1752-01-01 00:00:00.000
E. 1752-12-31 00:00:00.000
F. The statement will generate an error. Only positive integer values can be converted to a DATETIME data type.
Your Answer : F
Correct Answer : C
Explanation:
A DATETIME data type is stored internally in SQL Server as two 4-byte integers. The first 4 bytes store the number of days before or after the base date of January 1, 1900. Given this, a value of 0 corresponds to January 1, 1900 and a value of -1 corresponds to 1 day before the base date, December 31, 1899.