DPG621S - DATABASE PROGRAMMING THEORY - 2ND OPP - JAN 2023


DPG621S - DATABASE PROGRAMMING THEORY - 2ND OPP - JAN 2023



1 Page 1

▲back to top


nAm I BIA uni VE RSITY
OF SCIEnCE Ano TECHnOLOGY
FACULTY OF COMPUTING AND INFORMATICS
SCHOOL OF COMPUTING
DEPARTMENTOF SOFTWAREENGINEERING
QUALIFICATION: BACHELOROF COMPUTERSCIENCE;BACHELOROF INFORMATICS;BACHELOR
OF GEOINFORMATION TECHNOLOGY
QUALIFICATION CODE: 07BCMS; 07BACS
07BAIT; 07BAIF; 07GITB
LEVEL: 6
COURSE: DATABASEPROGRAMMING
COURSE CODE: DPG621S
DATE: JANUARY 2023
SESSION: 1 (THEORY)
DURATION: 1 HOUR
MARKS: 40
SECOND OPPORTUNITY/SUPPLEMENTARY EXAMINATION QUESTION PAPER
EXAMINER:
MR GEREONKOCHKAPUIRE
MODERATOR:
PROFJOSEQUENUM
THIS QUESTION PAPER CONSISTS OF 3 PAGES
(Excluding this front page)
INSTRUCTIONS
1.
Answer all questions.
2.
When writing take the following into account: The style should inform than impress, it
should be formal, in third person, paragraphs set out according to ideas or issues and
the paragraphs flow in a logical order. The information provided should be brief and
accurate.
3.
Please, ensure that your writing is legible, neat and presentable.

2 Page 2

▲back to top


3 Page 3

▲back to top


Section A - Theory (40 Marks)
Question 1
Choose True or False
(10 Marks]
No
Questions
1
Each transaction is explicitly completed with a COMMIT or
ROLLBACK statement
2
In sub queries, FOR XML can be used in the INSERT, UPDATE
and DELETEstatements
3
Stored procedures reduce network traffic between clients and
database servers
4
Log data files stores the log information used for recovery
5
COMMIT TRANSACTION marks the beginning of a successful
explicit transaction
6
Desktop databases are designed to serve multiple users
True (T)
False (F)
7
The ALTER PROCEDURE statement create a stored procedure
8
A stored procedure cannot be deleted once stored on the
server
9
sp_helptext shows the definition of the object passed
10 Output parameters are used to pass values between stored
procedures
Question 2
Compare and explain the differences between the two procedures below:
(2 Marks]
Query 1:
CREATE PROCEDURE SelectAIICustomers @City nvarchar(30)
AS
SELECT* FROM Customers WHERE City= @City
GO;
EXECSelectAIICustomers @City= 'London';
Query 2:
CREATE PROCEDURE SelectAIICustomers
AS
SELECT* FROM Customers
GO;
EXECSelectAIICustomers;
2

4 Page 4

▲back to top


5 Page 5

▲back to top


Question 3
How will the result of the statement below be:
Create table Vehicle (id int);
BEGIN TRANSACTION;
INSERTINTO Vehicle VALUES{1);
INSERTINTO Vehicle VALUES{2);
ROLLBACK;
SELECT* FROM Vehicle
Question 4
Compare and explain the results of the two queries below:
Query 1:
SELECT@registernu = RegistrationNo FROM VehicleRegistration;
Query 2:
SELECTRegistrationNo FROM VehicleRegistration;
Question 5
What is the difference between the two statements below?
Statement 1:
DROPTrigger AfterlnsertAudit
Statement 2:
DISABLEtrigger ALL ON ALL SERVER
Question 6
What is the difference between INPUT and OUTPUT parameters?
Question 7
What is the command to display the definition of stored procedures?
Question 8
When is it best to use ROLLBACKTRANSACTION?
Question 9
Compare and explain the results of the statements below:
Statement 1:
BEGIN TRANSACTION
SELECTRegistrationNo FROM VehicleRegistration;
INSERTINTO VehicleRegistration ([RegistrationNo], [Make], [VehicleCategory],
[FuelType], [Mai nColou r], [DateOfRegistration])
VALUES{'601', 'Toyota', 'Vehicle', 'Petrol', 'White', '11 June 2005');
DELETEFROM VehicleRegistration;
3
[4 Marks]
[4 Marks]
[4 Marks]
[4 Marks]
[2 Marks]
[2 Marks]
[5 Marks]

6 Page 6

▲back to top


7 Page 7

▲back to top


COMMIT TRANSACTION
Statement 2:
BEGIN TRANSACTION
SELECTRegistrationNo FROM VehicleRegistration;
INSERTINTO VehicleRegistration ([RegistrationNo], [Make], [VehicleCategory],
[FuelType], [Mai nColou r], [DateOfRegistration])
VALUES('601', 'Toyota', 'Vehicle', 'Petrol', 'White', '11 June 2005');
ROLLBACKTRANSACTION
Question 10
What are the three statements which control transactions?
[3 Marks]
<<<<<<End of Theory Exam>>>>>
4

8 Page 8

▲back to top


nAmlBIA
UOnFlVsEi;RuS.l:lr"nY :Aeno
TErnnOLOGY
2022-10-18