Series OSS Code No. 90
INFORMATICS PRACTICES
Time Allowed: 3 Hours Maximum Marks: 70
Note:
(i) This question paper is divided into 3 sections.
(ii) Section A consists of 30 marks.
(iii) Section B and Section C are of 20 marks each.
(iv) Answer .the questions after carefully reading the text.
1. Answer the following questions :
(a) Expand the terms OSS and W3C.
(b) What are the following software used for ? 2
(i) PHP
(ii) MySQL
(c) Name any four application areas of databases. 2
(d) What are the different types of relationships that can be depicted through an ER model ? Explain the concept of ER Model using the case study of a Ticket Reservation System that has three entities Ticket, Passenger and Train. Assume that each passenger can buy more than one ticket. 4
2. Answer the following questions :
(a) Differentiate between the For.. .Next and For Each.. .Next loop of Visual Basic giving a suitable example of each. 2
(b) Name and explain the usage of any two types of modules available in Visual Basic. 2
(c) What are data-aware controls ? Name any two ActiveX data aware controls that can be used on a form. 2
(d) Explain the term ADO object model. Differentiate between the Connection Timeout and Command Timeout properties of the Connection object. 4
3. Answer the following questions :
(a) Differentiate between row-level and statement-level triggers. 2
(b) Define the terms Candidate key and Foreign key with respect to a database. 2
(c) Differentiate between DDL and DML commands. Give one example of each type of command. 2
(d) Mention any two advantages of PL/SQL as compared to SQL. 2
(e) Name the keyword used to
(i) allow duplicate rows in a query.
(ii) avoid duplicate rows in a query. 2
SECTION B
4. Read the following case study and answer the questions that follow :
Mr. Presi of Super Store decided to computerize the billing department. The accounts manager at . Super Store is creating a billing software to generate the bill during the sale period. A new bill is generated for each item sold. The discount is given based on the item category. An additional discount of 5% is given to the Store Membership Card holders. The following is the data entry screen used at the store :
The list of controls for the above form is as follows :
Object Type | Object Name | Description |
Form | Frm Bill | The main form |
Text Box | TxtBillno | To enter Bill Number |
” ” | TxtBillDate | To display System Date |
” ” | TxtlName | To input Item Name |
” ” | TxtPrice | To input Item Price |
” ” | TxtDisc | To display Discount |
” ” | TxtFinal | To display Final Price |
Option Buttons | OptMens | To select Men’s Category |
” ” | OptWomens | To select Women’s Category |
” ” | OptKids | To select Kid’s Category |
Check Box | ChkMember | To be checked for members |
Command Button | CmdCalc | To calculate discount and Final Price |
” ” | CmdClear | To clear all textboxes |
” ” | CmdExit | To Exit from the application |
(a) Write the code for the CmdClear command button to clear all the textboxes except the TxtBillDate textbox. 1
(b) Write the code for the form load event of FrmBill so as to : 2
(i) Display the system date in the TxtBillDate textbox.
(ii) Disable the TxtBillDate, TxtDisc and TxtFinal textboxes.
(c) Write the code for the change event of the TxtPrice textbox to ensure that the user does not enter a negative or a zero value. If a negative or a zero value is entered then the textbox should be made blank and a warning message should be displayed. 3
(d) Write the code for the CmdCalc command button to display the discount and final price in the TxtDisc and TxtFinal textboxes respectively. Note that Final price is calculated as price - discount and the discount is calculated based on the category and price according to the following table. Also remember to give an additional 5% discount for membership card holders i.e. if the ChkMember checkbox is checked.
Category | Price | Discount |
Men’s | <1000 | 30% |
” ” | >=1000 | 50% |
Women’s | <1500 | 40% |
” ” | >=1500 | 50% |
Kid’s | <500 | 20% |
” ” | >=500 | 30% |
5. Answer the following questions :
(a) Find the errors from the following code segment and rewrite the corrected code underlining the correction made. 2
Private Function IsPrime (num As Integer) As Bool
Dim limit As Integer
limit = num / 2
For ctr = 2 To limit
If num Modulo ctr = 0 Then
Exit For loop
End If
Next
IsPrime = IIf(ctr > limit, True, False)
End Sub
(b) Find the output of the following code 2
Dim astr as String
Dim I as Integer
I = 1
astr = “Come”
Do While I <= Len(astr)
Print Mid(astr, I)
I = I + 1
Loop
(c) Rewrite the following code using If Then Else construct without affecting the output : 2
Dim a As Integer
a = 1
Select Case a
Case 1
Print “Sunday”
Case 2 To 6
Print “Week Day”
Case 7
Print “Nearing Weekend”
End Select
(d) Write a Visual Basic procedure that takes a number as argument and displays the sum of all the digits in the number. For example, if the argument passed is 354, the procedure should display 12 (i.e. 3+5+4). 4
SECTION C
(a) Write the output produced by the following PL/SQL code: 2
DECLARE
A NUMBER;
B NUMBER;
TEMP NUMBER;
BEGIN
FOR X IN 1..4 LOOP
TEMP := A;
A := B;
B := TEMP;
A := A + 1;
B := B - 1;
DBMS OUTPUT.PUT LINE(‘A = A) ;
DBMS-OUTPUT. PUTLINE(‘B = B) ;
END LOOP;
END;
(b) Find the errors from the following PL/SQL code and rewrite the corrected code underlining the correction made.
DECLARATION
V MNO MOVIES.MOVIENO%TYPE;
V_TITLE MOVIES.TITLE%TYPE;
V-PRICE MOVIES.PRICE%TYPE;
BEGIN
V MNO EQUALS 101
LOOP
SELECT TITLE,PRICE,RATING INTO V TITLE,V PRICE,’V RATE
FROM MOVIES
WHERE MOVIENO V MNO;
DBMS OUTPUT.PUTTEXT(V TITLEII’ ‘IIV PRICE);
EXIT WHEN V_RATE < 4;
V MNO V MNO + 1;
LOOP END;
END;
(c) Differentiate between the IN and IN OUT modes of a parameter in a PL/SQL block.
(d) Write a PL/SQL Function POWER that takes two numbers as arguments and returns the value of the first number raised to the power of the second.
7. Answer the questions based on the table CompLab given below:
Column Name | Data Type | Size | Constraint | Description |
It_Code | Number | 4 | PRIMERY KEY | Item Code |
It_Cat | CHAR | 1 | ‘H’ or ‘S’ | Item category as Hardware or Software |
It_Name | VARCHAR2 | 25 | NOT NULL | Name of the item |
It_Cost | NUMBER | 8,2 | Cost of each unit of an item | |
It_Qty | NUMBER | 3 | Item Quantity in the Lab | |
Dt_Pur | DATE | Date of Purchase |
(a) Write the SQL command to create the table CompLab including the constraints. 2
(b) Write the SQL command to display the details of the item with the maximum It Cost. 2
(c) Write the PL/SQL code to increase the item cost by 10% for an item code accepted from the user if the date of purchase of the item is later than 12-Oct-2005. 3
(d) Write the PL/SQL code to create a stored procedure Disp_Details to display the details of all the items with It_Cat as ‘H’. The code should also display the total quantity of all such items. 3