Question Bank For Class XII
Question Bank For Class XII
Q1 a. Ms. Kant Sengupta wants to prevent unauthorized access to/from his company’s local area network. 1
Write the name of a system (software/hardware), which he should install to do the same.
b. Seven Brother Fashion Inc. is a fashion company with design unit and market unit 130 meters away 1
from each other. The company recently connected their LANs using Ethernet cable to share the stock
related information. But, after joining their LANs, they are not able to share the information due to loss of
signal in between. Which device out of the following should you suggest to be installed for a smooth
communication?
(i) Modem (ii) Repeater (iii) UPS
c. Which of the following is not a feature of Networking? 1
(i) Resourcesharing (ii) Reliability
(iii) Uninterrupted power supply (iv) Reduced cost
d. Name any two Indian scripts included in Unicode. 1
e. Mr. Vidya Chauhan is confused between Proprietary and Open source software. Mention at 2
least two points of differences to help her understand the same.
f. Identify the type of topology from the following: 2
(i) In it, each node is connected with the help of a single co‐axial cable.
(ii) Init, eachnode is connectedwiththe helpofindependentcable with the helpofa central switching
(communication controller).
g. Define the following with reference to Threats to network security. 2
(i) Worm (ii) Trojan Horse
Q2 a. Raj kamal International school is planning to connect all computers, each spread over distance within 1
45 meters. Suggest an economical cable type having high‐speed data transfer, which can be used to
connect these computers.
b. Name two Indian Script included in UNICODE. 1
c. Write examples of one Proprietary and one Open Source Software. 1
d. Name any two most popularly used internet browsers. 1
e. Ms. Rani Sen, General Manager of Global Nations Corporate recently discovered that the communication 2
between her company’s accounts office and HR office is extremely slow and signals drop quite frequently.
These offices are 125 meters away from each other and connected by an Ethernet cable.
(i) Suggest her a device, which can be installed in between the offices for smooth
communication.
(ii) Whattypeofnetworkisformedbyhavingthiskindofconnectivityoutof LAN,MAN and
WAN?
f. GiveanadvantageofusingStar topologyoverBustopology.Showa networklayoutof star topology to 2
connect 5 computers.
g. Give suitable example of URL and Domain name. 2
Q3 a. Write the name of the most suitable wireless communication channels for each of the following 1
situations.
(i) Communication between two offices in different countries.
(ii) To transfer the data from one mobile phone to another.
b. What is UNICODE? Name one Indian language, which is supported by UNICODE. 1
c. Expand the following terms: 1
(i) FLOSS
(ii) HTTP
d. Mr. Chandervardhan is not able to identify the Domain Name in the given URL. Identify and write it for 1
him. http://www.cbse.nic.in/aboutus.htm
e. What do you understand by Network Security? Name two common threats to it. 2
1|P a g e
f. Write one advantage of Star Topology over Bus Topology and one advantage of Bus Topology Over 2
Star Topology.
g. What is MAC address? What is the difference between MAC address and anIP address? 2
Q4 a. Why is a switch called an intelligent hub ? 1
b. What was the objective behind developing UNICODE? 1
c. Expand the following terms: (i) OSS (ii) ODF 1
d. What is the use of Repeater in a Network? 1
e. Identify the following device : 2
(i) A device that is used to connect different types of network. It performs the necessary
translation so that the connected network can communicate properly?
(ii) A device that converts data from digital bit stream into an analog signal and vice
versa.
f. Write one advantage and one disadvantage of using Optical fiber cable. 2
g. Distinguish between Open Source Software and Proprietary Software. 2
Q5 a. A school with 20 stand‐alone computers is considering networking them together and adding a server. 1
State 2 advantages of doing this.
b. Distinguish between LAN and WAN. 1
c. What is the purpose of Modem in network? 1
d. Write one example of IP Address. 1
e. Define ‘Domain Name Resolution’. 2
f. Name two threats to security in a network. What is the role of Firewall in Network 2
security?
g. Write one advantages and one disadvantage of Open Source Software over Proprietary 2
software.
Q6 a. Vidya College has three departments that are to be connected into a network. Which of the following 2
communication medium (out of the given options), should be used by the college for connecting
their departments for very effective High Speed communication?
Coaxial Cable
Optical Fiber
Ethernet Cable
Also name the type of network (out of PAN/LAN/WAN) formed.
b. State reason why Star topology requires more cable length than Bus topology. 2
c. Seema needs a network device that should regenerate the signal over the same network before the signal 2
becomes too weak or corrupted. Amit needs a network device to connect two different networks
together that work upon different networking models so that the two networks can communicate
properly.
Name the devices that should be used by Seema and Amit.
2|P a g e
Question No.2 (10 Marks)
Q8 a. While working in Netbeans, Ms. Khorana wants to display ‘Pass’ or ‘Needs to Reappear’ message depending 1
the marks entered in jTextField. Helpher tochoose more appropriate statement out of ‘If statement’ and
‘Switch statement’.
b. How one can make a Text Field un‐editable on a Frame? 1
c. Which HTML tags are used for making a table and adding rows in a HTML document? 1
d. How is <OL> tag different from <UL> tag of HTML? 1
e. What will be the value of P and Q after execution of the following 2
code: int P,Q=100;
for(P=10;P<=12;P++)
{ Q+=P;
}
JOptionPane.showMessageDialog(this, ”P:” + P + ”Q:” + Q + ””);
f. Differentiate between XML and HTML. 2
g. WritejavacodethattakesthecostofapencilfromjTextField1andnumberof pencilfrom 2
jTextField2 andcalculatetotal amountascost*numbertobe displayed in jTextField3 and 20%
service tax out of total amount in jTextField4.
Q9 a. While making a Form in Netbeans, Mr. Harihar Jha wants to display a list of countries to allowtheusersto 1
selecttheirowncountry.Suggesthimtochoosemostappropriate control out of ListBox and ComboBox.
b. What is the purpose of break keyword while using Switch Case Statement? Illustrate with the help of an 1
example.
c. Write the name of HTML tag used to include numbered list in a HTML Web Page. 1
d. Write HTML code for the following: 1
To provide hyperlink to a website :http://www.cbse.nic.in”
e. What will be the content ofthe jTextArea1 after executing the following code (Assuming that the 2
jTextArea1 had no content before executing this code)?
for(int c=1; c=4; c++)
{ jTextArea1.setText( jTextArea1.getText()+””+Integer.toString(c*c));
}
f. Which of the following units measures the speed with which data can be transmitted from one node to 2
another node of a network? Also give the expansion of the suggested unit.
(i) KMph (ii) KMpl (iii) Mbps
g. Write java code that takes value for a number (n) in jTextField1 and cube (n*n*n) of it to be displayed in 2
jTextField2.
Q10 a. Which property of palette ListBox is used to enter the list of items while working in NetBeans? 1
b. WhatisthedifferencebetweentheuseofJTeaxtFieldandJPasswordFieldinaform? 1
c. “Thevariable/expressionintheswitchstatementshouldeitherevaluatetoaninteger value or String 1
value.” State True or False.
d. Name two attributes of FONT tag of HTML. 1
e. How many times will the following loops execute? Which one of them is Entry Control and which one is Exit 2
Control?
Loop 1 Loop 2
int i=10, sum=0; while int i=10, sum=0; do
(i>1) { sum+=i;
{ sum+=i; i‐=3;
i‐=3; } while (i>1);
}
3|P a g e
f. WhatwillbedisplayedinjTextField1andjTextField2aftertheexecutionofthefollowing loop? 2
int Sum=0,Last=10;
for(intC=1;C<=Last;C+=2)
Sum++;
jTextField1.setText(Integer.toString(Sum));
jTextField2.setText(Integer.toString(C));
g. Differentiate between the <TR> and <TD> tags of HTML with the help of an appropriate example. 2
Q11 a. Is a string containing a single character same as a character? 1
b. Write a statement in Java to declare a String type variable with a name City. 1
c. Distinguesh between ‘/’ and ‘%’ operators. 1
d. Which tag/attributes of HTML are used to‐ 1
(i) Insert a picture in a web page.
(ii) Insert an empty line in the web page.
e. What will be the values of variable agg and agg1 after the execution of the following 2
loops?
Loop1 Loop2
int a=9,agg=9; int a=9,agg=9; do
while (a>10) { agg1+=b;
{ agg+=a; a‐=2; b‐=2;
} } while(b>10);
f. What will be displayed injTextArea1 after the execution of the following loop? for (int i=5; 2
i>=2; i‐ ‐)
jTextArea1.setText (jTextArea1.getText()+ “ ”+ Integer.toString (i*i) );
g. Give two attributes of Table element of HTML. 2
Q12 a. Write the value of variable ‘c’ after execution of the following code: 1
int d;
int c;
d=7;
c=(5*++d)%3;
b. What is the difference between jTextField and jPasswordField components? 1
c. In a SWITCH statement, what is the purpose of ‘default’ section? 1
d. AftertypingtheHTMLcodeusingtexteditor,howdoyouseehowitwouldlookasaweb page? 1
e. Write Java code to assign the value 500 to variable x. Increase the value of x by 50 and store it in variable 2
y.
f. Write the output that will be generated by the code given below: 2
int i; i=7;
int r;
r=8;
While (i<=10)
{System.out.println(r*i); i=i+2;
}
g. “WithXMLtherearenopredefinedtags”‐explaininbriefwiththehelpofanexample. 2
Q13 a. Identify the odd one out of the following Java statements. State reason for your choice 1
(i) for
(ii) do while
(iii) switch
(iv) while
b. Write the purpose of parseInt() method. 1
4|P a g e
c. Identify invalid variable names out of the following. State reason if invalid. 1
(i) for
(ii) –salary
(iii) salary12
(iv) product
d. What is the difference between statements (i) and (ii) 1
(i) t = 2;
(ii) if (t == 2) d = 3;
e. Write HTML tags to do the following : 2
(i) Inserting a horizontal line in a web page.
(ii) Inserting a line break
f. What does ‘XML’ stand for? How is the purpose of HTML different from XML? 2
g. Rewritethefollowing codeusingifelseifstatement: 2
switch (depcode)
{ case 1 : allowance = 4000; break;
case 2 : allowance = 3200; break;
default : allowance = 1000;
}
Q14 a. Write the value that will be assigned to variable x after executing thefollowing statement: 1
x = 20 ‐5 + 3 * 20/5;
b. Consider the statement: 1
choice = ‘Y’;
What is the data type of variablechoice? Write Javastatementto declarethe variable ‘choice’.
c. While working in Netbeans IDE, Amit wants that the text in a Text area should move to the next line 1
without breaking the word. Which propertieswouldhelphimdo that?
5|P a g e
Question No.3 (10 Marks)
Q15 a. Write MySql command that will be used to open an already existing database “CONTACTS”. 1
b. The Doc_name Column of a table Hospital is given below: 2
Based on the information, find the output of the following queries:
(i) Select doc_name from Hospital where doc_name like “%v”;
(ii) Select doc_name from Hospital where doc_name like “:%e%”;
c. Atable“Transport”inadatabase hasdegree3andcardinality8.Whatisthenumber 2
of rows and columns in it?
d. Differentiate between Alternate key and Candidate key. 1
e. Define a class with reference to Object Oriented Programming. 1
f. A employee_Id consisting of 5 digits is stored in a string variable strEmpld. Now Mr. Deb wants to store this Id 1
in integer type of variable IntEmpld. Write a java statement to do this.
g. Sarthak, a student of class XII, created a table “Class”. Grade is one of the columns of this table. To find 2
the details of students whose Grades have not been entered, he wrote the following MySql query,
which did not give the desired result.
SELECT * FROM Class WHERE Grade=”Null”;
Help Sarthak to run the query by removing the errors from the query and write the correct Query.
Q16 a. Write MySql command to open an existing database. 1
b. Ms. Mirana wants to remove the entire content of a table “BACKUP” alongwith its structuretoreleasethe 1
storagespace.WhatMySqlstatementshouldsheuse?
c. Give one difference between ROLLBACK and COMMIT commands used in MySql. 1
d. AtableSTUDENThas4rowsand2columnsandanothertableTEACHERhas3rowand4 columns. How many 1
rows and columns will be there if we obtain the Cartesian product of these two tables?
e. Mr. Sanghi created two tables with CITY as Primary key in Table1 and Foreign Key in Table2. While 2
inserting a row in Table2, Mr. Sanghi is not able to enter a value in the column CITY. What could be
the possible reason for it?
f. Item code consisting of 5 digits is stored in an integer type variable intItemCode. Mr. Srikant wants to store this 2
Item code in a String type variable called strItemCode.
Write appropriate java statement(s) to help her in performing the same.
6|P a g e
f. Mr. Kapoor is a programmer at Ekansh Enterprises. He created 5 digit password and stored in a string variable 2
called strPassword. He wants to store the same password in an Integer type variable called intPassword.
Write an appropriate Java statement to transfer the content from strPassword to intPassword.
g. Mrs. Kumar is using table STUDENTS with the following columns: RNO, 2
ADMNO, NAME, AGGREGATE
Shewantstodisplayallinformationofstudentsindescendingorderofnameand within ascending
order of aggregate. She wrote the following SQL query and she did not get the desired output:
SELECT * FROM STUDENTS ORDER BY NAME, AGGREGATE DESC;
Q18 a. Distinguish between ALTER TABLE and UPDATE commands of MySQL. 1
b. Mentioned two categories in which MySQL commands are broadly classified? 1
c. Give two characteristics of Primary key? 1
d. A table FUNFOOD has 13 rows and 17 columns. What is the cardinality and degree of this table? 1
e. AnumericcolumnMONEYcontains34567.7896.WriteacommandtotruncateMONEY. 2
(i) Up to 2 decimal places. (i.e. expected result 34567.78)
(ii) Up to ‐3 places (i.e expected result 34000)
f. What happens when ROLLBACK command is issued in a transaction process? 2
g. Shanya Khanna is using a table Employee. It has the following columns. Admno, Name, Agg, 2
Stream [ column Agg contains aggregate marks] Shewants to display highest Agg in each
stream.
She wrote the following statement:
SELECT Stream, MAX(Agg) FROM Employee;
But she did not get the desired result. Rewrite the above query with necessary changes to help her get the
desired output.
Q19 a. What is MySQL? 1
b. Is NULL value the same as 0 (zero)? Write the reason for your answer. 1
c. Write the UPDATE command to increase the commission (column name :COMM) by 500 of all the 1
salesman who have achieved sales (Column name : SALES) more than 200000. The table’s name is
COMPANY.
d. While using SQL pattern matching, what is the difference between ‘_’ (underscore) and ‘%’ wildcard 1
symbols?
e. How is primary key constraint different from Unique key constraints? 2
f. Write one similarity and one difference between CHAR and VARCHAR data types. 2
g. What is a Transaction? Which command is used to make changes done by a transaction permanent on a 2
database?
Q20 a. What is the meaning of ‘Open source’ in the term ‘Open Source Database Management System’? 1
b. In a table ‘Employee’, a column ‘Occupation’ contains many duplicate values. Which keyword would 1
you use if you wish to list only different values?
c. How is ALTER TABLE statement different from UPDATE statement? 1
d. Charvi wants to delete the records where the "FirstName" is "Rama" in the ‘Emp’ Table. She has entered 1
the following SQL statement. Anerrorisbeingdisplayed.Rewritethe correct statement.
DELETE ‘Rama’ FirstName FROM Emp;
e. (i) Name 2 Group (Aggregate) functions of SQL. 1
(ii) Consider the table: 1
7|P a g e
f. Given below is the ‘Emp’ table: 2
SET AUTOCOMMIT = 0;
INSERT INTO Emp VALUES(5,'Farzia'); COMMIT;
UPDATE Emp SET NAME ='Farzziya' WHERE Eno= 5; SAVEPOINT A; INSERTINTOEmp
VALUES(6,'Richard'); SAVEPOINTB;
INSERT INTO Emp VALUES(7,'Rajyalakshmi'); SAVEPOINT C; ROLLBACK TO B;
Identifyerror(s)inthefollowingSQLstatement.RewritethecorrectSQLstatement.
SELECT Department, Salary FROM Company GROUP
BY Department;
Q21 a. How is a database related to a table ? 1
b. Ariya wants to add another column ‘Gender’ in the already existing table ‘CUSTOMERS’. She has 1
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 2
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 youexpect.
d. Explain the following statement with the help of example: 2
“In a transaction either all the SQL statements be committed or all rolled back.”
SET AUTOCOMMIT = 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 HAVINGclause similar to WHEREclause? How is HAVINGclause different from 2
WHEREclause? Explain with the help of examples of each.
8|P a g e
9|P a g e
Question No. 4 (15 Marks)
Q22 a. WhatwillbedisplacedinofjTextField1afterexecutingthefollowingcode? int m=16; 2
m=m+1;
if(m<15)
jTextField1.setText(Integer.toString(m)); else
jTextField1.setText(Integer.toString(m+15));
b. Rewritethefollowing programcode using aSwitchstatement. if(code==1) 2
Month=”January”; else
if(code==2)
Month=”February”; else
if(code==3)
Month=”March”;
else if(code==4)
Month=”April”;
else
Month=”No Match”;
c. What will be displayed in jTextArea1 after executing the following statement: 1
jTextArea1.setText(“cbse\n Final_Exam\t IP”);
do {
sum=K;
K+=2;
} while (K=<20)
jTextField1(Integer.toString(sum));
e. Givenastringobject namely‘subject’, havingvalue as“123”storedinit.Whatwillbe result of the following: 1
JOptionpane.showMessageDialoge(null,””+(subject.length()+Integer.parseInt(subject)));
f. The following code hassomeerror(s).Rewrite the correctcode underlining allthe correction 2
made:
int Sum=0, Step=5;
Int I;
for(i=0, i=<5; i++)
{ Step += 5;
Sum += Step;
}
jTextArea1.showText(“”+Sum);
g. Mr. Radhey Shyam Bansal the owner of the Kiddi Land Enterprise has asked his programmer Ekta to devlop 5
the following GUI in Netbeans.
10 | P a g e
Mr. Bansal accepts payment through three types of credit cards. The discount is given according to the
following scheme:
Type of Card Discount
Platinum 20% of Amount
Gold 15% of Amount
Silver 10% of Amount
If the bill amount is more than Rs. 25,000/‐ then the customer gets an additional offer of 5%. Write java
code for the following:
(i) To assign Additional Discount as 0 and Net amount as 0. Also set them as un‐editable.(1)
(ii) To calculate discount as per the given criteria and display the same in jTextField3 To assign Additional
Discount(jTextField4) as5%of amount(jTextField2) asperthe above condition. Also enable
“Calculate Net Amount” button, when ‘Calculate Discount’ button is clicked. (2)
(iii) TocalculatenetamountasBillAmount‐(Discount+AdditionalDiscount)and displaythenet
amountincorresponding TextField,when“CalculateNetAmount” button is clicked. (2)
Q23 a. What message will be displayed after the execution of the following code? int Age=64, 2
Relaxation=4;
int ModiAge=Age – Relaxation; if
(ModiAge<60)
jOptionPane.showMessageDialog(Null,”NOT Eligible”);
else
jOptionPane.showMessageDialog(Null,”Eligible”);
b. Rewrite the following program code using aIfstatement. 2
int c = jComboBox1.getSelectedIndex() ;
switch(c)
{ case 0 : Amount = Bill; break; case 1 :
Amount=0.9*Bill; break; case 2 :
Amount=0.8*Bill; break; default :
Amount=Bill;
}
c. How many times does the following while loop get executed? int K=5; 1
int L=36;
while(K<=L)
{ K+=6;
}
d. WhatwillbedisplayedinjTextArea1afterexecutingthefollowingstatement? 1
jTextArea1,setText(“GREAT\n COUNTRY\tINDIA”);
e. What will be the values of variables ‘m’ and ‘n’ after the execution of the following code? int P,Q = 0; 2
for(P=1; P<=4; P++)
{ Q += P;
Q ‐ ‐;
}
f. Given a string object named Pay having value as “68000” stored in it. Obtain the output of the following: 2
JOptionPane.showMessageDialog(null,
” “+Salary.length()+Integer.parseInt(Salary));
11 | P a g e
g. Janav Raj is a programmer at Path Educo Enterprises. He created the following GUI in NetBeans. Help him to
write code for the following:
(i) To display series of odd or even number (depending on Starting Number‐jTextField1 is even or odd) in
the jTextArea on the click of command button [Display The Series]. For example:
If the Start Number is 5 and Last Number is 11 Text Area Content will be 5 7 9 11
If the Start Number is 2 and Last Number is 10 Text Area Content will be 2 4 6 8 10
(ii) To clear both the text fields and text area, on clicking [Reset] button.
(iii) Toterminate the application onthe clickof [stop]button. (Assume suitable names for the various
controls on the Form)
Q24 a. WhatwillbethecontextofjTextArea1andjTextField1 aftertheexecutionofthefollowing statements? 2
(i) jTextArea1.setText(“Just\tAnother\nDay”);
(ii) string Subject=”Informatics Practices”;
jTextField1.setText((Subject.length()+10)+” ”);
b. Rewrite the following program code using aifstatement. String 2
Remarks;
int Code=Integer.parseInt(jTextField1.getText()); switch(Code)
{ case0:Remarks=”100% TaxExemption”; break;
case1:Remarks=”50% TaxExemption”; break;
case2:Remarks=”3% TaxExemption”; break;
default: Remarks=”! Invalid Entry”;
}
c. Write a java statement to make the jTextField1 non‐editable. 1
d. WhatwillbethedisplayedinjTextField1andjTextField2aftertheexecutionofthe following code? 2
int Last,First=3,Second=5; Last=First +
Second++;
jTextField1.setText(Integer.toString(Last));
jTextField2.setText(Integer.toString(Second));
e. Observethe following code carefully and find which statementwill never getexecutedin the code? 1
int t=1; //Statement 1
do //Statement 2
{ //Statement 3
if(t>13) //Statement 4
jTextField1.setText("Something"); //Statement 5
else //Statement 6
jTextField1.setText("Pass"); //Statement 7
t+=3; //Statement 8
} //Statement 9
while (t<=15); //Statement 10
f. WhatwillbethedisplayedinjTextField1andjTextField2aftertheexecutionofthe following code? 2
int Last,First=3,Second=5; Last=First +
Second++;
jTextField1.setText(Integer.toString(Last));
jTextField2.setText(Integer.toString(Second));
12 | P a g e
g. What will be the contents of Str1 and Str2 after the following code is executed? 2
String Str2,Str1;
Str1="Dear Friend";
Str2="Hello";
Str1=Str2.concat(Str1);
Q25 a. Aditya is a programmer at Edudel enterprises. He created the following GUI in NetBeans. 5
To stop execution and exit from the application on the click of command button “Exit”.(1)
13 | P a g e
g. Give theoutput ofthe following Javacode: String 2
name= “Chennai Express”;
int TM= name.length(), TN; TN=
80‐TM;
jTextField2.setText(Integer.toString(TM));
jTextField3.setText(Integer.toString(TN));
Q26 a. Mr. Rangaswami works at a Recreation Park as a system analyst. He has created the following GUI.
Whena group arrives at the RecreationPark,the numberof people inthe group and whether the 5
group wants to enjoy the Water Park or not is entered. Entry fee is Rs.
500 per person. The person can choose to play at Water park by selecting the checkbox. Rides of
Water Park will cost Rs. 250 extra per person.
b. The following code has some error(s). Rewrite the correct code underlining all the corrections made. 2
int marks, temperature;
marks = jTextField1.getText());
temperature = Integer.parseInt(jTextField2.getText());
if (marks<80) and (temperature>=40)
{ System.out.println(“Not Good”);
}
else;
{ System.out.println(“OK”);
}
c. How many times will the following WHILE loop execute? 2
int y = 7, sum = 0;
while (y<=15)
{ sum = sum +y; y=y+2;
}
14 | P a g e
d. Rewrite the following program code using IF ELSE IF instead of SWITCH statement: String tour; 2
intc1=Integer.parseInt(jTextField1.getText()); switch
(c1)
{
case 8 : tour = “\n You are going to camp Ramgarh”; break;
case9:tour=“\nYouaregoingtoManali,RohtangPass”; break;
case 10: tour = “\n You are going to Chail”; break;
default : tour = “ No School tour for you this time”;
}
e. Write the values of sum and x after executing of the following code: 2
int sum , x; sum
=7;
x= 5;
sum=sum+(x++);
f. What will be the contents of jTextField1 and jTextField2 after executing the following code 2
String s= “Best”; jTextField1.setText(s.length()+ “”);
jTextField2.setText(s.toUpperCase());
g. The students of “Shiksha Vidyalaya” work for different extracurricular activities like ‘community 5
Outreach Program’, ‘Swachh Bharat Abhiyan’ and ‘Traffic Safety Club’. The
Programmer at the school has developed a GUI application as shown below:
15 | P a g e
d. Write the output that will be displayed in the textfields by thefollowingJavacode: String x; 2
String stream="Commerce"; jTextField1.setText((stream.length()+9)+""); x =
stream.concat("Humanities");
jTextField2.setText(x);
jTextField3.setText(" "+ x.substring(2,5));
jTextField4.setText(stream.toLowerCase());
e. Write the value thatwill bestoredinvariablesum afterexecutionof followingcode: int sum = 0, m=4; 2
for( int i=9; i >= 6; i‐‐)
{ if(i%3==0)
sum = sum + i;
else
sum = sum ‐ i;
}
f. The following code has error(s). Rewrite the correct code underlining all the corrections made :
inta=0;intb=15; do ; 2
a= a+3; b
=b‐3;
while a <= b ;
g. Ms. Sharma works as a programmer in “ABC Car Rental Company” where she has designed a 6
software to compute charges to be paid by the client. A screenshot of the same is shown below:
A client can take any car out of Deluxe/ SemiDeluxe/ Ordinary for rent.
A client can also opt for services of a guide. Charges vary depending on the type of car opted. Charges of
services of Guide are extra.
16 | P a g e
(ii) Amount is obtained by multiplying per day charges of Car with number of days for which the car
is taken.
If‘GuideRequired’checkboxisselected,GuidechargesperdayareRs.500.00. Guide Charges is
calculated as : Car required for No. of days * 500;
TotalAmount=Amount+GuideCharges (2)
(iii) When‘CLEAR’ button is clicked, all textfields andcheckboxes should be cleared. (1)
(iv) When ‘CLOSE’ button is clicked, the application should close. (1)
Q28 a. Write the values of r ands after execution offollowing code: int p = 11; 1
intq=21;
intr;ints; r =
++q;
s=p++;
r++;
b. What will be displayed in jTextField1 and jTextField2 after the following code is executed: 2
intndigits=0; int
N = 35; while
(N>12)
{ ndigits = ndigits + 1; N =
N‐10;
}
jTextField1.setText(""+ndigits);
jTextField2.setText(""+N);
c. WritethevalueofCafterexecutingthefollowingcode: int P; 2
intR=8;
int oddNum;
int C = 0;
for (P = 1; P < R; P=P+3)
{ oddNum = P %2; if
(oddNum == 1)
{ C= C+1;
}
}
d. Writethevaluethatwillbestoredinvariabletaftertheexecutionofthefollowing code . How many 2
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 codeunderliningallthecorrections made : 2
int j;
int i = 15;
intflag=1;
while( j = 2 j < I ; j++)
{
if(i % j = 0)
{
flag==0;
break;
}
}
17 | P a g e
f. Ms. Fauzia works as a programmer in “TelTel Mobile Company” where she has designed a software to 6
compute charges to be paid by the mobile phone user. A screenshot of the same is shown below:
18 | P a g e
Question No. 5 (10 Marks)
Q29 a. What is the purpose of ALTR TABLE command in MySql? How is it different from UPDATE command? 2
b. Table employee has 4 records and Table Dept has 3 records in it. Mr. Jain wants to display 1
all information stored in both of these related tables. He forgot to specify equi‐join condition in the
query. How many rows will get displayed on execution of this query?
c. Consider the table EXAM given below. Write commands in MySql for(i) to (iv) and output for (v) 7
to (vii)
Table: EXAM
No Name Stipend Subject Average Division
1 Karan 400 English 68 FIRST
2 Aman 680 Mathematics 72 FIRST
3 Javed 500 Accounts 67 FIRST
4 Bishakh 200 Informatics 55 SECOND
5 Sugandha 400 History 35 THIRD
6 Suparna 550 Geography 45 THIRD
(i) To list the names of those students, who have obtained Division as FIRST in the ascending
order of NAME.
(ii) To display a report listing NAME, SUBJECT and Annual stipend received assuming that the stipend
column has monthly stipend.
(iii) To count the number of students, who have either accounts or informatics as subject.
(iv) ToinsertanewrowinthetableEXAM: 6,”Mohan”,500,”English”,73,”Second”
(v) SELECT AVG(Stipend) FROM EXAM WHERE DIVISION=”THIRD”
(vi) SELECT COUNT(DISTINCT Subject) FROM EXAM;
(vii) SELECT MIN(Average) FROM EXAM WHERE Subject=”English”;
Q30 a. WhatisthepurposeofORDERBYclauseinMySql?HowisitdifferentfromGROUPBY clause? 2
b. Table SCHOOL has 4 rows and 5 columns. What is the Cardinality and Degree of this table? 1
c. Consider the Table SHOPPE given below. Write command in MySql for (i) to (iv) and output for (v) to 7
(vii)
(i) To display names of the items whose name starts with ‘C’ in ascending order of Price.
(ii) To display code, Item name and City of the products whose quantity is less than 100.
(iii) To count distinct Company from the table.
(iv) To insert a new row in the table Shoppe
‘110’,’Pizza’,’Papa Jones’, 120, ”Kolkata”, 50.0
(v) Select Item from Shoppe where Item IN (“Jam”,”Coffee”);
(vi) Select Count(distinct(City)) from Shoppe;
(vii) Select MIN(Qty) from Shoppe where City=”Mumbai”;
Q31 a. WhatistheuseofCOMMITstatementinSQL?HowisitdifferentfromROLLBACK statement? 2
b. Mr. James created a table CLIENT with 2 rows and 4 columns. He added 2 more rows to it and deletedone 1
column.WhatistheCardinality andDegreeoftheTableCLIENT?
c. Consider the following table FITNESS with details about fitness products being soldinthe store. Write 7
command of SQL for (i) to (iv) and output for (v) to (vii).
19 | P a g e
PCODE PNAME PRICE MANUFACTURER
P1 Treadmill 21000 Coscore
P2 Bike Table:
20000FITNESS
Aone
(i) To display all information of the students of humanities in descending order of percentage.
(ii) To display Adno, Name, Percentage and Stream of those students whose name is less than 6
characters long.
(iii) To add another column Bus)Fees with datatype and size as decimal (8,2).
(iv) To increase percentage by 2% of all the humanities students.
(v) SELECT COUNT(*) FROM EXAM;
(vi) SELECT Sname, Percentage FROM EXAM WHERE Name LIKE “N%”;
(vii) SELECT ROUND(Percentage,0) FROM EXAM WHERE Adno=”R005”;
Q33 a. Distinguish between Single Row and Aggregate functions of MySQL. Write one example of each. 2
b. Consider the following table named “SOFTDRINK”. Write commands of SQL for (i) to 7
(iv) and output for (v) to (vii).
Table: SOFTDRINK
DRINKCODE DNAME PRICE CALORIES
101 Lime and Lemon 20.00 120
102 Apple Drink 18.00 120
103 Nature Nectar 15.00 115
104 Green Mango 15.00 140
105 Aam Panna 20.00 135
106 Mango Juice Bahar 12.00 150
20 | P a g e
(i) To display names and drink codes of those drinks those have more than 120 calories.
(ii) To display drink codes, names and calories of all drinks, in descending order of calories.
(iii) To display names and price of drinks that have price in the range 12 to 18 (both 12 and 18 included)
(iv) Increase the price of all drinks in the given table by 10%.
(v) SELECT COUNT(DISTINCT(PRICE)) FROM SOFTDRINK;
(vi) SELECT MAX (CALORIES) FROM SOFTDRINK;
(vii) SELECT DNAME FROM SOFTDRINK WHERE DNAME LIKE “%Mango%”;
c. What is the degree and cardinality of ‘SOFTDRINK’ Table ? 1
Q34 a. Srishti has created the following table with the name ‘Veterinary’. 2
(i) What are the data type of columns AnimalId and VacinnationDate in the table Veterinary ?
(ii) Srishti is now trying to insert the following row
21 | P a g e
Q35 a. Consider the Table “Infant” shown below. 10
Table: Infant
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) Todisplaythe namesofitemsthathave‘Baby’anywhereintheir itemnames
(ix) SELECT MID(Item,1,2) FROM Infant;
(x) SELECTAVG(UnitPrice)FROMInfantWHEREDATEPURCHASE>’2015‐01‐01’;
NOTE : Discount column stores discount %.
Write the commands in SQL for (i) to (viii) and output for (ix) and (x)
22 | P a g e
Question No. 6 (10 Marks)
Q36 a. WriteaMySqlcommand forcreatingatable“BANK” whose structureis givenbelow: 2
b. In a database there are two tables “ITEM” and “CUSTOMER” as shown below: 5
23 | P a g e
Q37 a. Write a MySql command to creat the Table STOCK including its Constraints. Table STOCK: 2
Table BRAND:
24 | P a g e
Table : DEPARTMENT
Q39 a. Write MySQL command to create the table “Toyz” with the following structure and constraints. 2
Table : TOYZ
25 | P a g e
Q40 a. Write MySQL command to create the Table ‘LIBRARY’ with given constraints. 2
Table: LIBRARY
COLIMN_NAME DATATYPE(SIZE) CONSTRAINT
BookId Int(10) Primary Key
BookName Varchar(40) Not Null
Type Char(4)
Author Varchar(40)
No_Copies Int(6)
Price Decimal(8,2)
b. In a database company, there are two tables given below:
Table: SALES
SALESMANID NAME SALES LOCATIONID
S1 ANITA SINGH ARORA 250000 102
S2 Y.P.SINGH 1300000 101
S3 TINA JAISWAL 1400000 103
S4 GURDEEP SINGH 1250000 102
S5 SIMI FAIZAL 1450000 103
Table: LOCATION
LOCATIONID LOCATIONNAME
101 Delhi
102 Mumbai
103 Kolkata
104 Chennai
Write SQL queries for the following:
(i) To display SalesmanID, names of salesmen, LocationID with corresponding location names.
(ii) To display names of salesmen, sales and corresponding location names who have achieved Sales
more than 1300000.
(iii) To display names of those salesmen who have ‘SINGH’ in their names.
(iv) Identify Primary key in the table SALES. Give reason for your choice.
(v) WriteSQLcommandtochangetheLocationIDto104oftheSalesmanwithIDasS3 in the table
‘SALES’.
Q41 a. Write SQL query to create a table ‘Song’ with the following structure: 2
26 | P a g e
b. Consider the tables given below. 2
c. With reference to the above given tables (in Q6 b), Write commands in SQL for (i) and (ii) and output for (iii) 6
given below:
(i) To display Client names of clients, their phone numbers,PartyId and party description who
will have number of guests more than 50 for theirparties.
(ii) To display Client Ids, their addresses, number of guests of those clients who have ‘Adarsh’
anywhere in their addresses.
27 | P a g e
b. Consider the tables given below and answer the questions that follow : 2
Table: Event
Table: Celebrity
28 | P a g e
Question No. 7 (5 Marks)
Q43 a. Give one social impact of e‐Business. 1
b. Writethree important features ofe‐Governance? Give URLof one of the commonly 2
used e‐ Governance portal.
c. Anujaiscreatingaformforherpracticalfile.Helphertochoosemostappropriate controls from List Box, 2
Combo Box, TextField, TextArea, RadioButton, Checkbox, Label and Command button for the following
entries from user.
(i) A message “Enter Marks” in front of a TextField.
(ii) An input to choose more than one subjects from a set of choices.
(iii) An input for entering remarks.
(iv) An input for accepting Gender.
29 | P a g e
c. Sabeena is creating a form for the hotel where she works. Help her to choose most appropriate 2
controls from ListBox, ComboBox, TextField, TextArea, RadioButton, CheckBox, Label and
Command Button for the following.
S.No. Function
1 To input name
2 To allow enter gender out of M or F
3 To allow selecting type of room out of Delux, SemiDelux, General
4 To allow entries preferences of guest in the form of paragraph
Q48 a. How is an e‐commerce business more cost effective than traditional business? Write two points. 2
b. How is e‐learning beneficial for old people? Write one point. 1
c. Ms. Ariya is creating a form for PAN CARD application. Help her to choose most appropriate 2
controls from ListBox, ComboBox, TextField, TextArea, RadioButton, CheckBox, Label and
Command Button forthe followingentries.
30 | P a g e