Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

5/13/2021 campuslink.

admin : HCM21_CPL_JAVA_05 : Tests & Quizzes

HCM21_CPL_JAVA_05    Tests & Quizzes

Tests & Quizzes

04_ASQL_Quiz2_SQL Advance 2
Show Feedback | Table of Contents

Part 1 of 1 -

Question 1 of 20
A _________________ is a program that performs some common action on database data and that 5.0 Points
is stored in the database.

A. trigger

B. stored procedure

C. pseudo file

D. None of the above is correct.

Reset Selection

Question 2 of 20
SQL Server program code that is executed after an SQL command has been processed is called 5.0 Points
a(n):

A. AFTER trigger.

B. BEGIN trigger.

C. INSTEAD OF trigger.

D. BEFORE trigger.

Reset Selection

Question 3 of 20
Stored procedures have the advantage of ………………… 5.0 Points

A. greater security

B. decreased network traffic

C. SQL optimized by the DBMS compiler

D. All of the mentioned options

https://gst.fsoft.com.vn/portal/site/b0d8cac9-9f19-4f09-9eb7-71661cf003c0/tool/e2c4d983-f0d7-4b16-b69b-7235434d4adb/jsf/delivery/beginTakingAss… 1/7
5/13/2021 campuslink.admin : HCM21_CPL_JAVA_05 : Tests & Quizzes

Reset Selection

Question 4 of 20
Your database contains two tables named DomesticSalesOrders and InternationalSalesOrders. 5.0 Points
Both tables contain more than 100 million rows. Each table has a Primary Key column named SalesOrderId.
The data in the two tables is distinct from one another. Business users want a report that includes aggregate
information about the total number of global sales and total sales amounts. You need to ensure that your
query executes in the minimum possible time. Which query should you use?

A. "SELECT COUNT(*) AS NumberOfSales, SUM(SalesAmount) AS TotalSalesAmount


FROM (
SELECT SalesOrderId, SalesAmount
FROM DomesticSalesOrders
UNION
SELECT SalesOrderId, SalesAmount
FROM InternationalSalesOrders
) AS p
"

B. "SELECT COUNT(*) AS NumberOfSales, SUM(SalesAmount) AS TotalSalesAmount


FROM DomesticSalesOrders
UNION ALL
SELECT COUNT(*) AS NumberOfSales, SUM(SalesAmount) AS TotalSalesAmount
FROM InternationalSalesOrders
"

C. "SELECT COUNT(*) AS NumberOfSales, SUM(SalesAmount) AS TotalSalesAmount


FROM (
SELECT SalesOrderId, SalesAmount
FROM DomesticSalesOrders
UNION ALL
SELECT SalesOrderId, SalesAmount
FROM InternationalSalesOrders
) AS p
"

D. "SELECT COUNT(*) AS NumberOfSales, SUM(SalesAmount) AS TotalSalesAmount


FROM DomesticSalesOrders
UNION
SELECT COUNT(*) AS NumberOfSales, SUM(SalesAmount) AS TotalSalesAmount
FROM InternationalSalesOrders
"

Reset Selection

Question 5 of 20
SQL Server 2000 stored procedures can: 5.0 Points

https://gst.fsoft.com.vn/portal/site/b0d8cac9-9f19-4f09-9eb7-71661cf003c0/tool/e2c4d983-f0d7-4b16-b69b-7235434d4adb/jsf/delivery/beginTakingAss… 2/7
5/13/2021 campuslink.admin : HCM21_CPL_JAVA_05 : Tests & Quizzes

A. support BEFORE, INSTEAD OF and AFTER types.

B. never be kept within the database.

C. be stored on the users' computer.

D. be kept within the database and invoked by application programs.

Reset Selection

Question 6 of 20
Which SQL trigger does SQL Server NOT support? 5.0 Points

A. AFTER

B. BEFORE

C. INSTEAD OF

D. SQL Server supports all three.

Reset Selection

Question 7 of 20
Embedded SQL is which of the following? 5.0 Points

A. Hard-coded SQL statements in a procedure.

B. Hard-coded SQL statements in a program language such as Java.

C. Hard-coded SQL statements in a trigger.

D. The process of making an application capable of generating specific SQL code on the fly.

Reset Selection

Question 8 of 20
You need to identify, within a given clause, if the month of February will contain 29 days for a 5.0 Points
specified year. Which object should you use?

A. Table-valued function

B. DML trigger

C. Scalar-valued function

D. Stored procedure

Reset Selection

Question 9 of 20
stored program that is attached to a table or view is called __________________ 5.0 Points

https://gst.fsoft.com.vn/portal/site/b0d8cac9-9f19-4f09-9eb7-71661cf003c0/tool/e2c4d983-f0d7-4b16-b69b-7235434d4adb/jsf/delivery/beginTakingAss… 3/7
5/13/2021 campuslink.admin : HCM21_CPL_JAVA_05 : Tests & Quizzes

A. a trigger

B. a CHECK constraint

C. a view

D. embedded SQL

Reset Selection

Question 10 of 20
SQL Server program code that is executed instead of an SQL command that needs to be processed 5.0 Points
is called a(n):

A. BEFORE trigger.

B. INSTEAD OF trigger.

C. AFTER trigger.

D. BEGIN trigger.

Reset Selection

Question 11 of 20
A function returns one value and has only output parameters. 5.0 Points

True
False
Reset Selection

Question 12 of 20
Triggers are stored blocks of code that have to be called in order to operate. 5.0 Points

True
False
Reset Selection

Question 13 of 20
You have been tasked to delete a number of Database Mail messages that have been sent. You 5.0 Points
need to delete all the emails that were sent more than one month ago. Which Transact-SQL statements
should you run?

A. "DECLARE @OneMonthAgo datetime = DATEADD(mm,-1,GETDATE())


EXEC msdb.dbo.sysmail_delete_log_sp @OneMonthAgo "

B. "DECLARE @OneMonthAgo datetime = DATEADD(mm,-1,GETDATE())


EXEC msdb.dbo.sysmail_delete_mailitems_sp @OneMonthAgo "

https://gst.fsoft.com.vn/portal/site/b0d8cac9-9f19-4f09-9eb7-71661cf003c0/tool/e2c4d983-f0d7-4b16-b69b-7235434d4adb/jsf/delivery/beginTakingAss… 4/7
5/13/2021 campuslink.admin : HCM21_CPL_JAVA_05 : Tests & Quizzes

C. "DECLARE @OneMonthAgo datetime = DATEADD(mm,-1,GETDATE())


EXEC msdb.dbo.sysmail_delete_log_sp @OneMonthAgo,'Success' "

D. "DECLARE @OneMonthAgo datetime = DATEADD(mm,-1,GETDATE())


EXEC msdb.dbo.sysmail_delete_mailitems_sp @OneMonthAgo,'Sent'"

Reset Selection

Question 14 of 20
Which of the three possible types of triggers does SQL Server support? 5.0 Points

A. AFTER only

B. INSTEAD OF and AFTER only

C. BEFORE only

D. INSTEAD OF only

Reset Selection

Question 15 of 20
A _______________ is a stored program that is attached to a table or a view. 5.0 Points

A. pseudofile

B. embedded SELECT statement

C. trigger

D. None of the above is correct.

Reset Selection

Question 16 of 20
What is not an advantage of stored procedures? 5.0 Points

A. Increased network traffic

B. Greater security

C. SQL can be optimized

D. Code sharing

Reset Selection

Question 17 of 20
The Enterprise manager cannot be used to modify stored procedures? 5.0 Points

True
False

https://gst.fsoft.com.vn/portal/site/b0d8cac9-9f19-4f09-9eb7-71661cf003c0/tool/e2c4d983-f0d7-4b16-b69b-7235434d4adb/jsf/delivery/beginTakingAss… 5/7
5/13/2021 campuslink.admin : HCM21_CPL_JAVA_05 : Tests & Quizzes

Reset Selection

Question 18 of 20
Which of the following is true concerning triggers? 5.0 Points

A. They have an event, condition, and action.

B. They execute against only some applications that access a database.

C. You do not create them with SQL.

Reset Selection

Question 19 of 20
Because SQL stored procedures allow and encourage code sharing among developers, stored 5.0 Points
procedures give database application developers the advantages of ……………...

A. less work

B. standardized processing

C. specialization among developers

D. All of the mentioned options

Reset Selection

Question 20 of 20
You need to determine the result of executing this code segment. 5.0 Points
DECLARE @RangeStart INT = 0;
DECLARE @RangeEnd INT = 10000;
DECLARE @RangeStep INT = 1;

WITH NumberRange(ItemValue)
AS (
SELECT ItemValue
FROM (SELECT @RangeStart AS ItemValue) AS t
UNION ALL
SELECT ItemValue + @RangeStep
FROM NumberRange
WHERE ItemValue < @RangeEnd)

SELECT ItemValue
FROM NumberRange
OPTION (MAXRECURSION 100)

Which result will be returned?

A. 101 rows will be returned with a maximum recursion error.

https://gst.fsoft.com.vn/portal/site/b0d8cac9-9f19-4f09-9eb7-71661cf003c0/tool/e2c4d983-f0d7-4b16-b69b-7235434d4adb/jsf/delivery/beginTakingAss… 6/7
5/13/2021 campuslink.admin : HCM21_CPL_JAVA_05 : Tests & Quizzes

B. 10,001 rows will be returned with no error.

C. 101 rows will be returned with no error.

D. 10,001 rows will be returned with a maximum recursion error.

Reset Selection

Save Exit Submit for Grading

Gateway
Accessibility Information
The Sakai Project

Powered by Sakai
Copyright 2017 FPT-Software

https://gst.fsoft.com.vn/portal/site/b0d8cac9-9f19-4f09-9eb7-71661cf003c0/tool/e2c4d983-f0d7-4b16-b69b-7235434d4adb/jsf/delivery/beginTakingAss… 7/7

You might also like