SP - Ip - MS PDF
SP - Ip - MS PDF
Class XII
Informatics Practices (Code: 065)
2014-15
Time: 3Hrs. MM: 70
1 (a) Draw a network layout of bus topology to connect 5 client computers and 1 server (1)
computer.
Ans:
http://www.cbse-international.com/help.htm
Explain to her the main concept of URL and Domain name with reference to the
example given above.
Ans: URL (Uniform Resource Locator) is the complete address of a document on the
web, whereas a domain name specifies the location of document's web server. A
domain name is a component of the URL used to access web sites.
(1 mark for differentiating between URL and domain name ½ mark for correctly
identifying url and ½ mark for correctly identifying domain name)
(e) Chanakya has to write a paragraph in English on nobel laureates as a part of his
holiday homework. He is using a software in which he types the text in Hindi and
the software automatically converts the text into English. For example, if he types
“नोबेल प्राइज इस गिवेन इन ससक्स कैटे िरीज” the software converts it into “Nobel Prize is
given in six categories”. What kind of text entry is it – phonetic text entry OR (2)
keymap based text entry? How is it different from the other kind of text entry?
Ans: It is phonetic text entry.
It is different from keymap based text entry as in the keymap based text entry
keyboard keys are mapped to specific characters using a keymap whereas in
phonetic text entry text translation is done by some software based on probable
pronunciation of the entered text.
(1 mark for specifying “phonetic text entry”)
(1 mark for specifying correct difference)
2
2 (a) In a java program Rajat wants to use a variable to store the quantity of an item (1)
which may be in whole numbers or decimals. Write a suitable java statement to
declare the variable for the above mentioned purpose.
int ch=Integer.parseInt(jTextField1.getText());
switch(ch)
{
case 1:jTextField2.setText("Service");
case 2: jTextField2.setText("Complaint");
case 3: jTextField2.setText("Operator");
break;
default: jTextField2.setText("Not a valid entry");
}
On entering the value 1, 2 or 3, he is getting the same output. Mention the possible
reason for the same.
Ans: Break statement is missing after every case.
(1 mark for correct answer)
(e) Jennifer wants to write html code to create an ordered list starting with “c”. Help (2)
her in writing the code.
3
Ans: <ol type= “a” start=3>
(1 mark for OL)
(½ mark for type)
(½ mark for correct value of start)
(f) Write any two advantages of xml over html. (2)
Ans: 1. HTML is designed to display data and hence focused on the ‘look’ of the data,
whereas XML is designed to describe and carry data and hence focuses on ‘what
data is’.
2. In HTML tags are predefined, while in XML, tags can be created as per needs.
(1 mark each for any two correct advantages)
(g) Write java code that take any three digit number from the user in jTextField1, (2)
calculate the sum of the digits and display it in separate textfield named
jTextField2.
For example If the number entered is 432, it should answers as 9 (i.e. 4+3+2).
Ans : int n=Integer.parseInt(jTextField1.getText());
int result=0;
while(n>0)
{
result = result+n%10;
n=n/10;
}
jTextField2.setText(""+result);
4
(c) Kuhu has already created a table ‘Hospital’ as shown below: (1)
Now she wants to add a new column ‘Address’ in the above given table. Suggest to
her suitable MySQL command for the same.
Ans: Alter table Hospital add Address varchar(20);
(d) Amit works as a database administrator in a Multinational bank. He wants to undo (1)
the changes made in the current transaction. Suggest to him a suitable MySQL
command for the same.
Ans: Rollback
(e) What will be the output of the following queries on the basis of Employee table: (2)
+-------+-------+--------+
| EmpId | EName | Salary |
+-------+-------+--------+
| A001 | Bob | 5600 |
| A002 | John | NULL |
| A003 | Tom | 5000 |
+-------+-------+--------+
(i)Select avg(Salary) from Employee;
(ii) Select Salary+100 from Employee where EmpId='A002';
Ans: (i)
mysql> Select avg(Salary) from Employee;
+-------------+
| avg(Salary) |
+-------------+
| 5300.0000 |
+-------------+
(ii)
mysql> Select Salary+100 from Employee where EmpId='A002';
+------------+
| Salary+100 |
+------------+
| NULL |
+------------+
(1 mark for each correct output)
5
(f) A table named ‘GAMES’ has the following contents: (2)
Write the output that will be displayed by statements (i) and (ii).
SELECT * FROM GAMES;
SET AUTOCOMMIT = 0;
INSERT INTO GAMES VALUES(105,'CHESS’,2,9000);
ROLLBACK;
SAVEPOINT S1;
SELECT * FROM GAMES; ------------ (i)
INSERT INTO GAMES VALUES(108,'LAWN TENNIS’,4,25000);
SAVEPOINT S2;
INSERT INTO GAMES VALUES(109,'CRICKET’,11,20000);
ROLLBACK TO S2;
SELECT * FROM ITEM; ------------ (ii)
Ans: (i)
GCode GameName Number_of_Players PrizeMoney
101 Carom Board 2 5000
102 Badminton 2 12000
103 Table Tennis 4 8000
(ii)
GCode GameName Number_of_Players PrizeMoney
101 Carom Board 2 5000
102 Badminton 2 12000
103 Table Tennis 4 8000
108 Lawn Tennis 4 25000
(i) SELECT * FROM club WHERE salary between 20000 and 30000;
(ii) SELECT * FROM club WHERE salary IN ( 20000, 30000);
(iii) SELECT * FROM club WHERE salary >= 20000 and salary <=30000;
(iv) SELECT * FROM club WHERE salary = 20000 OR salary = 30000;
Make pairs of the equivalent SQL statements given above (which give the same
output) and place each pair in a group.
Ans: Group A
(i)
6
(iii)
Group B
(ii)
(iv)
(½ Mark for each correct answer)
4 (a) Define inheritance with reference to object oriented programming. (1)
Ans: Inheritance is a process of creating a new class (derived class or sub class) from
existing class. The derived class not only inherits capabilities of the base class but
also can add new features of their own.
7
jTextArea1.append(""+a++);}
JOptionPane.showMessageDialog(null,"Finished!!!");
Ans: int a=10,b=4;
while(a<=16){
jTextArea1.append(""+a++);
a++;
b+=2;}
JOptionPane.showMessageDialog(null,"Finished!!!");
(½ mark for correct while statement, ½ mark for correct increment statement
and 1 mark for correct use of variables)
(f) The following code has error(s). Rewrite the correct code underlining all the (2)
corrections made :
String str1 = SeemaSurakshabal ;
int b;
for(int b = 0 ; b < 3 , b++ ) {
jTextArea1.showText(str1+"\n" ) ;
str1 = str1 + b ; }
Ans: String str1 = “SeemaSurakshabal” ;
int b;
for(int b = 0 ; b < 3 ; b++ ) {
jTextArea1.append(str1+"\n" ) ;
str1 = str1 + b ; }
(½ mark for each correct error)
(g) Ms. Rakhi works in an International Bank as an IT Head. She designed a simple (6)
interest calculator program as shown below:
8
The interest rate is given based on the account type as shown below:
i. Write the code required for ‘INTEREST RATE’ button to display interest rate
as per the above given criteria.
ii. Write the code required for ‘SI’ button to calculate and display ‘Simple
Interest’ based on the given formulae:
SI=(amount*interest_rate*duration)/100;
iii. Write the code required for ‘CLEAR ALL’ to clear all the textfields.
Ans : i. Correct code required for ‘INTEREST RATE’ button to display interest rate as per
the above given criteria:
if(R1.isSelected()==true)
T3.setText("4");
else if(R2.isSelected()==true)
T3.setText("6");
if(R3.isSelected()==true)
T3.setText("8");
iii
t1.setText("");
t2.setText("");
t3.setText("");
t4.setText("");
t5.setText("");
9
5 (a) Observe the table ‘Club’ given below: 2
Club
Table “Friends” is shown below. Write commands in SQL for (i) to (iv) and output
for (v) to (vii).
10
6 Jette 13 Nykobing Denmark [email protected]
7 Alexender 15 Melbourne Australia NULL
8 Shashank 16 Banglore India NULL
Ans: i. Select name from friends where country not like “India”;
ii. Select name,city,country from friends order by age desc;
iii. Select count(*) from friends where email_id like “%gmail%;
iv. Select name,city from friends where email_id is null;
OUTPUT
v.
Name Age Country
Alice 14 USA
Angel 16 USA
Alexender 15 Australia
vi.
Ucase(concat(name,”*”,city))
Charles*Copenhagen
Jette*Nykobing
vii.
UID
Alic
Ange
11
6 (a) Write SQL query to create a table ‘Bank_Customer’ with the following structure: (2)
Customer_info
Transaction_Detail
i. Is it possible to have primary key and foreign key in one table? Justify your
answer.
ii. A table can have maximum how many primary keys and foreign keys?
12
Ans: i. Yes, it is possible to have primary key and foreign key column in one table.
Primary key column is used to uniquely identify each record of the table while
foreign key column is used to maintain referential integrity.
As in the above given table ‘Transaction_Detail’, Trans_Id column is a primary key
column while Acc_No column may act as a foreign key column.
Flights
Fares
With reference to these tables, write commands in SQL for (i) and (ii) and output
for (iii) below:
i. To display flight number, source, airlines of those flights where fare is less
than Rs. 10000.
ii. To count total no of Indian Airlines flights starting from various cities.
13
and fare<10000;
14
4. Display the picture of the employee
Ans:
Sno Control used to : Control
1. Enter the name Text Field
15