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

Q 2 . Answer the following questions:-

a) A variable amount has a value 25365. Write the statement to display the value in a Label control named lblAmount.      For - 1 Marks

Ans:  lblAmount.setText(“ ”+amount);

b) What is the purpose of break statement in switch…case statement?      For - 1 Marks

Ans: In a switch statement, when a match is found, the statement sequence associated with that case is executed until a break statement or end of switch is reached so if break statement is missing the statement sequence is executed from the case which was found true to downward until the end of the switch statement is reached no matter whether the statement sequence falls under any other case or default clause.

c) Differentiate between <A> and <B> tag of HTML.      For - 1 Marks

Ans:  <A> tag is known as Anchor tag and used for Hyper linking and <B> tag is used for converting the sentence/paragraph in Bold face.

d) Write any two features of XML.      For - 1 Marks

Ans: Features of XML (any two)
1. XML is free and extensible
2. XML is platform independent
3. Can be used to create new language 4. It is designed to Carry data, not to display data.

e) What will be the output after executing the following code?      For - 2 Marks
int fun(int n)
   { int r=(n%2==0)?1:0;
       return r;
   }      
int t=5,p;
do
{   p=fun(t);
 if(p==1)
 System.out.println(t+p);
else
System.out.print(t+p);
}while(++t<10);  

Ans: 57
        79
        9

f) Write a method in Java that takes an year (4-digit) and return true if year is leap, otherwise false.      For - 2 Marks

Ans:  boolean funLeap(int year)
{
if(year%4==0 && year%100!=0 || year%400==0)
return true;
else
return false;
}

g) What are the uses of the following tags:-      For - 2 Marks
      <HTML>,  <SUP>, <H1>, <TR>

Ans: <HTML> - Identifies that the document is a HTML document.
<SUP> - Displays the text in superscript way. i e. a2+b2
<H1> - Displays text in Heading format (for largest heading size)
<TR> - Used to specify table row, it is contained in <TABLE> tag.

Q 3 . a) If a database “Library” exists. Write the command to start working in this database.      For - 1 Marks

Ans: USE Library;    

b) While creating a table “MobDet”, Kavita forgot to set primary key for the table. Write the statement to set the column MobileNo as the primary key of the table      For - 1 Marks

Ans: ALTER TABLE MobDet ADD PRIMARY KEY (MobileNo);

PreviousIndex Next

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