Informatics Practices 2016 CBSE [Delhi] Set IV
To Access the full content, Please Purchase
-
Q1
(a) Two doctors have connected their mobile phones to transfer a picture file of a person suffering from a skin disease. What type of network is formed? Which communication media out of Coaxial cable, Optical fiber, Bluetooth, Satellite link should be used to transfer the file? [2]
(b) State reason why Star topology requires more cable length than Bus topology. [2]
(c) “Open Source Software developers work for the good of community”. Is this statement true? Give reason. [2]
(d) What happens during ‘Domain Name Resolution’? [2]
(e) How is ‘Denial of service’ attack, a threat to Network security? [2]
Marks:10Answer:
a. PAN
Bluetoothb. In a star topology, each node has its own cable that is directly connected to a central hub or switch, whereas in bus topology all the nodes are connected to a single cable. Thus, the star topology requires more cable as compared to bus topology.
c. Yes, the above statement is true. In OSS (Open Source Software), the users have access to the source code and the debugging tools. The users are allowed to tweak the source code to suit their needs and also suggest bug fixes and enhancements in the source code. The OSS are available free of royalties and fees. So, we can say that the Open Source Software (OSS) developers work for the good of community.
d. The process of translating a domain name to an IP address is called Domain Name Resolution.
e. Denial-of-Service (DoS) is an attempt by an attacker to shut down a machine or network, making it unavailable to its intended users. In DoS, the target is usually flooded with traffic or sends information that result in crash. Therefore, it is a threat to network security.
-
Q2
(a) Identify the odd one out of the following statements. State reason for your choice. [1]
i. switch
ii. do while
iii. while
iv. for
(b) What is the difference between setVisible() and setEnabled() methods? [1](c) What is the difference between the following statements i) and ii). [1]
i. a = 5;
ii. if (a==5)
x = 3;(d) Write the output in jtextField1 if depcode is 3. [1]
switch(depcode)
{
case 1 :
allowance = 4000;
break;
case 2 :
allowance = 3200;
break;
default :
allowance = 1000;
}
jTextField1.setText(" "+allowance);
(e) Sandhya is creating a webpage. She is entering HTML code on her computer. In between, she keeps pressing ‘Refresh’ / ‘Reload’ button on her browser. What is the purpose? [2]
(f) What does ‘XML’ stand for? How is the purpose of HTML different from XML? [2]
(g) Write Java code (statements) to declare Y as an integer variable. Then, assign the value 30 to a variable Y. Increase the value of Y by 5 and store the increased value in Z. [2]
Marks:10Answer:
(a) i) switch
switch is a selection statement but others are looping/iteration statements.(b) setVisible() is used to set the visibility of a component, whereas setEnabled() is used to enable or disable the component.
(c)
In i) variable ‘a’ is being assigned the value 5 whereas in ii) a is being checked for equality with 5.
OR
In i) assignment operator is used and in ii) relational operator ‘==’ is used.(d) 1000
(e) The purpose of ‘Refresh’ / ‘Reload’ is to view the changes in the webpage.
(f) XML stands for eXtensible Markup Language. HTML is designed to display data and hence focuses on the ‘look’ of the data, whereas XML is designed to describe data and carry data and hence focuses on ‘what data is’.
(g)
int Y;
Y = 30;
Y = Y + 5;
Z = Y;
-
Q3
(a) What is MySQL? [1]
(b) Charvi is inserting "Sharma" in the "LastName" column of the "Emp" table but an error is being displayed. Write the correct SQL statement. [1]
INSERT INTO Emp(‘Sharma’) VALUES (Lastname) ;
(c)
FriendCode
Name
Hobbies
F101
Bijoy
Swimming
F102
Abhinav
Reading Books
F103
Jyotsna
Dancing
Now, Kunal wants to delete the ‘Hobbies’ column. Write the MySQL statement. [1]
(d)
Table: SalesSCode
Name
City
Aakriti
Mumbai
Aman
Punjab
Banit
Delhi
Fauzia
Mumbai
SELECT * FROM Sales
WHERE City = ‘Chennai’
AND City = ‘Mumbai’; [1]
Rewrite the correct sentence if wrong or write statement is correct.
(e) (i) Name 2 Aggregate (Group) functions of SQL. [2]
(ii) Consider the table:
Table: Company
SID
SALES
S101
20000
S103
NULL
S104
10000
S105
15000
What output will be displayed by the following SQL statement?
SELECT AVG(SALES) From Company;
(f) Given below is the ‘Stu’ table: [2]
RNO
NAME
1
Amit
2
Bhishm
The following statements are entered:
SET AUTOCOMMIT = 0;
INSERT INTO Stu VALUES(5,'Rahul');
COMMIT;
UPDATE Stu set name='Rahuliya' where Rno= 5;
SAVEPOINT A;
INSERT INTO Stu VALUES(6,'Cristina');
SAVEPOINT B;
INSERT into Stu values(7,'Fauzia');
SAVEPOINT C;
ROLLBACK TO B;
Now what will be the output of the following statement:
SELECT * FROM Stu;
(g) Consider the table ‘Hotel’ given below: [2]
Table: Hotel
EMPID
Category
Salary
E101
MANAGER
60000
E102
EXECUTIVE
65000
E103
CLERK
40000
E104
MANAGER
62000
E105
EXECUTIVE
50000
E106
CLERK
35000
Mr. Vinay wanted to display average salary of each Category. He entered the following SQL statement. Identify error(s) and Rewrite the correct SQL statement.
SELECT Category, Salary
FROM Hotel
GROUP BY Category;
Marks:10Answer:
(a) MySQL is a Relational Database Management System.
(b) INSERT INTO Emp(Lastname) VALUES (‘Sharma’) ;(c) ALTER TABLE Friends DROP Hobbies;
OR
ALTER TABLE Friends DROP COLUMN Hobbies;
(d)
SELECT * FROM Sales
WHERE City = ‘Chennai’
OR City = ‘Mumbai’;
ORSELECT * FROM Sales
WHERE City = ‘Chennai’ || City = ‘Mumbai’;
OR
SELECT * FROM Sales
WHERE City IN (‘Chennai’, ‘Mumbai’);
(e)
(i) AVG(), COUNT()(ii) 15000
(f)
RNO
NAME
1
Amit
2
Bhishm
5
Rahuliya
6
Cristina
(g)
SELECT Category, AVG(Salary)
FROM Hotel
GROUP BY Category;
-
Q4
(a) When is if‐else if statement preferred over switch statement? [1]
(b) What is the purpose of break statement? [1]
(c) What will be displayed in jTextField1 and jTextField2 after the following code is executed? [1]int t;
int s;
s = 2;
t = (4*s++)/2;
jTextField1.setText(" "+t);
jTextField2.setText(" "+s);
(d) Write the contents of jTextField1, jTextField2, jTextField3 and jTextField4 when the following statements are executed:[2]String x;
String str = "Java";
x = str.concat("study");
double a = 7.8765;
jTextField1.setText(x.length()+" ");
jTextField2.setText(x.toUpperCase());
jTextField3.setText(x.subString(2,5));
jTextField4.setText(Math.round(7.8765)+"");
(e) Rewrite the following code using WHILE loop: [2]
int sum = 0;(f) The following code has error(s). Rewrite the correct code underlining all the corrections made:[2]
int x = 10;int y = 50;
do;
{
x+5=x;
y-5=y;
(g) Vijay has developed a software for planning personal budget. A screenshot of the same is shown below: [3]
Total Income, Expenses of Bills (Water/Electricity), Groceries,Entertainment, other expenses and whether money is to be sent toHostel are entered by the user. Sum of Expenses, Grand Total ofExpenses and Savings are calculated and displayed by the program.
Write the code to do the following:
(i). When ‘CALCULATE’ button is clicked, Sum of Expenses, Total Expenses and Savings should be calculated and displayed in appropriate text fields. [3]- Sum of Expenses is calculated by adding expenses on Bills(Water/Electricity), Groceries, Entertainment and other expenses.
- Grand Total of Expenses is calculated according to the following criteria:
If ‘Money to be sent to Hostel’ checkbox is selected, 3000.00 is to be added to the sum of expenses. If it is not selected, Grand Total of Expenses is the same as sum of expenses. - Savings = Total Income – Grand Total of Expenses.
(ii) When ‘CLEAR’ button is clicked, all text fields and checkbox should be cleared. [1]
(iii) When ‘CLOSE’ button is clicked, the application should close. [1]
Marks:15Answer:
(a) The if-else statement is preferred over switch statement:
- When relational operators have to be used
- When range checks has to be done
- When data types other than int& char have to be used
(b) ‘break’ statement terminates the loop/switch and transfers control to the statement following the loop/switch.
(c) 4 will be displayed in jTextField13 will be displayed in jTextField2
(d) jTextField1: 9jTextField2: JAVASTUDY
jTextField3: vas
jTextField4: 8
OR
9
JAVASTUDY
vas
8(e)
int sum = 0, i= 9;while (i>=1)
{
if(i%3==0)
sum = sum + i;
else
sum = sum i;
i--;
}
(f)
int x = 10;
int y = 50;
do
{
x= x+5;
y = y-5;
}
while (x<=y);(g)
Ans //Calculation of Sum of Expenses
jTextField6.setText("" +
Integer.parseInt(jTextField2.getText()+
Integer.parseInt(jTextField3.getText()+
Integer.parseInt(jTextField4.getText()+
Integer.parseInt(jTextField5.getText());//Calculation of Grand Total of Expenses
if(jCheckBox1.isSelected())
jTextField7.setText("" + 3000 +
Integer.parseInt(jTextField6.getText()));
else
jTextField7.setText("" +
Integer.parseInt(jTextField6.getText()));// Calculation of Savings
jTextField8.setText(“” +
Integer.parseInt(jTextField1.getText()) -
Integer.parseInt(jTextField7.getText()));(ii) When ‘CLEAR’ button is clicked, all text fields and checkbox should be cleared.
jTextField1.setText("");
jTextField2.setText("");
jTextField3.setText("");
jTextField4.setText("");
jTextField5.setText("");
jTextField6.setText(“”);
jTextField7.setText("");
jTextField8.setText(“”);
jCheckBox1.setSelected(false);(iii) When ‘CLOSE’ button is clicked, the application should close.
System.exit(0); -
Q5
(a) Anita has created the following table with the name ‘Order’. [2]
Table: OrderColumn Name
Constraint
OrderId
Primary Key
OrderDate
Not Null
OrderAmount
StoreId
One of the rows inserted is as follows:
OrderId
OrderDate
OrderAmount
StoreId
0101
2015-02-12
34000
$104
i. What is the data type of columns OrderId and OrderDate in the table Order?
ii. Anita is now trying to insert the following row :OrderId
OrderDate
OrderAmount
StoreId
0102
NULL
59000
$105
Will she be able to successfully insert it? Give reason.
(b) Write the output of the following SQL queries: [2]
(i) SELECT MID(‘BoardExamination’, 2, 4);
(ii) SELECT ROUND(67.246, 2);
(iii) SELECT INSTR(‘INFORMATIONFORM’, ‘FOR’);
(iv) SELECT DAYOFYEAR(‘2015-01-10’);(c) Write commands in SQL for (i) to (iv) and output for (v) and (vi). [6]
Table: Store
(i) To display Name, Location, City, SalesAmount of stores in descending order of SalesAmount.
(ii) To display names of stores along with SalesAmount of those stores that have ‘fashion’ anywhere in their store names.
(iii) To display Stores names, Location and Date Opened of stores that were opened before 1st March 2015.
(iv) To display total SalesAmount of each city along with city name.
(v) SELECT distinct city FROM store;
(vi) SELECT Name, length(name),left(name,3) FROM Store where NoOfEmployees< 3;
Marks:10Answer:
(a)
(i)
Data type of OrderId : varchar/char
Data type of OrderDate : dateAns. ii. No. Reason - Not Null Constraint applied on attribute OrderDate
(b)
i. oard
ii. 67.25
iii. 3
iv. 10
(c)
(i) SELECT Name,Location,City, SaleAmount
FROM Store
ORDER BY SaleAmount desc;(ii) SELECT Name,SalesAmount
FROM Store
WHERE Name like ‘%fashion%’;(iii) SELECT Name,Location,DateOpened
FROM Store
WHERE DateOpened<’03/01/2015’;OR
SELECT Name,Location,DateOpened
FROM Store
WHERE DateOpened<03012015;(iv) SELECT SUM(SalesAmount),City
FROM Store
GROUP BY City;(v)
City
Delhi
Mumbai
(vi) Empty Set
OR
No Output -
Q6
(a) Write SQL query to create a table ‘Event’ with the following structure: [2]
(b) Consider the table given below: [2]
(i) Which column is used to relate the two tables?
(ii) Is it possible to have a primary key and a foreign key both in one table? Justify your answer with the help of table given above.
(c) With reference to the above given tables, write commands in SQL for (i) and (ii) and output for (iii) : [6]
(i) To display CourseId,TeacherId, Name of Teacher, Phone Number of Teachers living in Delhi.
(ii) To display TeacherID, Names of Teachers, Subjects of all teachers with names of Teachers starting with ‘S’.
(iii) SELECT CourseId, Subject, TeacherId, Name, PhoneNumber FROM Faculty, Course WHERE Faculty.TeacherId = Course.TeacherId AND Fee >= 5000;Marks:10Answer:
(a)
CREATE TABLE Event
(
EventId VARCHAR(5) PRIMARY KEY,
EventName VARCHAR(30) NOT NULL,
Location VARCHAR(50),
ClientID INTEGER,
EventDate DATE
);(b)
(i)TeacherId column is used to connect the two tables.
(ii) Yes.
As in the Table:Course, CourseId can be used as Primary key and TeacherId is the foreign key.(c)
(i)
SELECT CourseId, TeacherId, Name, PhoneNumber
FROM Course, Faculty
WHERE Course.TeacherId = Faculty.TeacherId
AND city = ‘Delhi’;
(ii) SELECT TeacherId,Name,Subject FROM Faculty, Course WHERE Faculty.TeacherId=Course.TeacherIdANDName like ‘S%;;(iii)
CourseId
Subject
TeacherID
Name
PhoneNumber
C103
Physics
T101
Savita Sharma
991019564
C105
Advance Computer Science
T104
Simi Arora
659777564
-
Q7
(a) “In e‐Business, customers should shop only when they trust the e‐store provider for payment methods”‐ Justify the statement [1]
(b) Which of the following statements is NOT true in e‐Governance? Rewrite the statement after correcting it. [2]
(i) Online applications and tracking of status of applications should be provided.(ii) Citizens should not be required to submit documents in physical form.
(iii) On line Forms should be made tricky so that only well educated users can enter data.
(iv) Government should interact with citizens and enlighten them about different schemes through social media and web based platforms.
(c) Ms. Arora is creating a form for accepting Visa applications. Help her to choose most appropriate controls out of ListBox, ComboBox, TextField, TextArea, RadioButton, CheckBox, Label and Command Button for the following entries. [2]
S.No
Function
To enter EMAIL ID
To choose GENDER
To choose NATIONALITY from countries given as options
To enter REMARKS in the form of a paragraph about the purpose of visit.
Marks:5Answer:
(a)In e‐business, security about the transaction being made by the customer is of utmost importance. A customer should ensure that information about his/her bank accounts, credit cards should not be available to unauthorized persons/e‐stores as account may be hacked or money may get stolen/embezzled.
(b)
Online Forms should be made so simple that all users can enter data.
(c)S.NO
Function
Control
To enter EMAIL ID
Text Field
To choose GENDER
Radio Button
To choose NATIONALITY from countries given as options
Combo Box
To enter REMARKS in the form of a paragraph about the purpose of visit.
Text Area