Thursday 02nd May 2024
REGISTRATION
Online Fashion Store

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

c) Avani  has created a table named “Doctor”, she wants to increase the OPDCharge by 25% of “Nephro” and “Cardio” department. She wrote  a query-      For - 1 Marks

UPDATE Nephro,Cardio SET OPDCharge=25% WHERE department IN (‘Nephro’,’Cardio’);
Help Avani to run the query by removing the errors from the query and write corrected query.

Ans: UPDATE Doctor SET OPDCharge= OPDCharge + OPDCharge *0.25 WHERE department IN (‘Nephro’,’Cardio’);

d)  Abhi wants to undo the changes made during the transaction execution. What command should Abhi use for this purpose?      For - 1 Marks

Ans: ROLLBACK; (ROLLBACK works only when START TRANSACTION /BEGIN command is issued)

e) Identify the candidate key(s) in the following table.      For - 2 Marks
    Relation: Data


EmpNo

Name

Designation

MobileNo

PANCardNo

Salary

BankAccountNo

Ans: EmpNo, MobileNo, PANCardNo, BankAccountNo

f) GarCode, GarName, Price and FabrCode of table “GARMENT” are given below-      For - 2 Marks


GarCode

GarName

Price

FabrCode

10015

Informal Pant

1899

F02

10089

Formal Pant

1295

F01

10075

Shirt

690

F01

10036

Frock

690

F04

Based on this information, find output of the following queries.

  1. SELECT COUNT(Distinct FabrCode)) FROM GARMENT;
  2. SELECT GarName FROM GARMENT WHERE FabrCode NOT LIKE  ‘__1’;

Ans: 1) 3
        2) Informal Pant
             Frock

g) What is the role of UNIQUE constraint? How is PRIMARY KEY constraint different from UNIQUE constraint?      For - 2 Marks

Ans: UNIQUE constraint works same as Primary Key constraint but,
 UNIQUE Attribute can be NULL but PRIMARY KEY can not be NULL.
 UNIQUE can be assigned to many attribute but PRIMARY KEY can be assigned to one attribute only in a table.

Q .4. a) What is method overriding?      For - 1 Marks

Ans: A method in a sub class hides or overshadows a method inherited from the super class if both methods have the same signature. This property is known as overriding the inherited method.

b) What is the difference between setEnabled and setVisible methods of a control?      For - 1 Marks

Ans: setEnabled method makes the control accessible or inaccessible but control displays on screen whereas setVisible method makes the control visible or invisible on the screen

c) Write the purpose of the following statements.      For - 1 Marks
i) jTextField1.setText("Value"+Math.round(-11.5)); 
ii) final double g=9.8;

Ans: i) It will round off the number and display in text field1 – Value -11
ii) It will declare a constant g with initial value 9.8

d) Rewrite the following code using if ..else.      For - 2 Marks
  switch(ch) {
case ‘a’:
case ‘A’:
 case ‘e’:
case ‘E’:
case ‘i’:
case ‘I’:
case ‘o’:
case ‘O’:
case ‘u’:
case ‘U’: ++v;
break;
default: others++;
}


Ans:
 if(ch==’A’ || ch==’a’ || ch==’E’ || ch==’e’ || ch==’I’ || ch==’i’ || ch==’O’ || ch==’o’ || ch==’U’ || ch==’u’ )
      ++v;
else
     others++;

e) The following code has some error(s). Rewrite the correct code underlining all the corrections made.      For - 2 Marks
int i,c,a=5,b=0;
for(i=0,i<20,i++)
{ if b=0 then
break;
else
  c=a/b;
system.out.show(“Quotient”+c);  

Ans:  int i,c,a=5,b=0;
for(i=0;i<20;i++) // at place of comma(,) semicolon (;) should be there
{ if (b==0)          // comparison operator = = should be used and brackets are missing.
  break;
else
c=a/b; � System..out.Println(“Quotient”+c);

f) What will be the content of jTextField1 and jTextField2 after executing the following code?      For - 2 Marks
String st="Happy New Year 2012";
jTextField1.setText(""+st.substring(17)+st.length());
jTextField2.setText(st.substring(6).trim());  

Ans: jTextField1 will contain 1219 and jTextField2 will contain  New Year 2012

PreviousIndex Next

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