T-SQL Dev Job

Description

Professional SQL Server Quiz on T-SQL Dev Job, created by Dariusz Spiewak on 22/03/2015.
Dariusz Spiewak
Quiz by Dariusz Spiewak, updated more than 1 year ago
Dariusz Spiewak
Created by Dariusz Spiewak almost 10 years ago
24
1

Resource summary

Question 1

Question
What are the essential properties of transactions?
Answer
  • Atomicity
  • Durability
  • Consistency
  • Manageability
  • Isolation
  • Co-operativity

Question 2

Question
A database that's gone through how many normalization forms is usually considered "good enough"?
Answer
  • 1
  • 2
  • 3
  • 4
  • 5

Question 3

Question
What are the benefits of stored procedures?
Answer
  • Execution plan retention/caching
  • Code reuse
  • Parameter sniffing
  • Improved security

Question 4

Question
What are the types of triggers?
Answer
  • INSTEAD OF
  • DELAYED
  • BEFORE
  • AFTER

Question 5

Question
Triggers take part in transactions.
Answer
  • True
  • False

Question 6

Question
Changes to table variables within a scope of a transaction get rolled back when the transaction is rolled back.
Answer
  • True
  • False

Question 7

Question
One should prefer using CHECK constraints to triggers.
Answer
  • True
  • False

Question 8

Question
DDL triggers are always AFTER triggers.
Answer
  • True
  • False

Question 9

Question
It's best practice to build views from other views. This promotes code reuse.
Answer
  • True
  • False

Question 10

Question
Some views can be used to update underlying tables.
Answer
  • True
  • False

Question 11

Question
Some views with aggregate functions in them can be used to update the underlying table(s).
Answer
  • True
  • False

Question 12

Question
An indexed view materializes data in the I/O subsystem and requires a clustered index.
Answer
  • True
  • False

Question 13

Question
Heaps are tables without a clustered index on them.
Answer
  • True
  • False

Question 14

Question
It's best practice to put clustered indexes on all tables, even the small ones.
Answer
  • True
  • False

Question 15

Question
The SCHEMABINDING option used with a view prevents schema changes to any underlying tables.
Answer
  • True
  • False

Question 16

Question
What is the main benefit of using an index on a table?
Answer
  • It prevents updating table statistics too frequently.
  • It stores the data in the table in an ordered state.
  • It makes writing queries easier.
  • It helps locate rows more quickly and efficiently.

Question 17

Question
For all intents and purposes, is a clustered index the same as the table itself?
Answer
  • YES
  • NO

Question 18

Question
You should always write queries in a way that takes advantage of set-based operations and avoid cursors.
Answer
  • True
  • False

Question 19

Question
A linked server configuration enables SQL Server to exec commands against an OLE DB data sources on remote servers.
Answer
  • True
  • False

Question 20

Question
A subquery can be used anywhere an expression can be used.
Answer
  • True
  • False

Question 21

Question
An INNER JOIN will always return at least one row of data.
Answer
  • True
  • False

Question 22

Question
It's best practice to always use LEFT OUTER JON instead of RIGHT OUTER JOIN and these two should not be used in the same query for the sake of clarity and ease of understanding.
Answer
  • True
  • False

Question 23

Question
If two tables, [A] with m rows and [B] with n rows, are CROSS JOINed, the result set has how many rows?
Answer
  • m + n - 1
  • m * n - 1
  • m * n
  • ( m - 1 ) * ( n - 1 )

Question 24

Question
In a FULL OUTER JOIN all of the rows of all of the joined tables are included, whether they are matched or not.
Answer
  • True
  • False

Question 25

Question
If you SELF JON a table, you have to use table aliases.
Answer
  • True
  • False

Question 26

Question
What are the types of SQL user-defined functions?
Answer
  • Scalar
  • Inline table-valued
  • Procedural
  • Functional
  • Multi-statement table-valued

Question 27

Question
An inline table-valued function is the best type of function from the point of view of function performance.
Answer
  • True
  • False

Question 28

Question
Multi-statement table-valued functions can have side-effects (e.g., update a table).
Answer
  • True
  • False

Question 29

Question
You can insert data returned straight from a stored procedure by using the INSERT...EXEC statement.
Answer
  • True
  • False

Question 30

Question
An identity field can temporarily be disabled (for instance, during a data load) by using one of the SET directives.
Answer
  • True
  • False

Question 31

Question
When a table is truncated, an identity field is reset to its starting value.
Answer
  • True
  • False

Question 32

Question
When all the rows in a table are DELETEd, the identity column gets reset to its initial value.
Answer
  • True
  • False

Question 33

Question
Every table should have a primary key constraint to uniquely identify each row and only one primary key constraint can be created for each table.
Answer
  • True
  • False

Question 34

Question
It is possible to change the length of a column defined as a PRIMARY KEY constraint without first deleting it and then re-creating it.
Answer
  • True
  • False

Question 35

Question
Which constraint enforces referential integrity?
Answer
  • UNIQUE KEY constraint
  • FOREIGN KEY constraint
  • CHECK constraint
  • TRIGGER

Question 36

Question
A CHECK constraint does not come into play if the relevant column receives a NULL value.
Answer
  • True
  • False

Question 37

Question
One should always prefer CHECK constraints to TRIGGERS.
Answer
  • True
  • False

Question 38

Question
The UNIQUE constraint is always implemented as a unique index on the relevant column(s).
Answer
  • True
  • False

Question 39

Question
What is the outcome of the expression under the default settings of SQL Server: SELECT ( 'a' + NULL ) ?
Answer
  • a
  • NULL
  • an error is returned

Question 40

Question
It is best practice not to use query/table hints in production code due to maintenance issues.
Answer
  • True
  • False

Question 41

Question
Which WHERE clause has the potential to benefit from an index?
Answer
  • WHERE Firstname LIKE '%N'
  • WHERE Firstname LIKE 'N%'
  • WHERE Firstname LIKE '%N%'

Question 42

Question
BCP lets one perform data imports and exports using a command-line utility.
Answer
  • True
  • False

Question 43

Question
Dirty reads can happen if you use the isolation level of READ COMMITTED.
Answer
  • True
  • False

Question 44

Question
The SERIALIZABLE isolation level is sufficient to ensure that no phantom rows appear within a transaction.
Answer
  • True
  • False

Question 45

Question
It is best practice to set FILLFACTOR to 100 (or 0) on an index in a read-only table.
Answer
  • True
  • False

Question 46

Question
The DENY permission takes precedence over all other permissions that a user might have for an object.
Answer
  • True
  • False

Question 47

Question
A lock can go from the row level to the page level.
Answer
  • True
  • False

Question 48

Question
The DELETE command has much more overhead in terms of log activity than TRUNCATE.
Answer
  • True
  • False

Question 49

Question
It is best practice to specify collation inline within a query.
Answer
  • True
  • False

Question 50

Question
The collation of a SQL Server can be changed without re-installation once the server has been installed.
Answer
  • True
  • False

Question 51

Question
The SNAPSHOT isolation level relies heavily on tempdb.
Answer
  • True
  • False

Question 52

Question
It is best practice to have a clustered index on a column against which range searches/scans are performed.
Answer
  • True
  • False

Question 53

Question
To improve performance of a view one can try to convert it into an indexed view.
Answer
  • True
  • False

Question 54

Question
A stale statistics can lead to the optimizer's not picking up an optimal query plan and underestimation of row counts.
Answer
  • True
  • False

Question 55

Question
Statistics can be created manually and automatically by SQL Server.
Answer
  • True
  • False

Question 56

Question
When a statistics is updated with the FULLSCAN option, it means that SQL Server will use data across all the rows to infer the distribution of values in the relevant column(s).
Answer
  • True
  • False

Question 57

Question
What is the outcome of the following query: SELECT 1 WHERE ( 1 = 0 )?
Answer
  • 1
  • 0
  • NULL
  • empty set (no rows)

Question 58

Question
Does the ORDER BY clause paired with TOP(100 PERCENT) used in a view guarantee the order of the returned rows?
Answer
  • YES
  • NO

Question 59

Question
If you use ORDER BY in a query, what you really get is not a relational set but a cursor.
Answer
  • True
  • False

Question 60

Question
It is best practice to use UNION ALL wherever possible instead of UNION due to performance reasons.
Answer
  • True
  • False

Question 61

Question
A deadlock can happen if two pieces of code access the same objects in reverse order at the same time.
Answer
  • True
  • False

Question 62

Question
Deadlock is a blocking situation but a blocking situation doesn't necessarily have to be a deadlock.
Answer
  • True
  • False

Question 63

Question
It is best practice to always use UNICODE data types (for textual values) regardless of whether the data comes from a UNICODE source or not.
Answer
  • True
  • False

Question 64

Question
It is best practice to always store integers as BIGINTs because this frees the developer from thinking about the smallest data type there could be to accommodate all the anticipated values.
Answer
  • True
  • False

Question 65

Question
The XML data type in SQL Server can be tied to an XML schema but this is not required.
Answer
  • True
  • False

Question 66

Question
The EXCEPT operator removes all duplicates from the result set and treats two NULL values as being equal.
Answer
  • True
  • False

Question 67

Question
In the new error-handling construct, TRY...CATCH, it is possible to use the FINALLY block known from other languages.
Answer
  • True
  • False

Question 68

Question
What does the SET XACT_ABORT ON; directive do?
Answer
  • It ensures that the isolation level of the code following it cannot be changed without raising an error.
  • It ensures that the developer must handle any rollbacks manually.
  • It ensures that a transaction is aborted without a rollback when an error is encountered and SQL Server raises error 825 (written to the error log).
  • It ensures that a transaction is automatically rolled back if an error occurs.

Question 69

Question
A table-valued variable can be used as an argument to a stored procedure only if it matches a user-defined table type and is marked as READONLY.
Answer
  • True
  • False

Question 70

Question
A subquery can contain an ORDER BY clause.
Answer
  • True
  • False

Question 71

Question
To return de-normalized data from a table/tables one can use the PIVOT operator.
Answer
  • True
  • False

Question 72

Question
To how many levels can you nest stored procedures (and managed code)?
Answer
  • 16
  • 32
  • 64
  • limited only by the memory of the system

Question 73

Question
You can only have one PRIMARY filegroup per database but as many user-defined filegroups as you want.
Answer
  • True
  • False

Question 74

Question
It is best practice to only have one log file per database.
Answer
  • True
  • False

Question 75

Question
Data is written to a log file in a sequential manner.
Answer
  • True
  • False

Question 76

Question
Log files can be placed into filegroups in much the same way as data files can.
Answer
  • True
  • False

Question 77

Question
It is best practice to always qualify the name of any object by the containing schema because this saves SQL Server the time it needs to look for this object otherwise.
Answer
  • True
  • False

Question 78

Question
One can put a non-clustered index an a heap or on a clustered table.
Answer
  • True
  • False

Question 79

Question
PowerShell cannot be used to change the collation of a server.
Answer
  • True
  • False

Question 80

Question
PowerShell can execute any SQL query against a SQL Server database.
Answer
  • True
  • False

Question 81

Question
It is best practice to prefer using ORs to ANDs when building queries.
Answer
  • True
  • False

Question 82

Question
One can configure log-shipping in such a way that the database to which logs are being shipped is usable for reporting purposes.
Answer
  • True
  • False

Question 83

Question
What's the outcome of the following: IF ( SELECT 1/0 WHERE ( 1 = 0 ) ) IS NULL PRINT 'A' ELSE PRINT 'B'; ?
Answer
  • error is raised
  • B
  • A

Question 84

Question
Temporary tables can have indexes defined on them and SQL Server can create statistics on them when it deems it appropriate.
Answer
  • True
  • False

Question 85

Question
A table variable can be pushed out to tempdb.
Answer
  • True
  • False

Question 86

Question
Parallel query execution plans are always better in terms of performance than single-threaded plans.
Answer
  • True
  • False

Question 87

Question
SQL Server supports directly a many-to-many relationship between tables.
Answer
  • True
  • False

Question 88

Question
CHECKPOINTS truncate the log when the database is in the FULL recovery model.
Answer
  • True
  • False

Question 89

Question
SQL Server supports regular expressions out-of-the-box.
Answer
  • True
  • False

Question 90

Question
Cardinality issues stem from the fact that statistics are stale and they almost always lead to the optimizer choosing suboptimal query execution plan.
Answer
  • True
  • False

Question 91

Question
A non-clustered index and tempdb can be created on a separate (physical) drive to improve performance.
Answer
  • True
  • False

Question 92

Question
Which aggregate function(s) do(es) ignore NULLs?
Answer
  • AVG( [ColumnName] )
  • SUM( [ColumnName] )
  • COUNT(*)
  • COUNT( [ColumnName] )
  • MAX( [ColumnName] )
  • COUNT_BIG( [ColumnName] )

Question 93

Question
Do you have to take a database offline to change the physical location of one of its files?
Answer
  • YES
  • NO

Question 94

Question
Can we insert data into a table on which the clustered index has been disabled?
Answer
  • YES
  • NO

Question 95

Question
It is best practice to use the WITH RECOMPILE directive for a stored procedure that will be executed infrequently and the data distribution in the table(s) it uses is very different for different parameters.
Answer
  • True
  • False

Question 96

Question
Which is the preferred way of checking if a table is not empty: 1) ( SELECT COUNT(*) FROM dbo.Table ) > 0 2) EXISTS ( SELECT * FROM dbo.Table ) 3) ( SELECT MAX( [ColumnName] FROM dbo.Table ) IS NOT NULL
Answer
  • 1)
  • 2)
  • 3)

Question 97

Question
SELECT...INTO will never lock system objects.
Answer
  • True
  • False

Question 98

Question
Does the order of columns in UPDATE statements matter in any way?
Answer
  • NO
  • YES

Question 99

Question
What are the special memory resident tables available when dealing with triggers?
Answer
  • DELETED
  • UPDATED
  • INSERTED

Question 100

Question
User-defined functions can raise errors inside their bodies the same way stored procedures can by calling the RAISERROR function.
Answer
  • True
  • False

Question 101

Question
In which database is the metadata about SQL Server Agent jobs stored?
Answer
  • master
  • tempdb
  • msdb
  • resource
  • model

Question 102

Question
Which database(s) should a DBA back up on a regular schedule?
Answer
  • master
  • msdb
  • tempdb

Question 103

Question
The fastest way to improve a performance of a SELECT query is to add a covering index to the table(s).
Answer
  • True
  • False

Question 104

Question
Transactions can span multiple batches, that is, pieces of code separated by GO.
Answer
  • True
  • False

Question 105

Question
Activity Monitor lets you see in real-time the most expensive queries executing on the machine.
Answer
  • True
  • False

Question 106

Question
It is best practice not to use Common Table Expressions as they usually perform much worse than plain subqueries.
Answer
  • True
  • False

Question 107

Question
Which function returns data with greater resolution?
Answer
  • GETDATE
  • SYSDATETIME

Question 108

Question
Is it true that errors whose severity level is below 11 cannot be handled by the TRY...CATCH construct?
Answer
  • YES
  • NO

Question 109

Question
Can the TRY...CATCH block catch object name resolution errors?
Answer
  • NO
  • YES

Question 110

Question
Does SELECT...INTO transfer indexes to the new table?
Answer
  • NO
  • YES

Question 111

Question
Is it true that each and every user in a database is automatically a member of the public role?
Answer
  • YES
  • NO

Question 112

Question
Can the dbo user in a database be denied access to a table?
Answer
  • NO
  • YES

Question 113

Question
When data is deleted from a table, SQL Server immediately reduces the size of the table.
Answer
  • True
  • False

Question 114

Question
Which functions operate on the XML data type in SQL Server?
Answer
  • query()
  • value()
  • exists()
  • is()
  • modify()
  • nodes()
  • length()
  • datatype()

Question 115

Question
In which system database are usernames and passwords (if any) stored?
Answer
  • model
  • msdb
  • master
  • distribution

Question 116

Question
Which are good properties of a clustered index?
Answer
  • Static
  • Narrow
  • Ever-increasing
  • Random

Question 117

Question
It is best practice to shrink log files on a regular basis.
Answer
  • True
  • False

Question 118

Question
Only a log backup can clear the log of inactive transactions and make space inside it reusable when the recovery model of a database is FULL or BULK_LOGGED.
Answer
  • True
  • False

Question 119

Question
How many different database recovery models does SQL Server support?
Answer
  • 1
  • 2
  • 3
  • 4
  • 19

Question 120

Question
Online index rebuilds are available in all editions of SQL Server except the Express one.
Answer
  • True
  • False

Question 121

Question
What's the outcome of the query: SELECT COALESCE(NULLIF(1, 1), 'A')?
Answer
  • A
  • NULL
  • conversion error

Question 122

Question
Which process is the CXPACKET wait type associated with?
Answer
  • Reading data from disk to cache
  • Executing parallel query plans
  • Flushing dirty pages to disk
  • Receiving asynchronous messages via SQL Server Broker

Question 123

Question
It is best practice to not create indexes on foreign key columns.
Answer
  • True
  • False

Question 124

Question
It is best practice not to give objects names that contain special characters or spaces.
Answer
  • True
  • False

Question 125

Question
It is best practice to turn off the AUTO CREATE and AUTO UPDATE of statistics and take care of them manually.
Answer
  • True
  • False

Question 126

Question
Which one is the preferred way of capturing the last inserted identity value in a session?
Answer
  • @@Indentity
  • SCOPE_IDENTITY()
Show full summary Hide full summary

Similar

70-458
Ben Odunjo
SQL Azure Identity Jumping
Mary Macdonald
Managing Master Data
wynand.coetzee77
Data Quality project to clean data
wynand.coetzee77
Deploy package to file system
wynand.coetzee77
Package Properties at Run Time
wynand.coetzee77
Script Components
wynand.coetzee77
DQS Permissions
wynand.coetzee77
BASES DE DATOS
Hernando Castro
INTELIGENCIAS MÚLTIPLES
Nadia Salazar
BASES DE DATOS
Shanella Percel