Informatics Practices 2017 CBSE [All India] Set IV
To Access the full content, Please Purchase
-
Q1
1-
(a) Identify the odd one out of the following :
Optical Fiber/Coaxial cable/Bluetooth/Twisted Pair Cable. Give reason for you answer.
(b) How is it easier to diagnose fault in Star topology than in the topology.
(c) What is the purpose of logical address of computer?
(d) Does open source software only mean that the software is free of cost? Give reasons for your answer.
(e) Which of the following are valid IP addresses? Give reason(s) if invalid.
(i) 121.23.1.45
(ii) 192.168.0.254
(iii) 192.168.0.1
(iv) 198.-1.1.1
Marks:10Answer:
1(a) Bluetooth
Bluetooth is a wireless transmission media while others are wired transmission media.
(b) It is easy to diagnose fault in star topology as the nodes are connected to a centralized hub separately, so if failure occurs in one cable it can be easily identified while in Bus topology all nodes are connected to single cable. In case if any fault occurs in Bus topology the whole cable has to be diagnosed.
(c) The purpose of logical address are as follows:-
- To identify a specific NIC on a host device
- To provide the vendor specific information about host.
(d) Open source software has other benefits other than free of cost such as:
- The source code is available.
- It can be modified and adapt as per the user’s requirement.
(e) Valid IP address- (i) & (iii)
(ii) & (iv) are invalid because they does not belong to any Class of IP address.
-
Q2
2(a) Write the value that will be assigned to variable x after executing the following statement:
X = 20 – 5 + 3 * 20 /5
(b) Consider the statement:
Choice = ‘Y’
What is the datatype of variable choice? Write a Java statement to declare the variable ‘choice’.
(c) While working in Netbeans IDE, Amit wants that the text in a Test area should move to the next line without breaking the word. Which properties would help him to do that ?
(d) Write a Java statement to :
Append a string “ABC” to the text that is already in the text area named jText Area1.
(e) Write the output of the following HTML code:
< ol start=”4” >
< li > bake the mixture in oven for an hour < /li >
< li > Remove from oven < /li >
< li > Allow the mixture to stand for ten minutes< /li >
< li > Serve < /li >
< /ol >< /code >
(f) Given below is a code.
< message >
< text > Hello, world! < /text >
< /message >
Which language is used to write the above code?
What are < message >, < /message >, < text > and < text > ?
(g) Rewrite the following code using if else if statement instead of switch:
switch (success) {
case -1: x1 = “No result” ;
case 0 : x1 = “Final result – Not successful” ;
break;
default : x1 = ”result Not Known’;
break;
Marks:10Answer:
(a) The value of x will be 27
(b) The datatype of variable choice is char
Java statement to declare the variable choice:-
char choice = ’ Y ’;
(c ) The property is – lineWrap.
(d) jTextArea.append (“ABC”);
(e) 4. Bake the mixture in oven for an hour
5. Remove from oven
6. Allow the mixture to stand for ten minutes
7. Serve
(f) The language used is:- XML(Extensible Markup language)
< message > < /message > is root element of xml document
< text >< /text > is child tag.
(g) if (success == -1)
x 1 = “No result” ;
else if(success == 0)
x1= “Final result – Not successful”;
else
x1 = “result NOT known” ;
-
Q3
(a) How is a database related to a table?
(b) Ariya wants to add another column ‘Gender’ in the already existing table ‘CUSTOMERS”. She has written the following statement. However, it has errors. Rewrite the correct statement.
[MODIFY TABLE CUSTOMERS GENDER char(1);
(c) In a hospital, the patients are allocated to wards. A database named ‘Hospital’ is created. One table in this database is ; Ward with WardId, WardName, NumOfBeds as columns and WardID as the primary key.
Write another suitable table you could expect to see in the ‘Hospital’ database, with 3 suitable columns identifying Primary key and Foreign key in the table that you expect.
(d) Explain the following statement with the help of example:
“In a transaction either all the SQL statements be committed or all rolled back.”
(e) Given below is the ‘Department’ table:
DEPCODE
DEPNAME
101
ADMIN
102
RECEPTION
103
PERSONNEL
SET AUTOCMMIT =0;
UPDATE Department SET DEPNAME = ‘OFFICE’ WHERE
DEPNAME = ‘ADMIN’;
INSERT INTO Department VALUES (104,’HRD’);
UPDATE Department Set DEPNAME = ‘Front OFFICE’ WHERE DEPNAME =’RECEPTION’;
COMMIT;
DELETE FROM Department Where DEPNAME = ‘FRONT OFFICE’;
ROLLBACK;
SELECT * FROM Department;
What will be the output of the above given SELECT statement?
(f) How is HAVING clause similar to WHERE clause? How is HAVING clause different from WHERE clause? Explain with the help of examples of each.
Marks:10Answer:
(a) Data is organized in database in form of tables. A database table is composed of records and fields that hold data.
(b) The correct statement is:-
ALTER TABLE CUSTOMERS ADD GENDER char(1);
(c ) Table: PATIENT
Columns: PatientId, PatientName, WardId
Primary key : PatientId
Foreign key : WardId
(d) Atomicity requires that each transaction be "all or nothing": if one part of the transaction fails, then the entire transaction fails, and the database state is left unchanged. An atomic system must guarantee atomicity in each and every situation, including power failures, errors and crashes. To the outside world, a committed transaction appears (by its effects on the database) to be indivisible ("atomic"), and an aborted transaction does not happen.
(e) The output is :-
DEPCODE
DEPNAME
101
OFFICE
102
FRONT OFFICE
103
PERSONNEL
104
HRD
(f)HAVING clause and WHERE clause
Similarity:
Both clauses are used to filter the data from the table
Difference:
A WHERE clause is used to filter records from a result. The filter occurs before any groupings are made. WHERE clause places conditions on individual rows.
For Example, to display the city of suppliers where quantity is greater than 150, the command would be:-
SELECT City FROM Supplier WHERE Qty > 150;
A HAVING clause places condition on groups. It is used to filter values from a group.
For Example, to calculate the average gross and total gross for employees belonging to ‘E4’ grade, the command would be:
SELECT AVG (gross), SUM (gross) FROM employee GROUP BY grade HAVING grade=’E4’;
-
Q4
(a) Write the values of r and s after the execution of the following code :
int p = 11;
int q = 21;
int r;
int s;
r = ++q;
s = p++;
r++;
(b) What will be displayed in jTextField1 and jTextField2 after the following code is executed:
int ndigits = 0;
int N = 35;
while (N > 12) {
ndigits = ndigits + 1;
N= N-10;
jTextField1.setText(‘’ “+ndigits) ;
jTextField2.setText(‘’ “+N) ;
(c) Write the value of C after executing the following code:
int P;
int R = 8;
int oddNum;
int C = 0;
for (P = 1; P < R; P=P+3)
{
oddNum = P % 2;
if (oddNum == 1)
{
C= C+1;
}
}
(d) Write the value that will be stored in the variable t after the execution of the following code. How many times will the loop execute?
int sum = 0;
int score = 0;
double t;
do
{
score = score +1;
sum = sum + score;
}
while (score <=3) ;
t = sum / 3;
(e) The following code has error(s). Rewrite the correct code underlining all the corrections made:
int j;
int i =15;
int flag = 1;
while ( j = 2 j < i; j++)
{
if (i % j = 0)
{
flag == 0;
break;
}
}
(f) Ms. Fauzia works as a programmer in ‘TelTel Mobile Company’ where she designed a software to compute charges to be paid by the mobile phone user. A screenshot of the same is shown below;
Each calls is charged at ` 1.00.
Each SMS is charged at ` 0.50.
Users can also opt for Mobile Data Plan. Charges for Mobile Data Plan are flat ` 50.00.
Help Ms. Fauzia in writing the code to do the following:
(i)When the ‘Calculate Charges’ button is clicked, ‘Calls and SMS Charges’, ‘Mobile Date Plan Charges’ and ‘Amount to Pay’ should be calculated and displayed in the respective text fields.
‘Amount to Pay’ is calculates as :
Calls and SMS charges + Mobile Data Plan Charges (if any)
(ii)When the ‘Clear’ button is clicked, all the textfields and checkbox should be cleared.
(iii)When the ‘Exit’ button is clicked, the application should close.
Marks:15Answer:
(a) The value of r= 23 and s=11
(b) jTextField1 = 3
jTextField2 = 5
(c) The value of c will be 1
(d) The value of t will be 2.0
The loop will execute 3 times
(e) The correct code is:-
int j;
int i= 15;
int flag =1;
while ( j< i)
{
if (i%j == 0)
{
flag = 0;
break;
}
}
(f) (i) Double callsmscharges=0, dataplancharges, amount=0;
double calls = Double.parseDouble(JTextField3.getText());
double sms = Double.parseDouble(JTextField4.getText());
callsmscharges = ((calls *1.0) + (sms*0.50));
jTextField5.setText(“ “ + callsmscharges);
if(jCheckBox1.isSelected() = = true)
{
dataplancharges = 50.00 ;
}
amount = callsmscharges + dataplancharges;
jTextField6.setText(“ “ + dataplancharges);
jTextField7.setText(“ “ + amount);
(ii) jTextField1.setText(“ “ );
jTextField2.setText(“ “ );
jTextField3.setText(“ “ );
jTextField4.setText(“ “ );
jTextField5.setText(“ “ );
jTextField6.setText(“ “ );
jTextField7.setText(“ “ );
jCheckbox1.setSelected(false);
(iii) System.exit(0);
-
Q5
5-
Consider the Table “Infant’ shown below;
Note: Discount column stores discount %.
Write the commands in SQL for (i) to (viii) and output for (ix) and (x)
(i) To display the details about the cot.
(ii) To list the names of items and their unit price that have unit price less than 800 and discount more than 5%.
(iii) To list the names of items and their date of purchase that were purchased after 31st December, 2015.
(iv) To display the number of items that have more than 10% as discount.
(v) To display item code and unit price in decreasing order of unit price.
(vi) To increase the unit price of each item by 10% of their unit price.
(vii) To display the highest unit price of items.
(viii) To display the names of items that have ‘Baby’ anywhere in their item names.
(ix) SELECT MID (Item,1,2) FROM Infant;
(x) SELECT AVG(UnitPrice) FROM Infant WHERE DATEPURCHASE >’2015-01-01’;
Marks:10Answer:
(i) SELECT * FROM Infant WHERE Item = “Cot”;
(ii) SELECT Item,UnitPrice FROM Infant WHERE Unitprice < 800 AND Discount > 5;
(iii) SELECT Item, DatePurchase FROM Infant WHERE DatePurchase > 2015-12-31 ;
(iv) SELECT COUNT(Item) FROM Infant WHERE Discount> 10 ;
(v) SELECT Itemcode,UnitPrice FROM Infant ORDER BY Unitprice DESC ;
(vi) UPDATE Infant SET UnitPrice = UnitPrice + 0.1* UnitPrice ;
(vii) SELECT MAX(UnitPrice) FROM Infant ;
(viii) SELECT Items FROM Infant WHERE Item LIKE %Baby% ;
(ix)
(x) 1750
-
Q6
(a) “XYZ” Company conducts workshops for employees of organizations. The company requires data of workshops that are organized. Write SQL query to create a table ‘Workshop’ with the following structure:
Field
Type
Constraint
WorkshopID
Integer
Primary Key
Title
Varchar(50)
DateWorkshop
Date
NumSpeakers
Integer
(b) Consider the tables given below and answer the question that follow:
Table: Event
EventId
Event
NumPerformers
CelebrityID
101
Birthday
10
C102
102
Promotion Party
20
C103
103
Engagement
12
C102
104
Wedding
15
C104
Table: Celebrity
CelebrityID
Name
Phone
FeeCharged
C101
Faiz Khan
99101956
200000
C102
Sanjay Kumar
893466448
250000
C103
Neera Khan Kapoor
981166568
300000
C104
Reena Bhatia
65877756
100000
i) Name the Primary Keys in both the tables and Foreign Key in ‘Event table. Can NumPerformers (Number for performers) be set as the Primary key? Give reason.
ii) How many rows will be present in the Cartesian join of the above mentioned two tables?
(c) With reference to the above given tables (in Q6 b), write the commands in SQL for (i) to (iii).
(i) To display EventId, Event name, Celebrity Id and Names of celebrities for only those events that have more than 10 performers.
(ii) To display Event name, Celebrity Id and Names of celebrities who have “Khan” anywhere in their name.
(iii) To display Event name, Names of celebrities and Fee charged for those celebrities who charge more than 200000.
In the table ‘Event’, the CelebrityID 102 is present twice in the column ‘CelebrityId”. Is there any discrepancy? Give reason
Marks:10Answer:
(a) CREATE TABLE XYZ
(
WorkshopId integer Primary key,
Title varchar(50),
DateWorkshop Date,
NumSpeakers integer
);
(b) (i) Primary key in:
Table ‘Event’ – EventId
Table ‘Celebrity’ – CelebrityId
Foreign key in table ‘Event’ - CelebrityId
(ii) The rows in Cartesian Join will be - 16
No, there is no discrepancy as one celebrity can go for multiple events.
(c) (i) SELECT EventId,Event,c.CelebrityId,Name FROM Event e, Celebrity c WHERE e.CelebrityId=c.CelebrityId AND NumPerformers>10;
(ii) SELECT Event, c.CelebrityId,Name FROM Event e, Celebrity c WHERE e.CelebrityId=c.CelebrityId AND Name LIKE %Khan%;
(iii) SELECT Event,Name FROM Event e, Celebrity c WHERE e.CelebrityId=c.CelebrityId AND FeeCharged > 200000;
-
Q7
(a) List two disadvantages of e-governance to a disabled person.
(b) How do online retailers usually offer customers a wider range of products at prices that are lesser than those of traditional stores?
(c) Ms. Cathy is creating a form for Vidya University Sports Council application. Help her to choose the most appropriate controls from ListBox, ComboBox, TextField, TextArea, RadioButton, CheckBox, Label and Command Button for the following entries:
S. No.
Function
1
To let the user enter NAME
2
To let the user enter MOBILE NUMBER
3
To let the user choose one PROFESSION OUT of the categories : Teaching/Non-Teaching/Research Scholar
4
To let the user select facilities out the Gym, Yoga, Table Tennis, Badminton and Aerobics, More than one facility may be chosen.
Marks:5Answer:
(a) The two disadvantages are:-
- Lack of the knowledge of computers among old people.
- Lack of awareness about the e-governance programs
(b) Online retailers procure the item directly from the company/industry and deletes the involvement of wholesale/distributor who hikes up the price for retailer. The retailer has no choice but to pass on the rate to the customers with little margin for him.
(c) 1- TextField
2- TextField
3- Radio button
4- List