Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 19

SAMPLE PAPER - 1 INFORMATICS PRACTICES Class - XII SET INNOVATION

Time allowed: 3 hours 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. SECTION-A Q1. Answer the following questions: a) Why GNU is known as GNU not Unix? b) What is an Inventory Control System? Name any two entities or tables that could be a part of this system? c) Differentiate between ER Modeling and Object Modeling Techniques. d) Write down the characteristics of Data Ware house. e) Give the difference b/w Shareware and proprietary software. Q2. Answer the following questions:a) b) c) d) e) f) Differentiate between a form module and class module of Visual Basic. Explain the methods for loading and unloading forms. What is DSN? When the GotFocus and LostFocus Events occurs. Differentiate between i) Date and Date$ function ii) Call ByVal and Call ByRef 1 2 1 2 4 2 2 2 2 2 Maximum Marks : 70

Q.3) Answer the following questions: a) Normalize the table with the following specification: 2 Employee (empno, dept_no, dept_name, salary, DOJ, dept_no, dept_name). b) If a table is dropped what happens to views and indexes dependent upon this table. 2 c) How will you drop a constraint from a table? 2 d) Find the join of the following two tables: TEACHER Tname Mr.Nayak STUDENT Mrs.Dubey Name Divakar Puneet Rohit

Tno. T1 T2 Roll 1 2 3

Tcity Delhi Mumbai City Delhi Mumbai Kolkata

e) What is the advantage of an anchored data type? SECTION B Q 4. Answer the following questions:

a) Write a VB program to compare two strings using function. b) Write a sub program to find the largest, smallest, sum and average number of array of ten numbers. c) What will be the output of the following program. Private Sub Command_click() Dim str1 as string str1 =Computer n=1 Do While n<=len(str1) Print left(str1,n) n=n+1 Loop End Sub d) Write a VB procedure to reverse the digits of given number. Q 5. Do the following: a. Find the Error: Sub Fibonacci(S1 as NUMBER,S2 as INTEGER,N as INTEGER) Output S1,S2 Dim count as Integer,dim term as Integer For count EQUAL 3 TO N Term = S1+S2 Print term S1=S2 S2=term Next value End sub b. Write the output of the given code: Sub first() Dim x as integer x=20 Print x Call second(x) Print x End Sub Sub second (y as integer) y=40 2

2 4 2

Print y End Sub Private Sub Command1_click() Call first End Sub c. Find the output of the following: Dim String1 as string Dim String2 as string String1=VB IS NOT AN OOP String2=an S=Instr(3,String1,String2) Print S d. If todays date is 21/09/08 then what is the o/p of the statement Print Format(Now,ddd,mmmm dd,yyyy) SECTION C Q 6. Answer the following questions: 2 2 2

a) Write the output of the following PL/SQL code block: DECLARE S NUMBER :=0; BEGIN I :=2; FOR X IN 1..5 LOOP IF MOD(X,2) = 1 THEN S:=S + X; ELSE S:=S - X; END IF; DBMS_OUTPUT.PUT_LINE(TO_CHAR(:I*10)); END LOOP; END; b) Find the errors from the following PL/SQL code and rewrite the corrected code underlining the correction made. 2

Declare B_No Number(4); Begin B_No : = %Book_No; Select Title Into B_Title from Books for Book_No = B_No If B_Title : = Leaarning ABC Update B_Title = Learn ABC Where Book_No = B_No; Else Dbms_output.Put_Line(No Change); End c) Write a PL/SQL block to create a trigger KVS to display a message WELCOME TO KVS before each insert operation on the table KVS_EMP. d) Write a PL/SQL procedure PRO_NUMBER to find the sum of first 10 natural numbers. Q 7. Answer the following questions based on the STUDENT table: Data Type NUMBER VARCHAR2 NUMBER VARCHAR2 CHAR Size 4 20 7,2 15 1 Constraint PRIMARY KEY Not Null Stipend is greater than 0 Not Null 2 b) Write a Cursor to display all the students whose stream is Medical and Grade A. c) Write a Procedure MYSTIPEND to display the stipend of the student whose RNo is entered by user. d) Write a PL/SQL FUNCTION Power that takes two numbers as argument and returns the value of the first number raised to the power of the second. 2 2 4

Column Name a) Create the RNo above table Name including Stipend constraints. Stream Grade

***

SAMPLE PAPER - 1 INFORMATICS PRACTICES Class - XII SET INNOVATION SOLUTIONS


Total Marks: 70
TIME : 3 HR

Duration: 3hrs
MM : 70

SECTION-A Q 1. Answers to the given questions : a) GNU. Its name is a recursive acronym for GNUs Not Unix,which was chosen because its design is Unix-like, but it contains no actual UNIX code. b) Inventoy Control System is used to process inventory data. It can be used to improve the inventory control so that it become easier to reduce the storage cost and increase the working capability. For example,Order and Purchase table for a manufacture Company. c) The Enity-Relationship modeling(or ER modeling)is a graphical representation of entities and their relationships to each other, used in organization of data within databases. An entity represents a discrete object and a relationship captures how two or more entities are related to one another. Object Modeling technique is based on the concept of an object which is a data structure, which consists of data, and a set of routines, called methods/messages/functions, which operate on the data. It is used for figuring out what the objects of a system are, how they are related, and how they collaborate with each other. d) Characteristics of DataWare house are: i) Subject Oriented ii) time Variant iii) Integrated iv) Non volatile e) Shareware : It is made available with the right to redistribute copies. Proprietary : It is neither open nor freely available. Q. 2 Answers to the given questions: a ) Form Modules: A project is made up of modules, such as form modules. Form modules consist of small pieces called procedures. Their extension is .frm ,can contain textual descriptions of the form and its controls,including their property setting. In Form modules we can use general procedure also. Class Module: .cls are the foundation of object-oriented programming in Visual Basic.You can write code in class modules to create new objects. These new objects can include your own customized properties and methods. b) To load and unload Forms, use the Load and Unload statements. The Load/Unload statement has the following syntax: Load formName Unload formName

The formName variable is the name of the Form to be loaded or unloaded. Once a form is loaded, it takes over the required resources, so you should always unload a Form that is no longer needed. When a Form is unloaded, the resources it occupies are returned to the system and can be used by other Forms and/or applications. c) A DSN is a set of values that an application needs to correctly connect to a database. It includes the name of ODBC driver, the name of the host database server machine, the path of the specific database, the timeout connection, the name of the calling workstation, etc. d) GotFocus event occurs when an object receives focus, and LostFoocus occurs when an object loses focus. e) Date - Will display date in variant form and in mm/dd/yy format where leading 0 is not kept like Suppose the date is 09-JULY-2008 then it displays 9/7/08. Date$ - Will display date in string form and in mm-dd-yyyy format where leading 0 is there like Suppose the date is 09-JULY-2008 then it displays 09-07-2008. Call ByVal This is a parameter passing mechanism in which a copy of the actual parameter is passed to the called procedure. After the called procedure terminates the changes made to the formal parameter by the called procedure are not reflected in actual parameters. Call ByRef Reference to the actual parameter is passed to the calling procedure. After the called procedure terminates the changes made to the formal parameter by the called procedure are reflected in actual parameters. 3.) a) To normalize the given relation we break the relation into two relations: Employee(Empno, Empname, address, Salary, Doj, Deptno) Department(Dept_no, Dept_name) b) If a table is dropped ,the views and indexes are no more in the same user.It will cause an error while viewing the view. c) To drop a constraint you can identify the name of the constraint from the Syntax: ALTER TABLE tablename DROP PRIMARY KEY|UNIQUE(column)| CONSTRAINT constraint[CASCADE]; d) Result of JOIN is: ROLL NAMECITY TNO 1 Divakar Delhi T1 2 Puneet Mumbai T2 TNAME TCITY Mr.Nayak Delhi Mr.Dubey Mumbai

e) It becomes easy to declare composite variables to hold entire rows from a table or a query.

SECTION-B Q-4 Answers to the given questions: a) Public Function compareStr (ByVal str1 As string, ByVal str2 As string) As Integer Dim ans As Integer If str1 = str2 Then ans=0 ElseIF str1 < str2 Then ans = -1 Else ans=1 End If compareStr = ans End Function Private Sub cmdComp_Click() Dim st1,st2 As String Dim op1t As Integer St1=Text1.text St2=Text2.Text Opt=compareStr(st1,st2) If opt = 0 Then Label3.Caption =Strings are Equal ElseIf opt=1 Then Label3.Caption =First string greater than second string Else Label3.Caption = Second string greater than first string End if End Sub b) Option Explicit Dim arnum(10) as integer Public Sub ArrayOperation(Byref arnum() As integer) Dim nstr As string Dim max,min,sum,avg opt as integer max=arnum(0) min=arnum(1) opt=1 print arnum(2) Do while opt<=4 Nstr=nstr+str(arnum(opt)+, If Max<arnum(opt)THEN Max=arnum(opt) End if If Min>arnum(opt) THEN Min=arnum(opt) End Sum=Sum+arnum(opt) Opt=opt+1 LOOP Avg=Sum/(opt-1) Text1.text=nstr Text2.text=Max Text3.text=Min Text4.text=Avg

Text1.Enabled =False Text2.Enabled =False Text3.Enabled =False Text4.Enabled =False End Sub Private Sub Form_Load() Dim ctr,nm As integer Ctr=1 Do while ctr<=4 Nm=Val(InputBox(Enter any no)) Arnum(ctr)=nm Ctr=ctr+1 LOOP Call ArrayOperation(arnum) End Sub c) C Co Com Comp Compu Comput Compute Computer

d) Private Sub Command1_Click() Dim a As long Dim r as Integer Dim num as Long A=val(Text1.text) Num=reverse(a) Text2.text=num End Sub FUNCTION reverse(By Val anum As Long) As Long Dim rev As Long Do While anum<>0 R=anum Mod 10 Rev=rev*10+r Anum=Int(anum/10) Loop Reverse=rev End function Q-5. Answers to the given questions: a) Sub Fibonacci(S1 as NUMBER,S2 as INTEGER,N as INTEGER) Output S1,S2 Dim count as Integer,dim term as Integer For count EQUAL 3 TO N Term = S1+S2 Print term S1=S2 S2=term Next value End sub

Corrected Code: Sub Fibonacci(S1 as INTEGER,S2 as INTEGER,N as INTEGER) Print S1,S2 Dim count as Integer, term as Integer For count =1 to N Term = S1+S2 Print term S1=S2 S2=term Next count End sub b) 20 40 40 0 Mon,September22,2008 SECTION C 6.) a) 20 20 20 20 20 Declare B_No Number(4); Begin B_No : = &Book_No; Select Title Into B_Title from Books WHILE Book_No = B_No ; If B_Title: = Leaarning ABC Update Books set B_Title = Learn ABC Where Book_No = B_No; Else Dbms_output.Put_Line (No Change); End if; End; Create or Replace Trigger KVS BEFORE INSERT ON EMP_KVS FOR EACH ROW Dbms_output.put_line(WELCOME TO KVS); END;

c) d)

b)

c)

d) CREATE OR REPLACE PROCEDURE PRO_NUMBER(result OUT number)AS I number; Tot number :=0; BEGIN FOR I IN 1..10 LOOP Tot := Tot+i; END LOOP; RESULT := Tot; END;

Q-7 Answers to the given questions: a) Create table STUDENT ( RNo number(4) Primary key, Name varchar2(20) Not Null, Stipend Number(7,2) check (stipend > 0), Stream varchar2(15) Grade varchar2(1)) b) DECLARE BEGIN FOR student_record In (SELECT rno, name, stipend, stream, avgmark, grade FROM STUDENT) LOOP IF student_record.stream =Medical and student_record.grade =A Then Dbms_output.put_line(student_record.rno|| ||student_record.NAME|| || student_record.stipend|| ||student_record.avgmark); END IF; END LOOP; END; c) CREATE OR REPLACE PROCEDURE MYSTIPENED(rno IN NUMBER) AS St NUMBER; BEGIN SELECT stipined INTO st from STUDENT where rno=&rno; Dbms_output.put_line(my stipened is||st); END ; d) CREATE OR REPLACE FUNCTION fun_Power(a NUMBER,b NUMBER) RETURN NUMBER AS pw NUMBER; BEGIN Pw := a ** b; RETURN pw; END;

***

SAMPLE PAPER - 2 INFORMATICS PRACTICES Class - XII


SET Higher Order Thinking Skills
Time allowed: 3 hours Note: (v) This question paper is divided into 3 sections. (vi) Section A consists of 30 marks. (vii) Section B and Section C are of 20 marks each. (viii) Answer the questions after carefully reading the text. SECTION A 1. Answer the following questions : (a) What do you know about the LAMP suit of programs? (b) If the two related entities are STUDENT AND TEACHER, which type of relationship is shown by them? Also draw the ER model for this relationship. (c) Why high performance database and machines are needed for data warehouse? (d) Name the Information Systems that produce the following reports: (i) Invoicing detail (ii) Recruitment Summary Report. (e) Suggest the situations where we need the following data gathering techniques: (i) On Site Observation 2. Answer the following questions : (a) Can you explain the difference between the following two statements: Text1.Text Text1(Index).Text (b) A variable is Local but it has Global Lifetime, which type of variable it is? (c) Dolly declares two variables as follows but none of the declaration is correct, can you suggest why? i) Dim i% as Integer ii) Dim 1A as Integer (d) Can you skip arguments in a function call? How? (e) Roshan create an MDI application, but when he runs the application and open the child form the menus of MDI form will disappear, Can you suggest the reason why? (f) Give the use of Table type, Snap Shot, Forward Only and Dynamic Type Recordset? 3. Answer the following questions: 2 1 2 1 (ii) Interview 2 2 2 2 2 Maximum Marks : 70

1 1 4

(a) What is Read Only View? Give an example of it.

(b) Give one advantage and one disadvantage of a serial execution of transaction. (c) How are errors in a PL/SQL block be managed? Name the errors raised when a query returned: (i) No rows (ii) Many rows d) Suggest the parameter modes for the following: i) Passed value must not get changed ii) A value is to be received from a procedure but used in any expression e) Compare and Contrast triggers and constraints. SECTION B 4. Do as directed: a) Rewrite the following code using DO . LOOP WHILE construct without changing output. Sub My_Arr_Procedure( ) a=5 Do Print a a=a-1 Loop While a < > 0 End Sub

2 2

b) Find the error in the following code and rewrite the correct code, underline the corrections 4 made: i) Sub MyProc (X as Integer) ii) Private sub Check_Proc( ) MyProc = X * X Call MyFun End Sub End Sub Function MyFun (byVal a as Integer) MyFun = a + a 10 End Function c) Write a VB program to enter a number and print the product of its digit, as if a number entered is 234 then the program gives o/p as 24. 4

5. Read the following case study and answer the questions that follow: The Cotton County showroom has computerized its billing. A new bill is generated for each customer. The showroom allows three different payment modes. The discount rate is based on the payment mode. The following screen shot used to generate the bill:

The list of controls for the above form is as follows: Object Type Form Text Box Option Button Command Button Object Name FrmDiscount TxtAmt TxtDisc TxtNet OptCash OptCheque OptCredit CmdCalc CmdClear CmdExit Description The main form To input the total Shopping Amount To display Discount Rate To display Net Price To select mode of payment as cash To select mode of payment as cheque To select mode of payment as credit card To calculate Discount and Net Amount To clear all textboxes To exit from the application 1 2

a) Write code for the CmdClear command button to clear all the textboxes. b) Write the code for the form load event of FrmDiscount so as to i) Disable the TxtDisc and the TxtNet textboxes and set default choice in the option button as cash. ii) Set the focus to the TxtAmt textbox. c) Write the code for the change event of the TxtAmt 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. d) Write code for the CmdCalc command button to display the discount rate and net price 5 in the TxtDisc and TxtNet textboxes respectively. Note that net price is calculated as shopping amount discount amount. The discount amount is calculate according to the discount rate which is based on the payment mode and total shopping amount according to the following table. Payment Mode Cash Cheque Credit Card Shopping Amount < 10000 > = 10000 < 15000 > = 15000 < 10000 > = 10000 Discount Rate 20 % 25 % 10 % 15 % 10 % 12 %

SECTION C 6. Do as Directed: a) Write a PL/SQL script to print numbers 2,4,6,8,10,.,20 using for loop. b) Find the error(s), if any, in the following code:

2 2

DECLARE v_empno NUMBER[4]; v_empname varchar2(20); BEGIN Select empno, ename, sal Into v_empno, v_ename FROM emp FOR empno = 1234; END; c) Find the O/P in the given PL/SQL block. 2 Declare Count Number; Num1 Number; Begin Count :=10; For num1 IN 5..8 Loop If Mod (num1,2)=0 then Count :=count num1; Else Count := count + 2 * num1; End if; ;(Dbms_output.put_line(count End Loop; End; d) Write a PL/SQL function CHECK_YEAR that accepts a date from the user and 4 returns 1 if the year is a leap year and returns 0 otherwise. 7. Answer the questions based on the table Metro given below. Column name MT_No MT_Origin MT_Dest MT_KM MT_Time MT_Cap Data type NUMBER VARCHAR 2 VARCHAR 2 NUMBER NUMBER NUMBER TABLE : Metro Size Constraint 4 PRIMARY KEY 15 NOT NULL 15 NOT NULL 3 4,2 3 CHECK For greater then 10 DEFAULT 11.00 Description Metro number Name of origin station Name of the final destination station Total kilometers from origin to destination Time of the metro to start from the origin station No. of seats in the metro 2 2 3 3

a) Write the SQL command to display the different destination without repetition. b) Write the SQL command to display number of metros starting from each MT_Origin. c) Write the PL/SQL code to change the destination OF ALL METROS ENDING AT ABC Station to XYZ station which are covering a distance of more than 15 km. d) Write the PL/SQL code to create a stored procedure TIME to display the details of all the metros which start at a particular time of the day which is entered by the user. The time should be accepted as a parameter.

***

SAMPLE PAPER - 2 INFORMATICS PRACTICES Class - XII


SET Higher Order Thinking Skills

SOLUTIONS
Time allowed: 3 hours SECTION A 1) Answer the following questions: a) LAMP Linux ApacheMozilla PHP x 4= 2 1 for Type, 1 for ER model 2 Maximum Marks : 70

b) Many to Many Relationship is there.

TEACHER

TAUGHT

STUDENT

c) Since DW stores a large volume of data to support and accommodate possible types of queries. To efficiently store and process and quesry on such large volumes of data, high performance platforms are needed that include high performance RDBMS, high performance O/S and high performance H/W. d) i) The Invoice Management System produce invoicing details. ii) The Human Resource Development System produce Recruitment Summary Report. 1 e) i) If the closer look of the real system is needed onsite observation is helpful. For any manufacturing unit it is a well suited data gathering technique. ii) Interview helps to extract as much information as possible, as vital as possible, as honest as possible. To know the performance of a product it is used. 2) Answer the following questions: a) Text1.Text It is a text control. Text1(index).Text It is a control array of text. b) c) STATIC variable has local scope and global lifetime. 1

1 1 1

i) In Dim i% as Integer, since % is a type declaration for Integer so we can not use 1 it as a part of variable name. ii) In Dim 1A as Integer, name of a variable can not starts with a digit. Yes, if we declare arguments as OPTIONAL then this argument can be skip while calling function. If the MDI as well as Child form both having their own menus, then when child form is loaded its menus takes over the menus of parent form and then parent menu bar is disappear.

1 1 1

d) e)

f)

Use of each Recordeset

- 1 mark

1x4=4

3) Answer the following questions: a) A Read Only View does not allow any updation of data on the base table. Create view V_Read_Only_EMP as select * from EMP WITH READ ONLY b) Advantage Disadvantage Correct Execution as only one transaction is running at a time and if the I/P is correct then definitely the O/P is correct. Inefficient Resource Utilization 1 1 1 1 1 2

c) Errors in a PL/SQL block are managed by means of exception handling. i) NO_DATA_FOUND ii) TOO_MANY_ROWS d) The parameter modes are: i) IN ii) OUT e)

Triggers affect only those row where insertions take place after the trigger is created whereas a constraints can be made to affect all rows in the table. Triggers can be used to define custom constraints, which might not be possible through the inbuild constraints. SECTION B

1 1

4. a) Sub My_Arr_Procedure( ) a=5 Do Until a = 0 Print a a=a-1 Loop End sub b) i) Funtion MyProc ( X as Integer ) MyProc = X * X End Function ii) Private sub Check_Proc( ) Msgbox MyFun (4) OR Ans = Myfun (4) End Sub

2x2=4

i) A Procedure cant return a value.

Function MyFun ( byVal a as Integer ) MyFun = a + a 10 ii) A function can not be called by Call Statement. End Function c) Write a VB program to enter a number and print the product of its digit, as if a number entered is 234 then the program gives o/p as 24. 4

5) a) Private sub CmdClear_Click ( ) TxtAmt. Text = TxtDisc.Text = TxtNet.Text = End Sub b) Private sub Form_Load ( ) TxtDisc.Enabled = FALSE TxtNet.Enabled = FALSE OptCase.Value = TRUE TxtAmt.Setfocus End Sub c) Private sub TxtAmt_Change ( ) If Val (TxtAmt.Text) < = 0 then Msgbox Pls enter a valid amount Txt.Amt = End If End Sub d) Private sub CmdCalc _ Click ( ) If Option1.Value = True Then If Val(Text1.Text) < 10000 Then Text2.Text = 20 net = Val(Text1.Text) - Val(Text2.Text) Else Text2.Text = 25 net = Val(Text1.Text) - Val(Text2.Text) End If ElseIf Option2.Value = True Then If Val(Text1.Text) < 15000 Then Text2.Text = 10 net = Val(Text1.Text) - Val(Text2.Text) Else Text2.Text = 15 net = Val(Text1.Text) - Val(Text2.Text) End If ElseIf Option3.Value = True Then If Val(Text1.Text) < 10000 Then Text2.Text = 10 net = Val(Text1.Text) - Val(Text2.Text) Else Text2.Text = 12 net = Val(Text1.Text) - Val(Text2.Text) End If End If Text3.Text = net End Sub

SECTION C 6) a) Declare X number:=2; Begin For I In 1..10 Loop Dbms_output.put_line(X); X:=X+2; End Loop; End; b) DECLARE V_empno NUMBER (4); V_empname varchar2 (20); S_salary ; BEGIN Select empno, ename, sal INTO v_empno, v_empname, S_salary FROM emp WHERE empno = 1234; END; c) 20 14 28 20 Declare Y Date; X number; Begin Y := &Enter_Date; X := To_Number(SUBSTR(Y,8,4)); If Mod ( X, 4) = 0 then Dbms_Output.Put_Line ( Leap Year ); Else Dbms_Output.Put_Line (Not a Leap Year); End if; End; Select Distinct (MT_Dest) from Metro; Select MT_Origin, count (*) from Metro Group by MT_Origin; 2 2 2

d)

8)

a) b)

2 2

c)

Declare Cursor Cur_metro IS Select MT_KM, MT_No from Metro where MT_Dest=ABC; Rec Metro%RowType; Begin Open Cur_metro; Loop Fetch Cur_metro Into Rec; Exit when Cur_metro%NOTFOUND; If Rec.MT_KM > 15 then Update Metro set MT_Dest=XYZ where MT_No=Rec.MT_No; End if;

d)

Create or replace procedure TIME (T IN Number) AS RecMetro Metro%ROWTYPE; Begin Select * Into RecMetro from Metro where MT_Time = T; Dbms_output.put_line (RecMetro.MT_NO || RecMetro.MT_Origin || .. ); End ;

***

You might also like