Q No -3 (1 + 2 + 2 +2 + 2 + 1 = 10 Marks)
a. Surendra wants to implement referential
integrity in the tables being created. Which constraint should be used by Surendra while doing so?
b. Meena uses an EMP table with following
columns:
NAME, SAL, ID, DNAME
She needs to display names of employees
who have not been assigned any department or have been assigned “Pathology”
department. Pathology dept’s names end with “Pathology”. She wrote the
following query:
SELECT
NAME, SAL FROM EMP
WHERE DNAME = NULL AND DNAME = “%Pathology”;
c.
What are three transaction control statements n MySQL? Give example.
d. What do you mean by constraints? Explain ENUM and SET constraints.
e. What do you mean by UNION? Also write the syntax of UNION.
f. Which command is used in MySQL to make the changes in database
permanent?
Q No - 4 (2 + 2 + 1 + 1 + 2 + 2 + 1 + 3 + 1 = 15 Marks)
a. Rewrite the correct code
underlining all the corrections made:
int i; j=5;
i== j+5;
if(i=j)
{ jTextField1.setText(“i and j are unequal”);
jTextField2.setText(“they are not equal”); break;
}
else
jTextField1.setText(“i
and j are equal”)
b. Rewrite the following program code
using for loop:
int num=6;
int temp=num;
while(num>=1)
{ temp=temp-1;
if (temp%2==0)
System.out.println(“Is even”);
else
System.out.println(“Is odd”);
num=num-2;
}
c.
Write the output of the program:
int
x = 10;
int
y = 15;
jTextField1.setText(“”+(x>y)?
3.14: 3);
d. What will be the contents of jTextField
after executing the following statement?
jTextField.setText
( ‘B’ + ‘a’ );
e.
What will be the output of the program
given below. Which number is printed twice? (Show the working also)
int
sum1=3;
sum1++;
jTextField1.setText(“”+sum);
++sum1;
jTextField2.setText(“”+sum1);
jTextField3.setText(“”+(++sum1));
jTextField4.setText(“”+sum1++);
1jTextField5.setText(“”+sum1);
f.
What will be the value of M and N after execution of the following code:
int M=150,N;
for(N=10;N<=12;N++)
M+=N;
JOptionPane.showMessageDialog(this,”M
: ” + M +”N: “+ N+””);
g. Mr. R C Joshi is working with
railways and he has to design an application
which can calculate the total fare. The following is the Fare Calculator along with details:
(Use only defaults name for the controls i.e. Swing Components)
a.
Write the code for exit button so that when a user clicks on
exit button Application will be closed. Also display a message “Thank you for
your nice visit” before exiting the application.
b.
Write a code to calculate the total fare according to the
given conditions:
i)
The type of coach is selected by the user from the jList1 and the charges are for 1 tier
coach Rs. 2000 per person , 2 tier coach Rs 1500 per person and for 3 tier coach 1000 per person.
ii)
If the person is travelling in AC coach then increase the
fare by 20%.
iii)
If the person is senior citizen the fare will be 50%.
iv)
The total fare will be number of passenger travelling
multiply by fare calculated per seat.
c.
Write the property which is perquisite for radio button.
