CBSE Important Questions

CBSE Guess > Papers > Important Questions > Class XII > 2012 > Computer Science > Computer Science Vinay Kumar Srivastava

Computer Science- CBSE CLASS XII

PreviousIndex Next

g) Dream Land Enterprises has  computerized its billing. The following data entry screen is used to generate bill      For - 6 Marks

The criteria for calculation of delivery and handling charges is as given below-


Category of City

Charges

A Class

Rs. 3500

B Class

Rs. 4000

C Class

Rs. 4500

I Write the code to make the text fileds txtSubTotal, txtTax, txtDelHanCh and txtTotal non editable and set the category of city as C class.

II Write code to do the following-
  a) Write the code for Calculate button to calculate and display Sub Total, Tax, Delivery & Handling Charges and Total depending on the category of the city.
      •Sub Total is calculated as Unit Price * Quantity.
      •Tax is calculated as 7.85% of Sub Total
      •Total is calculates as the sum of Sub Total, Tax and Delivery and Handling Charges. If Company Employee check box is checked then tax should be 2.5%.

�� b) When Clear button is clicked all the text boxes should be clear and Close the application when Exit button is pressed

Ans: I. txtSubTotal.setEditable(False);
     txtTax.setEditable(False);
     txtDelHanCh.setEditable(False);
     txtTotal.setEditable(False);
     optCClass.setSelected(True);

   II. a) Code for Calculate Button
       double qty,unitPrice, tax, subtotal, dhCharges,total
       qty=Double.parseDouble(txtQuantity.getText());
        unitPrice=Double.parseDouble(txtUnitPrice.getText());
        subtotal= qty* unitPrice;
        if(chkCompEmpl.isSelected()==True)
       tax=subtotal*(2.5/100);
else
       tax= subtotal *(7.85/100);
       if(optAClass.isSelected()==True)
       dhCharges=3500;
       if(optBClass.isSelected()==True)
      dhCharges=4000;
      if(optCClass.isSelected()==True)
      dhCharges=4500;
       total=subtotal+tax+dhCharges;
       txtSubTotal.setText(“ “+subtotal);
       txtTax.setText(“ “+tax);
       txtDelHanCh.setText(“ “+dhCharges);
       txtTotal.setText(“ “+total);

b) Code For Clear Button-
     txtQuantity.setText(“ “);
      txtQuantity.setText(“ “);
      txtSubTotal.setText(“ “);
      txtTax.setText(“ “);
      txtDelHanCh.setText(“ “);
      txtTotal.setText(“ “);
         or
txtTotal.setText(null); //null can also be used.
   Code for Exit Button- 
System.exit(0); ���������������������������

Q . 5 a) Explain the need of GROUP BY clause in SELECT query with example.      For - 2 Marks

Ans: GROUP BY clause is used to group all those records that have identical values in a particular field or a group of fields (attribute). Eg.
         SELECT stream, Count(*)
         FROM student
         GROUP BY stream;
It will display the stream wise no. of students. ���������������������������

b) Write output of the following SQL queries :      For - 2 Marks
     i) SELECT DAYOFMONTH(‘2010-12-23’);
     ii) SELECT TRUNCATE(170,-2);
     iii) SELECT INSTR(‘Coordination ‘,’o’);
     iv) SELECT CONCAT(‘India’,NULL,’Australia’);

Ans: i) 23
ii) 100
iii) 2
iv) NULL

PreviousIndex Next

Prepared By: Mr. Pradumna Singh
mail to: [email protected]