Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Q1) Given the declaration of the following two variables, ClientComment and Staf

ID: 3595901 • Letter: Q

Question

Q1) Given the declaration of the following two variables, ClientComment and StaffComment, which of the following statements signifies the difference between them?

DECLARE ClientComment    CHAR(255);

DECLARE  StaffComment       VARCHAR(255);

Select one:

a. A maximum of 255 bytes can be specified for the length of ClientComment; whereas the minimum length forStaffComment is 255 bytes

b. The variable, ClientComment stores binary strings and StaffComment stores non-binary strings

c. String functions such as STRCMP can be applied on ClientComment, but not on StaffComment

d. Each value of ClientComment requires exactly 255 bytes to store, whereas the memory requirement ofStaffComment depends on the value to be stored.

Q2) Consider the following stored procedure for calculating the new price of a product. The procedure takes the discount code and current price as input. It then determines the discount amount from the code and computes the new price. The discount amount and the new price is sent back to the calling program.

Which of the followings best defines the parameters of the stored procedure?

Select one:

a. IN discountCode CHAR(1), OUT discountAmount INT, IN price NUMERIC(6,2)

b. IN discountCode CHAR(1), INOUT discountAmount INT, IN price NUMERIC(6,2)

c. IN discountCode CHAR(1), OUT discountAmount INT, INOUT price NUMERIC(6,2)

d. IN discountCode CHAR(1), OUT discountAmount INT, OUT price NUMERIC(6,2)

Q3) The following database schema is given:

EmployeeSalary(EmpID, grossPay, taxRate, netPay)

where the netPay of an employee is calculated from grossPay and taxRate.

Which type of stored programs can be used to automatically update the value of netPay column when the values of grossPay and taxRate change?

Select one:

a. Stored procedure

b. Trigger

c. Stored function

d. Referential integrity

Q4) What output would you expect if the following stored procedure is called with the statement below:

CALL PrintEmpDetails('7');

Select one:

a. Print employeeNumber, Name and email of all employees

b. Print employeeNumber, name and email of all the employees who work at office 7

c. Print the details of a single employee who works at office 7

d. Print employeeNumber, Name and email of a single employee who works at office 7

Explanation / Answer

Q1)
a. A maximum of 255 bytes can be specified for the length of ClientComment; whereas the minimum length forStaffComment is 255 bytes

Q2)
d. IN discountCode CHAR(1), OUT discountAmount INT, OUT price NUMERIC(6,2)

Q3)
a. Stored procedure

Q4)
c. Print the details of a single employee who works at office 7

**Comment for any further queries.