Вы находитесь на странице: 1из 8

Kendriya vidyalaya Sangathan

Sample Paper for class XII with Answers


Sub:- Informatics Practices Total Marks :70 Time 3h
1. (a.) Why do we use repeater?
(1 Mark)
(Ans) A repeater is used to regenerate data and voice signals.

(b) What is an IP address? (2 Marks)


(Ans) An IP address (Internet Protocol Address) is a logical address of a network address. It is unique and
identifies computers on a network.

(c.) Differentiate between gateway and router.


(3 Marks)
(Ans) Gateway: A gateway is a network device which allows different electronic networks to talk to Internet that uses TCP/IP.
Router: A router is a device in computer networking that forwards data packets to their destinations, based on
their address.

(d) What is Mozilla software used for? (1 Mark)


(Ans) Mozilla is a free, cross-platform, Internet softwaresuite that includes a web browser, an email client,
anhtml editor and an IRC client.

(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.

(f) What do you mean by the term Ogg Vorbis? (2 Marks)


(Ans) Ogg Vorbis is an audio compression format which iscompletely open, patent free, professional
audioencoding and streaming technology with all thebenefits of Open Source.

2. (a) Write the use of Password fields. (2 Marks)


(Ans) The JPassword class, a subclass of JTextField, provides specialised text fields for password entry. For
security reasons, a password field does not show the characters that the user types. Instead, the field displays
a character different from the one typed, such as an asterisk '*'. As another security precaution, a password
field stores its value as an array of characters, rather than as a string. Like an ordinary textfield, a password
field fires an action event when the user indicates that the text entry is complete.

(b) What is Method Prototype? (1 Mark)


(Ans) Method Prototype tells the compiler about the type of the value returned by the method, the number and type of arguments.
For Example

int absval(int a);

(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.

Student obj = new Student();

The constructor methods can be of two types:


• Parameterized constructor
• Non-Parameterized Constructor

(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.

(e) What is “this” keyword? Discuss its significance? (2 Marks)


(Ans) The “this” keyword is used in java to refer to currently calling object in a program. It returns the reference to the current object.
Some of the significance of "this" keyword are -
Automatically created and initialized by java.
When a member method is called, it automatically passed an implicit (in-built) argument.
Useful in returning the address of current object.

(f) Brief the concept of overriding. (1 Mark)


(Ans) The overriding method has the same name, number and type of parameters and return type as the
method it overrides. An overriding method can also return a subtype of the type returned by the overridden
method.

3.(a) What is referential integrity? What are the conditions to set


referential integrity? (2 Marks)
(Ans) Referential integrity is a system of rules that a DBMS uses to ensure that relationships between records in related table are valid
and that users don’t accidentally delete or change related data.
Conditions to set Referential Integrity:
•The matching field from the primary table is a primary key or has a unique index.
•The related fields have same data type.
•Both tables belong to same database.

(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.

(d) What is COMMIT and ROLLBACK statement in SQL. (2 Marks)


(Ans) Commit statement helps in termination of the current transaction and does all the changes that occur in
transaction persistent and this also commits all the changes to the database.
ROLLBACK do the same thing, i.e., it terminates the current transaction but one another thing is that the
changes made to database are ROLLBACK to the database.

(e) Explain atomicity property of transaction? (2 Marks)


(Ans) Atomicity property ensures that either all operations of the transaction are reflected or none are. This
property has two states: Done or Never-Started.
Done state means a transaction must complete successfully and its effect should be visible in the database.

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.

Employee Type Basic Salary DA (% of Basic HRA (% of Basic Deductions


Sal) Sal)
(% of Basic sal)

Non Teaching 12500 31 30 12

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 salary=Basic salary + DA + HRA

Net salary = Gross salary – deductions


(Ans)
double else if (rdprt.isSelected()==true)
bs=0,da=0,net=0,ded=0,gross=0,hra=0;
{
if (rdnon.isSelected()==true)
bs=11500;
{
da=(20*bs)/100;
bs=12500;
hra=(25*bs)/100;
da=(31*bs)/100;
ded=(12*bs)/100;
hra=(30*bs)/100;
}
ded=(12*bs)/100;

}
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);

(e) Write the output of the following code (2 marks)


int j = 10,x=0,i=0;
for (i = 1;i<=4;i++)
{
if(i%2==0)
x = x+ (i * j);

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

integer C=1 ; int P=1;

FOR C=1 TO 10 int C=1;

P = P+1 for(c=1;c<=10;c=c+1)

If (P=5) {

P = 1; If(P==5)

DISPLAY “P is equal to 5”; P=1;

ELSE System.out.println(“P is equal to 5”);

DISPLAY “P is not equal to 5”; else

C equal C PLUS 1; System.out.println(“P is equal to 5”);

(g)Write the following code segment using for… loop without effecting the output of the code: (2
marks)

int Num=6; int Num=6;

int Temp=Num; int Temp =Num;

while (Num>=1) for(Num=6;Num>=1;Num=Num-2);

{ Temp=Temp-1; {

if (Temp% 2== 0) Temp=Temp -1 ;

System.out.println(" is Even"); if(Temp%2==0)

else System.out.println(" is Even");

System.out.println(" is Odd"); else

Num=Num-2; System.out.println(" is Odd");

} }

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 >

(c) What does NOT NULL constraint ensures? (1 Mark)


(Ans) NOT NULL constraint on a column ensures that the column does not store NULL value
ever.

6. Answer the following questions ::Table: Employee


EMPNO ENAME GENDER DEPTNO COMM SALARY

101 RAJINDRA M 10 120 3488.90

102 SUMITRA F 10 200 2490.32

103 PANJWANI F 20 3053.15

104 ANIL KUMAR M 30 00 4501.89

(a) Give a statement as follows:

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) ALTER TABLE Employee ADD JOB VARCHAR(20) NOT NULL;


(c) Write the MySQL command to remove a GENDER column from Employee table (2 marks)

(Ans) ALTER TABLE Employee DROP (GENDER);

(d) Find the output of the following commands:- (4 marks)

i. SELECT SUBSTR(ENAME,1,5), COMM FROM EMPLOYEE WHERE COMM IS NOT NULL;


ii. SELECT INSTR(ENAME, ‘I’), GENDER FROM EMPLOYEE;
iii. SELECT TRUNCATE(SALARY,-2) , ROUND(SALARY,-2) FROM EMPLOYEE;
iv. SELECT EMPNO, ENAME, SALARY, IFNULL(COMM , ‘Zero’ ) “ COMMISSION” FROM EMPLOYEE WHERE ENAME LIKE ‘---J%’;

(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

101 RAJINDRA 3488.90 120

102 SUMITRA 2490.32 200

(e) Differentiate between Char and Varchar datatypes. (2


marks)
(Ans)
Char Varchar
Fixed Length string Variable length string
Spaces are added if data is less No spaces are added
than specified size.
(f) How do we restrict duplicate rows in SQL SELECT Query? Give example (1
marks)
(Ans) Using DISNTINCT keyword
Select Distinct job from empl.

(gWhat is SQL? What are the different categories of SQL commands?

(Ans) SQL- Structure query language .

Different categories are DDL, DML, TCL ect.


7.(a) Write the objectives of E-Governance.

(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)

S. No. Controls used to: Control

1 Select room type

2 Enter Customer’s name

3 Enter Arrival Date

4 To book room

(Ans)
S. No. Controls used to: Control

1 Select room type jRadioButton

2 Enter Customer’s name jTextField

3 Enter Arrival Date jTextField

4 To book room jButton

Вам также может понравиться