Académique Documents
Professionnel Documents
Culture Documents
(e) What do you mean by the term open source software? (1 Mark)
(Ans) Open source software is the software which can beused, studied, modified and redistributed and
whosesource code is available. It may or may not bechargeable.
(c) Discuss constructor and its different types that is supported by java.
(2 Marks)
(Ans)
Constructor is a special member function used to create and initialize new objects. Its name is same as the class name.
(d) What is the difference between call by value and call by reference? (2 Marks)
(Ans) Pass By Value
Copies the values of actual parameters into formalparameters
Method creates its own copy of argument values
Primitive datatypes are passed through call by value
Thus, in call by value method, changes are not reflected back to the original values. The original copy of the argument value remains
intact.
Pass by Reference
In place of passing a value to the method being called, a reference to the original variable is passed
reference stores a memory location of avariable
It does not create its own copy of originalvalues; rather, it refers to the originalvalues only by different names.
Thus, in call by reference method, the changes are reflected back to the original values.
(b) What is the difference between truncate and round function? (2 Marks)
(Ans) ROUND: This function returns a number rounded off as per given specifications.
SYNTAX - ROUND(n[, m])
• It returns value of argument n rounded to m places right of the decimal point.
TRUNCATE: This function returns a number with some digits truncated.
SYNTAX - TRUNCATE(n, m)
• It returns value of argument n truncated to argument m decimal places.
• If argument m is given as 0 places, m can be negative to truncate (i.e., make zero) m digits left of the
decimal point.
(c) What is the difference between UNIQUE and PRIMARY key constraint?
(2 Marks)
(Ans)
There are differences between UNIQUE and PRIMARY KEY constraints.
• Though both ensure unique values for each row in a column, but UNIQUE allows NULL values whereas PRIMARY KEY does not.
• There can be multiple columns with UNIQUE constraints in a table, but there can exist only one column or one combination with
PRIMARY KEY constraint.
Never-Started state means if a transaction fails during execution, then all its modifications must be undone to
remove the effect of failed transaction.
4. Read the following case study and answer the questions that follow.
TeachWell Public School wants to computerize the employee salary section.
The School is having two categories of employees : Teaching and Non Teaching. The Teaching employees are
further categorized into PGTs, TGTs and PRTs having different Basic salary.
The School gives addition pay of 3000 for employees who are working for more than 10 years.
PGT 14500 30 30 12
TGT 12500 21 30 12
PRT 11500 20 25 12
(a)Write the code to calculate the Basic salary, deductions, gross salary and net salary based on the
given specification. (4 marks)
Add 3000 to net salary if employee is working for more than 10 years.
}
gross=bs+da+hra;
else if (rdpgt.isSelected()==true)
net = gross – ded;
{
bs=14500;
if(chk10.isSelected()==true)
da=(30*bs)/100;
{
hra=(30*bs)/100;
net=net+3000;
ded=(12*bs)/100;
}
}
else if (rdtgt.isSelected()==true)
tfded.setText(“ ”+ded);
{
tfgross.setText(“ ”+gross);
bs=12500;
tfnet.setText(“ ”+net);
da=(21*bs)/100;
tfbs.setText(“ ”+bs);
hra=(30*bs)/100;
ded=(12*bs)/100;
(b) Write the code to clear all textfields, uncheck checkbox and set non teaching as the default category
(2 marks)
(Ans) tfbas.setText(null);
rdnon.setSelected(true);
(c)Write the code to exit the application. Also display a message “Thank you” before exiting the application
(1 marks)
(Ans) System.exit(0);
(d)Write the code to disable textfields for gross salary, deductions and netsalary. (2 marks)
(Ans) tfgross.setEditable(false);
tfded.setEditable(false);
tfnet.setEditable(false);
j=j–2;
}
System.out.println(x);
(Ans) Output : 32
(f)
(2 marks)
Rewrite the corrected program after removing syntax errors, underline the corrections(Any four)
integer P=1 ; Corrected Code
P = P+1 for(c=1;c<=10;c=c+1)
If (P=5) {
P = 1; If(P==5)
(g)Write the following code segment using for… loop without effecting the output of the code: (2
marks)
{ Temp=Temp-1; {
} }
5.(a) Write SQL command to create table HOSPITAL with following specification:
Field Name Data Type Constraints
PNo Int (4) Primary key
Name Varchar (20)
Age Int (2)
Department Varchar (15)
AdmDate Date
Charges Double (7,2)
Sex Char (1)
(2 Marks)
(Ans)
The command used to create a table is:
CREATE TABLE HOSPITAL
(PNo Int (4) PRIMARY KEY,
Name Varchar (20),
Age Int (2),
Department Varchar (15),
AdmDate Date,
Charges Double (7,2),
Sex Char(1));
(b) Explain the use of ALTER Table statement?
(2 Marks)
(Ans)
ALTER Table statement can be used for:
1. Adding columns to a table: To add a column to a table
ALTER TABLE < table name >
ADD [COLUMN] < column name > < datatype> [ NOT NULL] [< integrity constraint def >];
2. Modifying columns: Properties of columns can be changed or modified
ALTER TABLE < table name >
MODIFY [COLUMN]< column name > < column def >
3. Deleting columns: To delete a column from the table
ALTER TABLE < table name >
DROP [COLUMN]< old column name >
4. Adding or Removing constraints: We can use ALTER TABLE statement to add or remove
constraints to the existing table:
ALTER TABLE < table name >
ADD < constraint-def >
and
ALTER TABLE < table name >
DROP PRIMARY KEY;
Or DROP FOREIGN KEY < constraint name >
CREATE TABLE EMP( EMPNO INT(10) PRIMARY KEY, ENAME VARCHAR(30) NOT NULL, GENDER CHAR(1) DEFAULT ‘M’, DEPTNO
INT(6) REFERENCES DEPT(DEPTNO), SALARY INT CHECK(SALARY>2000));
Identify the number and types of constraints in the table EMPLOYEE. (2 marks)
(Ans) 05 type Constraints in the table EMPLOYEE i.e. PRIMARY KEY, NOT NULL, DEFAULT, REFERECES and CHECK constraint .
(b) Write the MySQL command to ADD new column JOB VARCHAR(20) NOT NULL. (2 marks)
(Ans) i)
SUBSTR(ENAME,1,5) COMM
RAJIN 120
SUMIT 200
ANIL 00
ii)
INSTR(ENAME, ‘I’), GENDER
4 M
4 F
8 F
3 M
iii)
TRUNCATE(SALARY,-2) ROUND(SALARY,-2)
3400 3500
2400 2500
3000 3100
4500 4500
iv)
EMPNO ENAME SALARY COMMISSION
(2 Marks)
(Ans)
The objectives of E-Governance are:
1. Transparency in the working of the Government.
2. To ensure greater efficiency, objectivity, accountability and speed in providing services
and information to the public.
3. To provide cost effective service and quality of the same.
4. To provide single window for all Govt. Services at District Level.
5. Responsive Administration.
6. To provide a friendly, speedier and efficient interface.To eliminate the middlemen.
(b) Explain the concept of front-end. (1 Marks)
(Ans)
The front-end interfaces allow users to issue commands to the system and view the result. It also contains database
objects that form a layer between the user interface and the back-end. It should always keep users informed about
what is going on, through appropriate feedback within reasonable time. It should speak the users’ language, with
words, phrases and concepts familiar to the users, rather than system oriented terms.
(c) anshul works for a Hotel. She wants to create controls on a form for the following fuctions. Choose
appropriate controls from Text Fields, Labels, Radio Buttons, Check box, Combo Box, Button and Write in the third
column. (2 marks)
4 To book room
(Ans)
S. No. Controls used to: Control