0

databases Online Quiz - 36

Description: databases Online Quiz - 36
Number of Questions: 20
Created by:
Tags: databases
Attempted 0/20 Correct 0 Score 0

You want to track date and time of the last write access (INSERT, UPDATE) per row. How can you achieve that?

  1. Add a TIMESTAMP column to the table; SQL Server will automatically track date and time of every change.

  2. Add a DATETIME column to the table and assign getdate() as the default value.

  3. Add a DATETIME column to the table and write a trigger that sets its value.

  4. Add a UNIQUEIDENTIFIER column to the table and use it with SQL Server's built functions


Correct Option: C

What is the result of the following statement: select cast(floor(cast(@MyDateTime as float)) as datetime)

  1. Next Sunday relative to @MyDateTime

  2. Only date part of @MyDateTime

  3. Only time part of @MyDateTime

  4. Doesn't work because you cannot cast float to datetime


Correct Option: B

Which classes from the .NET Framework can be used in SQLCLR assemblies with permission set SAFE?

  1. All of them. Permission set SAFE just restricts the use of unmanaged code

  2. None. To use classes from the .NET Framework in SQL Server you need at least permission set EXTERNAL

  3. Some of them are tested specifically for the use within SQL Server, they can be used

  4. Permission sets have nothing to do with SQLCLR


Correct Option: C

How long does it approximately take to create a snapshot of a 100GB database on a state-of-the-art Quadcore server using RAID 5?

  1. A few seconds

  2. Approximately 5 minutes

  3. Usually approximately one hour; depends on the load on the server

  4. More than one hour but it is running in the background


Correct Option: A

What was a problem with navigational data access languages?

  1. The user had to have knowledge of the table and index structures

  2. Navigational data access was far slower than declarative access.

  3. Navigational access languages required the coder to embed their queries inside a procedural language shell.

  4. Navigational languages were far slower then SQL


Correct Option: A

Which is a major problem with SQL?

  1. SQL cannot support object-orientation

  2. The same query can be written in many ways, each with vastly different execution plans.

  3. SQL syntax is too difficult for non-computer professionals to use

  4. SQL creates excessive locks within the database


Correct Option: B

Which of the following is an important feature of relational databases and SQL?

  1. Independence of table relationships

  2. High speed of SQL

  3. Powerful GUI front-end

  4. Easy to install and use


Correct Option: B

Which of the following is an important consideration when tuning an SQL statement?

  1. The number of CPUs on the server

  2. The degree of parallelism on the tables

  3. The use of bitmap indexes

  4. The quality of the SQL optimization


Correct Option: D

Which of the following database design features is most important to SQL performance?

  1. Removal of data redundancy

  2. The introduction of data redundancy

  3. The introduction of non-first normal form relations

  4. The introduction of SQL*Plus


Correct Option: B

Index will not be used if ... Choose all that apply.

  1. NOT operator is used in the predicate

  2. IN Operator is used in the predicate

  3. Expression and/or functions are used on the indexed columns

  4. Predicate is skipped. However, the SELECT clause has indexed columns

  5. ORDER BY clause has NULL columns. However, NON UNIQUE index exists


Correct Option: A,C,E

Which of the following conditions will you use in a WHERE clause to select all last names that start with S?

  1. WHERE LastName = 'S*'

  2. WHERE LastName = 'S%'

  3. WHERE LastName LIKE 'S*'

  4. WHERE LastName LIKE 'S%'


Correct Option: D

AI Explanation

To select all last names that start with 'S', you would use the LIKE operator in the WHERE clause. The correct condition to use would be:

D. WHERE LastName LIKE 'S%'

Explanation:

  • Option A: WHERE LastName = 'S*' - This condition will only select last names that are exactly 'S*'. It will not select any last names that start with 'S'.
  • Option B: WHERE LastName = 'S%' - This condition will only select last names that are exactly 'S%' (where '%' is a wildcard that represents any number of characters). It will not select any last names that start with 'S' followed by more characters.
  • Option C: WHERE LastName LIKE 'S*' - This condition is similar to Option A and will only select last names that are exactly 'S*'. It will not select any last names that start with 'S'.
  • Option D: WHERE LastName LIKE 'S%' - This condition will select last names that start with 'S' followed by any number of characters. The '%' wildcard represents any number of characters, so this condition will select all last names that begin with 'S'.

Therefore, the correct answer is D. WHERE LastName LIKE 'S%'.

What is the best data type to store the birthdays of the US Presidents, starting with George Washington's birthday of February 22, 1732?

  1. DATETIME

  2. SMALLDATETIME

  3. INT

  4. VARCHAR


Correct Option: C

Which of the following is NOT a valid description of the public role?

  1. The public role captures all default permissions for users in a database.

  2. The public role cannot be dropped.

  3. The public role is contained in every database, including msdb, tempdb, model, and all user databases except in the master database for security purposes.

  4. The public role cannot have users, groups, or roles assigned to it.


Correct Option: C

AI Explanation

To answer this question, we need to understand the concept of the public role in a database.

Option A) The public role captures all default permissions for users in a database. - This option is correct. The public role is a special database role in SQL Server that contains all default permissions for users in a database. When a user is created without explicitly assigning any roles or permissions, they are automatically assigned the permissions of the public role.

Option B) The public role cannot be dropped. - This option is correct. The public role is a built-in role in SQL Server that cannot be dropped or removed from the database.

Option 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. - This option is incorrect. The public role is contained in every database, including msdb, tempdb, model, and all user databases, including the master database.

Option D) The public role cannot have users, groups, or roles assigned to it. - This option is correct. The public role is a fixed server role and cannot have users, groups, or other roles assigned to it directly. Its permissions apply to all users in the database.

Based on the explanations above, the correct answer is C. The public role is contained in every database, including msdb, tempdb, model, and all user databases, including the master database.

What's the maximum value can an INT data type hold?

  1. 2,147,483,647

  2. 2,147,483,648

  3. 4,294,967,295

  4. 4,294,967,296


Correct Option: A

What will be the result of the following SELECT statement SELECT 2000/02/25 + 4

  1. 2000/02/29

  2. 2000/03/01

  3. 44

  4. An error is generated. A DATETIME value and an INT value cannot be added together. Use the DATEADD function for this purpose.


Correct Option: C

What's the earliest date that can be stored in a DATETIME data type?

  1. January 1, 1643

  2. January 1, 1753

  3. January 1, 1863

  4. January 1, 1700

  5. January 1, 1800

  6. January 1, 1900


Correct Option: B

Which of the following fixed database roles can add or remove user IDs?

  1. db_accessadmin

  2. db_securityadmin

  3. db_setupadmin

  4. db_sysadmin


Correct Option: A

Which of the following data types has the least data type precedence?

  1. BIGINT

  2. FLOAT

  3. DECIMAL

  4. MONEY

  5. REAL

  6. NUMERIC


Correct Option: A

What's the maximum number of parameters can a SQL Server 2000 stored procedure have?

  1. 128

  2. 256

  3. 512

  4. 1,024


Correct Option: D

Which part of the following function definition will generate an error?CREATE FUNCTION dbo.Tomorrow ()RETURNS DATETIMEASBEGIN DECLARE @TodaysDate DATETIME SET @TodaysDate = GETDATE() SET @TodaysDate = DATEADD(DD, DATEDIFF(DD, 0, @TodaysDate), 0) RETURN DATEADD(DD, 1, @TodaysDate)ENDGO

  1. SET @TodaysDate = GETDATE()

  2. SET @TodaysDate = DATEADD(DD, DATEDIFF(DD, 0, @TodaysDate), 0)

  3. RETURN DATEADD(DD, 1, @TodaysDate)

  4. No error is generated. The function will be created.


Correct Option: A
- Hide questions