CBSE Class 12 Informatics Practices Question Paper 2019 With Solutions
CBSE Class 12 Informatics Practices Question Paper 2019 With Solutions
Informatics Practices
Previous Year Question Paper 2019
Series: BVM Code no. 90
INFORMATICS PRACTICES
2.(a) Write the data type of variables that should be used to store the
following in Java: 1 Mark
(i) Sales amount (of Sales) achieved by a Sales Person
(ii) Roll Number of Student
Ans: (i) int/float/double
(ii) int/long
(b) Distinguish between isSelected() and setSelected() methods of Java with
the help of example. 1 Mark
Ans: isSelected() returns a bool value to tell if the radio button is selected or not
while setSelected() is used to check the radio button or uncheck it.
Example: rbutton.setSelected(true); //rbutton is selected
boolean b = rbutton.isSelected(); //will tell if rbutton is selected
(c) What will be displayed in jTextField1 and jTextField2 when the following
code is executed? 2 Marks
int x,y,z,t;
x = 3;
y = 8;
z = x+y/8;
t = z++;
jTextField1.setText(""+z);
jTextField2.setText(""+t);
10 Leena 1 20
10 Leena 2 25
11 Samarth 1 30
11 Samarth 2 35
12 Jai 1 14
12 Jai 2 15
14 Shoaib 1 30
14 Shoaib 2 12
Abhay wants to know the number of students who took the test. He writes
the following SQL statement to count STUDENTID without duplicates.
However the statement is not correct. Rewrite the correct statement.
2 Marks
SELECT DISTINCT(COUNT STUDENTID) FROM RESULTS;
Ans: SELECT COUNT(DISTINCT STUDENTID) FROM RESULTS;
(d) Aman has used the following SQL command to create a table ‘stu’ :
CREATE TABLE stu
(
id INTEGER,
name VARCHAR(100)
);
Name Count(*)
abc 2
bcd 1
(e) Write SQL statement to add a column ‘‘COUNTRY’’ with data type and
size as VARCHAR(70) to the existing table named ‘‘PLAYER’’. Is it a DDL
or DML or TCL command? 2 Marks
Ans: ALTER TABLE PLAYER ADD COLUMN COUNTRY VARCHAR(70);
It is a Data Definition Language (DDL) command.
(f) Table Student has the columns RNO and SCORE. It has 3 rows in it.
Following two SQL statements were entered that produced the output
(AVG(SCORE) as 45 and COUNT(SCORE) as 2) : 2 Marks
(i) AVG(SCORE)
(ii) COUNT(SCORE)
Data in SCORE column is same in two rows. What data is present in the
SCORE column in the three rows ?
Ans: SCORE
4.(a) What will displayed in jTextField1 when the following code is executed?
1 Mark
int x=3, y=6, z=0;
if(x>3)
z = z + 1;
if((x<4)&&(y>6))
z = z + 2;
if(x>2 && y>=6)
z = z + 3;
if((x<3) || (y>6))
z = z + 4;
jTextField1.setText(""+z);
Ans: jTextField1 = 3
(b) Rewrite the following code after correcting errors. Underline the
corrections made. 2 Marks
int a, c;
30 = c;
4 = a;
while do (c>10)
{
a = = a + c;
A ₹ 2.00
B ₹ 3.00
C ₹ 5.00
5. Consider the following table ‘Transporter’ that stores the order details
about items to be transported. Write SQL commands for the statements (i)
to (viii) and write output for SQL queries (ix) and (x).
Table: TRANSPORTER
6.(a) Mr. Sen has to create a table named ‘Employee’ with Columns to store
EmpID, Name, Designation, Age and Salary. EmpID is the Primary key and
Name cannot be NULL.
Some of the rows that will be inserted are shown below.
101 Smita Kumar Secretary 28 39500.00
102 Mani Scott Programmer 32 45300.00
Table: ACTIVITY
When the table ‘‘PARTICIPANT’’ was first created, the column ‘NAME’
was planned as the Primary key by the Programmer. Later a field ADMNO
had to be set up as Primary key. Explain the reason. 2 Marks
Ans: Programmer had to change the primary key from Name to Admno because
two participants can have same names (such as Kapil Shah) but both participants
will not have same Admno.
Or
Identify data type and size to be used for column ACTIVITYCODE in table
ACTIVITY. 2 Marks
Ans: Char is the data type for column ACTIVITYCODE and 4 is the size.
(c) With reference to the above given tables (in Q6 b), write commands in
SQL for (i) to (iii).
(i) To display Activity Code along with number of participants participating
in each activity (Activity Code wise) from the table Participant. 2 Marks
S.No Function
3 Let the user choose one TSHIRT size out of the categories :
XL / L / M / S
4 Let the user select Activities out of Rock Climbing/ Mountain
Biking/Zip Lining/Night Hike. More than one activity may be chosen.
Ans: TextBox for Name of the student and Mobile number, RadioButton for
selecting Tshirt size and CheckBox/ListBox for selecting Activities.