Sie sind auf Seite 1von 3

Second Unit Test

Class XII (2012-12)


Subject: Informatics Practices
MM 40
Hours

Time 1.5

1) Which property would you use for setting the password character as $?
1
2) What is the use of Default clause in Switch statement?
1
3) A phone No. consisting of 10 digits is stored in a string type variable strphone.
Now it is required
to store this Phone no in a long type variable lngphone . Write a Java statement
to do the same.
4) Write the statement to import JOptionPane Class.
1
5) Write statement to check if the Check Box chkmember is selected or not.
1
6) Write the code so that the user can only view the content of JTextField but
cannot edit it.
1
7) Write one common method & one Common property of JList & JCombo.
1
8) Write the difference between <P> tag and <BR> Tag.
1
9) Define <HR> Element with all of its attributes.
1
10)
Write any two features of XML.
1
11)
Write the output of the following codes:
4
i)
String str=Indian Idol;
JtextArea.setText(str.substring(1,5)+ +2000+12);
ii)
String x=Hello Students;
int len=x.length();
JtextArea.append(len++x.toUpperCase());
iii)
int value =Integer.parseInt(txt1.getText()+txt2.getText())
Value in txt1 is: 12
Value in txt2 is: 35
JOption1.showMessageDialog(null, +(value+1));
iv)
String sub=123;
JOptionPane.showMessageDialog(null, +sub.length()
+Integer.parseInt(sub));
12)

Define the use of Result set Class. Also write any two methods of it.
2
13)
Name & define in brief any two native class of Java. Also write one
method of each class.
2
14)
Write the HTML code to create the following list:
2
1. Metro Cities
Delhi
1

Mumbai
Chennai
Kolkata
2. Other Big Cities
Lucknow
Patna
Pune
Banglore
PTO

15)

Rewrite the following program using for loop


2
int i=2,sum=0;
while(i<=10)
{
Sum+=i;
i+=2;}

16)
The following codes have some errors. Rewrite the corrected codes
underlining the correction made.2
int i,j=5;
i==j+5;
if(i=j)
{
Txt.getText(I and J are equal); }
17)
Name class containing following methods:
2
i)
Pow()
iv)
Concat()
ii)
getConnetion()
v)
CreateStatement()
iii)
parseInt()
vi)
showMessageDialog()
18)
19)
20)

Define polymorphism explain with suitable example.


2
Differentiate between Abstract Class & Interface.
2
Write the following code using switch statement:
2
if(ch==e)

Lbl.setText(east);
else if(ch==w)
Lbl.setText(west);
else if(ch==n)
Lbl.setText(north);
else if(ch==s)
Lbl.setText(south);
else
Lbl.setText(unknown);
21)
I)
Write a program to print the name of the Class Teacher using Option
Pane according to the class selected based on the following information:
3
2

Class
Name
XII A
XII B
XII C
XII D

Class Teacher
Mrs Sushma
Sharma
Mrs Kalpana
Kumari
Mr Jatin Kumar
Mr Harsh Bhatia

The Names of Classes are taken using JCombo.


ii)
Also write the code to close the application
1
22)
Write a program to print a series of even nos or odd nos from 1 to 50 as
per the choice selected by user using radio button.
3

Das könnte Ihnen auch gefallen