Thursday, 25 February 2016

11th &12th IP 2011 (Outside Delhi) Common Assignments


Q.No.
Question Description (Java-I Q.No. 2 & 4)
Marks
 ( 2011-OD)-2
While working in Netbeans, Ms. Khorana wants to display ‘Pass’ or ‘Needs to Reappear’ message depending the marks entered in jTextField.  Help her to choose more appropriate statement out of ‘if statement’ and ‘Switch statement’.

Ans: if statement
1
2
How one can make a Text Field un-editable on a Frame ?

Ans: <jTextField>.setEditable(false);
1

3
What will be the value of P and Q after execution of the following code:
int P,Q=100;
for(P=10; P<=12;P++)
{
    Q+=P;
}
jOptionPane.showMessageDialog(this, “P:”+ P + “Q: “ + Q + “ “);

Ans: P:13 Q:133
2
4
Write java code that takes the cost of a pencil from jTextField1 and number of pencil from JTextField2 and Calculate total amount as cost*number to be displayed in jTextField3 and 20% service tax out of total amount in jTextField4.

Ans:
double cost = Double.parseDouble(jTextField1.getText());
int n = Integer.parseInt(jTextField2.getText());
double amount = cost * n;
jTextField3.setText(Double.toString(amount));
jTextFiled4.setText(Double.toString(amount*0.20);
2




 11th & 12th IP 2011(Outside Delhi) common assignmet
5-(c)
Consider the table Exam given below .write commond in mysql for (i) to (iv) and output for (v) to (vii).

no
Name
stipend
subject
average
Division
1
karan
400
english
68
FIRST
2
aman
680
maths
72
FIRST
3
javed
500
accounts
67
FIRST
4
bishakh
200
informatic
55
SECOUND
5
sugandha
400
history
35
THIRD
6
suparana
550
geography
45
THIRD

i)  TO LIST  THE NAME OF THOSE STUDENT WHO HAVE OBTAINED  DIVISION AS FIRST IN THE ASCENDING ORDER OF NAME

ii) TO DISPLAY A REPORT LISTING NAME,SUB & ANNUAL STIPEND RECEIVED ASSUMING the stipend column has monthly stipend.


iii) To count the number of student , who have either accounts or informatics as subject

iv)  to insert a new row in the table EXAM.
7,”MOHAN”, 500,”ENGLISH”, 73,”S.


Ans         i

              Ii

             Iii

             iv



Select name from exam where division =’FIRST’  ORDER BY  name ;

Select name,  subject,stipend *12 from exam;

Select count  (*)  from exam where subject in (‘account’,’informatics’);

Insert into exam values (7,”mohan “,500,”english”,73,”seccound”);



No comments:

Post a Comment