become expert | help | login
refer a friend - earn nickels!!
 advanced
originally posted here on CBSE / NCERT community   
Email  
Informatics Practices (065) Sample Question Paper -III
Tags: CBSE, State Boards  |  CBSE Class 12  |  Computer Science
  « Back to Content




Informatics Practices (065) Sample Question Paper -III

 

 

Informatics Practices (065) Sample Question Paper -III

 

 

Note

  1. This question paper is divided into three sections.
  2. All questions are compulsory.
  3. Section – A consists of 30 marks.
  4. Section – B and Section – C are of 20 marks each
  5. Answer the questions after carefully reading the text.

 

 

Section – A

 

Q1.

Answer the following questions:

 

 

(a)

Explain the term FLOSS

 

2

 

(b)

Differentiate between ER Modeling and Object Modeling Techniques.

 

2

 

(c)

Define the following terms in the context of Database

  1. Relation
  2. Tuple

2

 

(d)

Name two areas in industries where business computing can be applied. Describe application of business computing in those industries.

 

4

Q2

Answer the following questions:

 

(a)

How do we specify comments in visual basic? How do we break a long line of code to a new line?

 

2

 

(b)

Write the steps in Program Solving Methodology. Give a suitable example showing use of Problem Solving Methodology.

4

 

(c)

Explain the following Terms

  1. Modular Programming
  2. Object Oriented Programming
  3. Event Driven Programming
  4. RAD

4

Q3

Answer the following questions:

 

(a)

State the differences between SQL and PL/SQL. 

 

2

 

(b)

Differentiate between Cursors and Triggers.

 

2

 

(c)

“NULL is not Equal to a NUL” do you agree with the statement. State reason.

 

2

 

(d)

What are PL/SQL blocks? How many types of PL/SQL block definition exist? Explain with suitable examples.

4

 

 

Section – B

Q4

 

 

 

Mr. C D Sharma learnt elementary visual basic programming and started making an application for his 7-year-old kid. He made an application for viewing different type of shapes. Initially he designed the basic application as shown below.

 

Object Type

Object Name

Description

Form

frmPlayForm

The Main Form Object

Command Button

cmdDrawShape

Command buttons to draw the respective shapes and clear the form.

 

cmdRectangle

 

cmdSquare

 

cmdOval

 

cmdCircle

 

cmdRoundedRectangle

 

cmdRoundedSquare

 

cmdClearShape

Label

lblPlayWithShape

 

Shape

shpPlay

The Shape object.

 

 

 

 

 

 

 

Now he wants to exercise some control over the command buttons displayed in the form. His requirements are listed as below

Requirement 1: Enable Draw Shape command button and disable all other Command Button Controls in the beginning. Also the form should not have any shape displayed.

Requirement 2: On Clicking Draw Shape command button, all the command buttons except Draw Shape command button should be enabled.

Requirement 3: On clicking command buttons Rectangle, Square, Oval, Circle, Rounded Rectangle, Rounded Square the respective shape should be displayed.

Requirement 4: On Clicking Clear Shape command button the status of requirement 1 should be resumed.

 

 

(a)

Write a procedure DrawShape to set the properties of shape object shpPlay as height = 2000,  width = 3000 , top = 1500 and  left = 4000. The shape should be displayed after setting these parameters.

 

2

 

(b)

Write a procedure DisableControl to disable the controls as per requirements in 1 and 3.

 

2

 

(c)

Write a procedure EnableControl to enable the controls as per requirement in 2.

 

2

 

(d)

Write code for requirement number 3

 

2

 

(e)

Write the code statement required for requirement number 4

 

2

 

 

 

 

Q5

(a)

Write the output of the following

2

 

 

j = 10

FOR i = 1 TO 4

    x = i * j

    PRINT  x

    j = j – 2

NEXT I

 

 

 

(b)

Rewrite the corrected program after removing syntax errors, underline the corrections

2

 

 

PRIVATE SUB Command1_Click()

Dim P=1 as integer, C as integer

FOR C=1 UPTO 10

  P = P+1

  IF P = 5 THEN

    P = 1

    DISPLAY “P is equal to 5”

  ELSE

    DISPLAY “P is not equal to 5”

LOOP C

 

 

 

 

 

(c)

Rewrite the following code using IF .. ELSE without effecting the output of the code:

2

 

 

DIM Percentage AS Integer
  Percentage = val(txtpercent.Text)

  SELECT CASE Percentage
    CASE 60 TO 100
       txtcategory.Text ="Excellent"
    CASE 40 TO 59
       txtcategory.Text ="Very Good"
    CASE ELSE
                  txtcategory.Text ="Need to work hard"
END SELECT

 

 

 

 

 

(d)

Write the following code segment using FOR… LOOP without effecting the output of the code:

2

 

 

Num=6

Temp=Num

DO WHILE Num>=1

  Temp=Temp-1

  IF Temp MOD 2 = 0  THEN

    PRINT Temp," is Even"

  ELSE

    PRINT Temp," is Odd"

  END IF

  Num=Num-2

LOOP

 

 

 

(e)

Write the output that the following code segment:

2

 

 

First = "Education"

Second = "cat"

PRINT First + "@"+ Second

PRINT INSTR(First, Second)

PRINT Mid(LCASE(First),4,3)

PRINT INT(18.2)+LEN(Second)

 

 

 

 

Section C

 

6

Answer the following questions

 

(a)

Look at the above Dept table and give the output produced by the following PL/SQL code on execution:

 

DECLARE

              v_DeptID                 Dept.DeptNo%TYPE := 10;

              v_Department  Dept.DName%Type;

              v_Counter                NUMBER (2) := 1;

BEGIN

LOOP

              SELECT DName INTO v_Department FROM Dept WHERE DeptNo = v_DeptID ;

              DBMS_OUTPUT.PUT_LINE (v_Department);

              v_DeptID  := v_DeptID + 10

              v_Counter := v_Counter + 1

              EXIT WHEN v_Counter > 3;

END LOOP;

END;

 

2

 

(b)

Write the output of the following PL/SQL code segment

DECLARE

              Msg CHAR(3) := ’Welcome’;

BEGIN

              FOR C IN 1..3

              LOOP             

                            DBMS_OUTPUT.PUT_LINE (SUBSTR (Msg, -3, C));

              END LOOP ;

END;

 

2

 

(c)

Write the output of the following PL/SQL code segment

 

BEGIN

  FOR i IN REVERSE 1..6

  LOOP

    IF MOD (i, 2)=0 THEN

      DBMS_OUTPUT.PUT_LINE (TO_CHAR (i*10));

    END IF;

  END LOOP;

END;

 

2

 

(d)

Write a PL/SQL function MyAddition which will accept two arguments of number type and returns the sum of both values.

 

4

 

 

 

 

Q7

Use the following structure of Customer table to answer the following questions

Column Name

Cust_ID

(Primary Key)

Cust_Name

Cust_Add1

Cust_Add2

Pin_Code

Cust_Phone

Data type

NUMBER

VARCHAR2

VARCHAR2

VARCHAR2

NUMBER

VARCHAR2

Length

7

30

20

30

6

10

 

 

 

 

(a)

Write the SQL Command to create the above table including its Constraints

 

2

 

(b)

Write a PL/SQL code to modify all the CUST_PHONE numbers by joining ‘2’ before each phone number if it contains 7 characters.

 

2

 

(c)

Write a PL/SQL code to modify all the CUST_PHONE numbers by removing ‘2’ if it starts with ‘2’.

 

2

 

(c)

Write PL/SQL code to create two Statement level triggers TrigBeforeUpdateCustomer and TrigAfterUpdateCustomer before and after UPDATE statement respectively on the table Customer which signals ‘Starting Update’ to signify that modification of records has started and ‘End of Update’ message to signify that modification is over.

 

4

 


Informatics Practices (065)

Sample Question Paper –3

Note

  1. This question paper is divided into three sections.
  2. All questions are compulsory.
  3. Section – A consists of 30 marks.
  4. Section – B and Section – C are of 20 marks each
  5. Answer the questions after carefully reading the text.

 

 

Section – A

Q1.

Answer the following questions:

 

 

(a)

Explain the term FLOSS

 

2

 

Ans:

FLOSS: Free/Libre/Open Source Software, the term most commonly used when talking about either Free (Libre) Software or Open Source Software. 

 

PYTHON is freeware open-source cross-platform interpreted scripting language that can be used for many kinds of software development.

 

 

 

 

(1 mark each for each definition)

 

 

 

(b)

Differentiate between ER Modeling and Object Modeling Techniques.

 

2

 

Ans:

In ER Modeling ,an Entity is used to model a physical thing in question but in Object Modeling technique it is treated as Object. The collection of similar entities is termed as Entity Set but common collection of objects refers to a repository called Class. 

 

 

 

(2 marks for the correct difference)

 

 

 

(c)

Define the following terms in the context of Database

  1. Relation
  2. Tuple

2

 

Ans:

Relation is the term used to denote a Table. It is the other name given to Table.

Tuple is also called as record, it is the row of a table

In the following example the Relation is Dept and there are four tuples in it.

 

 

 

(1 mark each for each definition)

 

 

 

(d)

Name two areas in industries where business computing can be applied. Describe application of business computing in those industries.

 

4

 

Ans:

In Banking we can use Business Computing for logging and maintaining daily transactions and reporting requirements.

In Financial Accounting of small scale or large scale industries for entering transactions of financial nature and generation of Ledgers, Vouchers, P&L A/C, Balance Sheet etc. 

 

 

 

(1 mark each for naming two areas)

(1 mark each for describing application)

 

 

Q2

Answer the following questions:

 

(a)

How do we specify comments in visual basic? How do we break a long line of code to a new line?

 

2

 

Ans:

For comments we can use Single Quotation mark character (‘) .

For breaking a long line of code to the next line we use _(underscore) character.

For Example:

‘ This is a Comment in Visual Basic

MsgBox “Here the Line Breaks into” &_

“New Line in code window”

 

 

 

 

(1 mark each for both the parts of question)

 

 

 

(b)

Write the steps in Program Solving Methodology. Give a suitable example showing use of Problem Solving Methodology.

4

 

Ans:

  1. Identify the problem
  2. Propose Solutions
  3. Identify a suitable solution
  4. Write the Code
  5. Test the solution
  6. Deliver the solution

For Example

Task: Write a code segment to find out whether a number is Even or Odd

  1. Identify the problem

              The task is to check a number for Even or Odd 

  1. Propose Solutions

There is one Solution which requires checking of the number to be divisible by 2 if it is then is a Even number otherwise it is a Odd number 

  1. Identify a suitable solution

The proposed solution is ideal for this task

  1. Write the Code

              Dim N as Integer

              N=13

              IF N Mod 2 =0 Then

                            MsgBox “Even Number”

              Else

                            MsgBox “Even Number”

              End If

  1. Test the solution

Test the above code for different values of N and then finally

  1. Deliver the solution

 

 

 

 

(½ mark each for all 6 steps)

(1 mark for a suitable example)

 

 

 

(c)

Explain the following Terms

  1. Modular Programming
  2. Object Oriented Programming
  3. Event Driven Programming
  4. RAD

4

 

Ans:

  1. Modular Programming

An approach of dividing a big programming task into small manageable program modules

  1. Object Oriented Programming

A programming technique used to program with Object Oriented Programming languages and follows object oriented programming paradigms.

  1. Event Driven Programming

In this type of programming the Events plays major role to execute a set of program code. Events are the actions such as Mouse Click, Double Click, Key Press etc.

  1. RAD

Rapid Application Development is the current programming approach in which a prototype (or sample model) of the software application is made much before its actual implementation to give a feel of application before starting working with the actual code behind the application. 

 

 

 

 

(1 mark each for  each brief explanation)

 

 

Q3

Answer the following questions:

 

(a)

State the differences between SQL and PL/SQL. 

 

2

 

Ans:

SQL is called Structured Query Language and PL/SQL is called the Programming Language in SQL.

SQL does not supports Decision Making and Looping constructs while PL/SQL does support all these features and also exploits benefits of SQL Commands in it.

 

 

 

(2 marks for stating any 2 correct differences)

 

 

 

(b)

Differentiate between Cursors and Triggers.

 

2

 

Ans:

Cursors are the work areas for SQL SELECT statements to fetch records from a database table and work with each record on record-by-record basis.

Triggers supports event based execution of code statements in database. A trigger gets initiated on the events such as Updating of records, Deletion of records etc. and can be triggered on Statement Level or Row Level.

 

 

 

(2 marks for the correct difference)

 

 

 

(c)

“NULL is not Equal to a NUL” do you agree with the statement. State reason.

 

2

 

Ans:

A NULL is not equal to a NULL”, I  agree with the statement as NULL is a value that is not present and is a missing value, which cannot be compared to any other value unless it is substituted with some value. So Null is never equal to anything, not Even NULL.  

 

 

 

(2 marks for stating the correct reason)

 

 

 

(d)

What are PL/SQL blocks? How many types of PL/SQL block definition exist? Explain with suitable examples.

4

 

Ans:

PL/SQL block is a set of PL/SQL statements, which can be executed to perform some identifiable task

Following are the PL/SQL Block types with general syntax

 

Anonymous: PL / SQL Block without any name

Syntax for Declaring an Anonymous PL/SQL Block

[DECLARE]

BEGIN

--Statements

                           

[EXCEPTION]

                           

END;

 

Procedure: Sub programs, which can take arguments.

Syntax for Declaring a Procedure                           

CREATE OR REPLACE PROCEDURE proc_name

IS

BEGIN

              --Statements

                           

[EXCEPTION]

                           

END;

 

Function: A function is similar to a procedure and must return a value.

Syntax for Declaring a Function

CREATE OR REPLACE FUNCTION name

RETURN datatype

IS

BEGIN

              --Statements

RETURN value;

             

[EXCEPTION]

             

END;

 

 

 

 

(1 mark for correct definition)

(1 mark for naming all 3 types of PL/SQL blocks)

(2 marks for giving example of each type)

 

 

 

 

Section – B

Q4

 

 

 

Mr. C D Sharma learnt elementary visual basic programming and started making an application for his 7-year-old kid. He made an application for viewing different type of shapes. Initially he designed the basic application as shown below.

 

Object Type

Object Name

Description

Form

frmPlayForm

The Main Form Object

Command Button

cmdDrawShape

Command buttons to draw the respective shapes and clear the form.

 

cmdRectangle

 

cmdSquare

 

cmdOval

 

cmdCircle

 

cmdRoundedRectangle

 

cmdRoundedSquare

 

cmdClearShape

Label

lblPlayWithShape

 

Shape

shpPlay

The Shape object.

 

 

 

 

 

 

 

Now he wants to exercise some control over the command buttons displayed in the form. His requirements are listed as below

Requirement 1: Enable Draw Shape command button and disable all other Command Button Controls in the beginning. Also the form should not have any shape displayed.

Requirement 2: On Clicking Draw Shape command button, all the command buttons except Draw Shape command button should be enabled.

Requirement 3: On clicking command buttons Rectangle, Square, Oval, Circle, Rounded Rectangle, Rounded Square the respective shape should be displayed.

Requirement 4: On Clicking Clear Shape command button the status of requirement 1 should be resumed.

 

 

(a)

Write a procedure DrawShape to set the properties of shape object shpPlay as height = 2000,  width = 3000 , top = 1500 and  left = 4000. The shape should be displayed after setting these parameters.

 

2

 

Ans:

Private Sub DrawShape ()

              shpPlay.Height =2000

              shpPlay.Width=3000

              shpPlay.Top=1500

              shpPlay.Left=4000

              shpShape.Visible =True

End Sub

 

 

 

(½ mark for setting height and width of shape)

(½ mark for setting Top)

(½ mark for setting Left)

(½ mark for displaying the shape)

 

 

(b)

Write a procedure DisableControl to disable the controls as per requirements in 1 and 3.

 

2

 

Ans

Private Sub DisableControl ()

cmdDrawShape.Enabled = True

cmdRectangle.Enabled =False

cmdSquare.Enabled =False

cmdOval.Enabled =False

cmdCircle.Enabled =False

cmdRoundedRectangle.Enabled =False

cmdRoundedSquare.Enabled =False

cmdClearShape.Enabled =False

ShpPlay.Visible =False

 

 

 

 

 

 

 

 

 

 

End Sub

 

 

 

(1 mark for fulfilling Requirement 1)

(1 mark for fulfilling Requirement 3)

 

 

 

(c)

Write a procedure EnableControl to enable the controls as per requirement in 2.

 

2

 

Ans:

 

Private Sub EnableControl ()

cmdDrawShape.Enabled = False

cmdRectangle.Enabled =True

cmdSquare.Enabled =True

cmdOval.Enabled =True

cmdCircle.Enabled =True

cmdRoundedRectangle.Enabled =True

cmdRoundedSquare.Enabled =True

cmdClearShape.Enabled =True

ShpPlay.Visible =False

 

 

 

 

 

 

 

 

 

 

End Sub

 

 

 

(1 mark for enabling all command buttons except DrawShape)

(1 mark for disabling DrawShape command button)

 

 

 

(d)

Write code for requirement number 3

 

2

 

Ans:

The following code statement is to be embedded in the click event of each of the respective command button with the respective shape name (Such as vbShapeRectangle, vbShapeSquare etc.)

For the Click event of Command Button cmdRectangle we will write the code fragment in it.

 

shpPlay.Shape =vbShapeRectangle

shpPlay.Visible=True

 

 

 

 

(1 mark each for both the statements.)

 

 

 

(e)

Write the code statement required for requirement number 4

 

2

 

Ans:

DisableControl

 

Or

cmdDrawShape.Enabled = True

cmdRectangle.Enabled =False

cmdSquare.Enabled =False

cmdOval.Enabled =False

cmdCircle.Enabled =False

cmdRoundedRectangle.Enabled =False

cmdRoundedSquare.Enabled =False

cmdClearShape.Enabled =False

ShpPlay.Visible =False

 

 

 

 

 

 

 

 

 

 

 

 

(½  mark for enabling DrawShape command button)

(½ mark for disabling all other command buttons except DrawShape)

(1 mark for not displaying any shape on form)

 

 

Q5

(a)

Write the output of the following

2

 

 

j = 10

FOR i = 1 TO 4

    x = i * j

    PRINT  x

    j = j – 2

NEXT I

 

 

 

Ans:

Output:

10

16

18

16

 

 

 

 

½ mark for each line of correct output

 

 

 

(b)

Rewrite the corrected program after removing syntax errors, underline the corrections

2

 

 

PRIVATE SUB Command1_Click()

Dim P=1 as integer, C as integer

FOR C=1 UPTO 10

  P = P+1

  IF P = 5 THEN

    P = 1

    DISPLAY “P is equal to 5”

  ELSE

    DISPLAY “P is not equal to 5”

LOOP C

 

 

 

Ans:

 

PRIVATE SUB Command1_Click()

Dim P,C as integer

P =1

FOR C=1 TO 10

  P = P+1

  IF P = 5 THEN

    P = 1

    PRINT “P is equal to 5”

  ELSE

   PRINT  “P is not equal to 5”

  ENDIF

NEXT C

 

 

 

 

(½ mark each for correction of any 4 errors(Both the PRINTs to be treated as one correction)

 

 

 

 

 

(c)

Rewrite the following code using IF .. ELSE without effecting the output of the code:

2

 

 

DIM Percentage AS Integer
  Percentage = val(txtpercent.Text)

  SELECT CASE Percentage
    CASE 60 TO 100
       txtcategory.Text ="Excellent"
    CASE 40 TO 59
       txtcategory.Text ="Very Good"
    CASE ELSE
                  txtcategory.Text ="Need to work hard"
END SELECT

 

 

 

 

 

Ans:

 

 

If Percentage >=60 AND Percentage < = 100 Then

  txtcategory.Text ="Excellent"
 

Elseif Percentage >= 40  Then

  txtcategory.Text ="Very Good"

Else

txtcategory.Text ="Need to work hard"

End If

 

 

 

 

( ½  mark for IF statement)

( ½  mark for correct ELSEIF statement)

( ½  mark for ELSE statement)

( ½  mark for END IF statement)

 

 

 

(d)

Write the following code segment using FOR… LOOP without effecting the output of the code:

2

 

 

Num=6

Temp=Num

DO WHILE Num>=1

  Temp=Temp-1

  IF Temp MOD 2 = 0  THEN

    PRINT Temp," is Even"

  ELSE

    PRINT Temp," is Odd"

  END IF

  Num=Num-2

LOOP

 

 

 

Ans:

 

Num=6

Temp=Num

 

FOR NUM = 6 TO 1 STEP -2

Temp=Temp-1

  IF Temp MOD 2 = 0  THEN

    PRINT Temp," is Even"

  ELSE

    PRINT Temp," is Odd"

  END IF

NEXT NUM

 

 

 

 

mark for correct FOR statement)

mark for using correct Step)

mark for using correct NEXT statement)

mark for the body of loop)

 

 

(e)

Write the output that the following code segment:

2

 

 

First = "Education"

Second = "cat"

PRINT First + "@"+ Second

PRINT INSTR(First, Second)

PRINT Mid(LCASE(First),4,3)

PRINT INT(18.2)+LEN(Second)

 

 

 

Ans:

Output:

 

Education@cat

4

Cat

21

 

 

 

(½ mark for each line of correct output)

 

 

 

Section C

 

6

Answer the following questions

 

(a)

Look at the above Dept table and give the output produced by the following PL/SQL code on execution:

 

DECLARE

              v_DeptID                 Dept.DeptNo%TYPE := 10;

              v_Department  Dept.DName%Type;

              v_Counter                NUMBER (2) := 1;

BEGIN

LOOP

              SELECT DName INTO v_Department FROM Dept WHERE DeptNo = v_DeptID ;

              DBMS_OUTPUT.PUT_LINE (v_Department);

              v_DeptID  := v_DeptID + 10

              v_Counter := v_Counter + 1

              EXIT WHEN v_Counter > 3;

END LOOP;

END;

 

2

 

Ans:

Output:

ACCOUNTING

RESEARCH

SALES

 

 

 

1 mark for first line of output

1 mark each for second and third line of output.

 

 

(b)

Write the output of the following PL/SQL code segment

DECLARE

              Msg CHAR(10) := ’Welcome’;

BEGIN

              FOR C IN 1..3

              LOOP             

                            DBMS_OUTPUT.PUT_LINE (SUBSTR (Msg, 1, C));

              END LOOP ;

END;

 

2

 

Ans:

Output:

 

W

We

Wel

 

 

 

1 mark for first line of output

1 mark each for second and third line of output.

 

 

(c)

Write the output of the following PL/SQL code segment

 

BEGIN

  FOR i IN REVERSE 1..6

  LOOP

    IF MOD (i, 2)=0 THEN

      DBMS_OUTPUT.PUT_LINE (TO_CHAR (i*10));

    END IF;

  END LOOP;

END;

 

2

 

Ans:

 

60

40

20

 

 

 

(1 mark for first line of output)

(1 mark each for second and third line of output.)

 

 

(d)

Write a PL/SQL function MyAddition which will accept two arguments of number type and returns the sum of both values.

 

4

 

Ans:

 

CREATE OR REPLACE FUNCTION MySum (V_NumA IN NUMBER, V_NumB IN NUMBER)

RETURN NUMBER AS

V_Sum NUMBER;

BEGIN

    V_Sum := V_NumA + V_NumB;

    RETURN V_Sum;

END;

 

 

 

 

(1 mark for header of Function)

(1 mark for using correct arguments and their data type)

(1 mark for calculating sum )

(1 mark for Returning the sum)

 

 

Q7

Use the following structure of Customer table to answer the following questions

Column Name

Cust_ID

(Primary Key)

Cust_Name

Cust_Add1

Cust_Add2

Pin_Code

Cust_Phone

Data type

NUMBER

VARCHAR2

VARCHAR2

VARCHAR2

NUMBER

VARCHAR2

Length

7

30

20

30

6

10

 

 

 

 

(a)

Write the SQL Command to create the above table including its Constraints

 

2

 

Ans:

 

CREATE TABLE Customer (

              Cust_ID               NUMBER(7) PRIMARY KEY,

              Cust_Name              VARCHAR2 (30),

              Cust_Add1              VARCHAR2 (20),

              Cust_Add2              VARCHAR2 (30),

              Pin_Code               NUMBER (6),

              Cust_Phone              VARCHAR2 (10));

 

 

 

 

(1/2 mark for CREATE TABLE command )

(1 mark for fields with data types)

(1/2 mark for PRIMARY KEY constraint)

 

 

 

 

(b)

Write a PL/SQL code to modify all the CUST_PHONE numbers by joining ‘2’ before each phone number if it contains 7 characters.

 

2

 

Ans:

 

BEGIN

              UPDATE Customer Set Cust_Phone = ‘2’ || Cust_Phone WHERE Length (Cust_Phone) =7;

END;

 

 

 

 

(1 mark for Update command)

(½ mark for SET )

(½ mark for WHERE clause)

 

 

(c)

Write a PL/SQL code to modify all the CUST_PHONE numbers by removing ‘2’ if it starts with ‘2’.

 

2

 

Ans:

 

BEGIN

UPDATE Customer Set Cust_Phone = SUBSTR (Cust_Phone ,2 ,LEN(Cust_Phone)-1) WHERE Cust_Phone Like ‘2%’;

END;

 

 

 

 

(½  mark for Update command)

(½ mark for SET )

(½ mark for WHERE clause)

(½ mark for using SUBSTR)

 

 

(c)

Write PL/SQL code to create two Statement level triggers TrigBeforeUpdateCustomer and TrigAfterUpdateCustomer before and after UPDATE statement respectively on the table Customer which signals ‘Starting Update’ to signify that modification of records has started and ‘End of Update’ message to signify that modification is over.

 

4

 

Ans:

CREATE OR REPLACE TRIGGER TrigBeforeUpdateCustomer

BEFORE UPDATE ON CUSTOMER

BEGIN

              DBMS_OUTPUT.PUT_LINE (‘Starting Update’);

END;

 

And

 

CREATE OR REPLACE TRIGGER TrigAfterUpdateCustomer

AFTER UPDATE ON CUSTOMER

BEGIN

              DBMS_OUTPUT.PUT_LINE (‘End of Update’);

END;

 

 

 

 

 

(2 marks for each trigger)

 

 

 


   

 
  Elements Group III A      Class 8 sound & contents      Electricity and Effect of Current      Centre of Mass      Work Power & Energy      Magnetic Effects of Current      Introduction to Laws of Motion      Group 1st A      English Core-XII Sample Test Paper      Function Theory      Basis of Inheritance      Business Studies -XII Sample Test Paper      Group I A      Integration Theory      Organic Chemistry Basic Concepts      Applications of Derivatives      Inorganic Chemistry Group VI A      Properties of Matter      Heat & Thermodynamics     
 



Sponsored Links
Free Exam Papers ?
unit, model, solved papers
IIT, Medical, CBSE. Get Free Now!

vriti.com/Scholarship