# CBSE Sample Papers for Class 12 Informatics Practices Paper 1

CBSE Sample Papers for Class 12 Informatics Practices Paper 1 are part of CBSE Sample Papers for Class 12 Informatics Practices. Here we have given CBSE Sample Papers for Class 12 Informatics Practices Paper 1.

## CBSE Sample Papers for Class 12 Informatics Practices Paper 1

 Board CBSE Class XII Subject Informatics Practices Sample Paper Set Paper 1 Category CBSE Sample Papers

Students who are going to appear for CBSE Class 12 Examinations are advised to practice the CBSE sample papers given here which is designed as per the latest Syllabus and marking scheme, as prescribed by the CBSE, is given here. Paper 1 of Solved CBSE Sample Paper for Class 12 Informatics Practices is given below with free PDF download solutions.

Time Allowed: 3 hours
Maximum Marks: 70

General Instructions

• All questions are compulsory.

Question 1.
(a) The network administrator of ABC Inc. wants to prevent traffic overload within the network of the company. For this purpose, he needs to divide the company network into the subnetworks (LAN segments). Suggest him a
(b) Explain the purpose of domain name system.
(d) When would you prefer hubs over repeaters?
(e) Explain the packet switching technique.
(f) Write any four criteria for distribution of OSS.
(g) What is the significance of anonymous user in FTP?

Question 2.
(a) While working in Netbeans, Ms. Riya has designed a login page, where she wants to display table. Help her in choosing more appropriate control out of ‘JTextField’ and ‘JTextArea’. Give a reason for your choice.
(b) In the code fragment given below, what output display when a user is equal 30?

if(user<=18)
{
System.out.println("User is younger"):
}
else if(user>18 && user<40)
{
System.out.println("User is between 19 and 39");
}
else
{
System.out.println("User is older than 40");
}

(c) Predict the output of the following HTML code :

<HTML>
<TABLE border = ”4">
<TR align = "right” valign="middle">
<TH colspan="2">Production</TH>
<TH rowspan="3">Sales</TH>
</TR>
<TR>
<TD>Naveen</TD>
<TD>458</TD>
</TR>
<TR>
<TD>Neelam</TD>
<TD>896</TD>
</TR>
</TABLE>
</HTML>

(d) Differentiate between the following code fragments and also give their output:

(i)
int f = l,i = 2;
while(++i< 5)
f *= 1;
System.out.print!n(f);

(ii) int f = l,i = 2;
do
{
f *= i;
}whi!e(++i< 5);
System.out.println(f);

(e) (i) Write a function in Java that takes two numbers as parameters. It then returns that number whose square is greater than the square of other numbers.
(ii) Rewrite the following switch code using if else statement.

switch(roll)
{
case 1:
Section='A';
break; case 2:
Section='B';
break; default:
Section='C';
}

Question 3.
(a) Identify the output of the following query:
mysql> SELECT MID(‘FINANCE’, 3, 2);
(b) Mr. Shivam created two tables with ID as primary key in Table 1 and foreign key in Table2. While inserting a row in Table2, he is not able to enter a value in the column ID. What could be the possible reason for it?
(c) Consider the table ‘LAB’.

Write SQL statement to obtain the following output:

(d)
(i) You need to add a NOT NULL constraint to the E-MAIL column in the table EMPLOYEES. Which clause should you use? Give an example.
(ii) You need to remove the column named EMP_FK_DEPT that is FOREIGN KEY constraint from the table EMPLOYEES in your schema. What statement should you use?
(e) Define the following:
(i) Domain
(ii) Relation
(iii) Tuples
(iv) Attribute

Question 4.
(a) What is following code doing?

String db = JOptionPane. showInputDialog("Enter name of your MySQL database . . . ");
String DB_URL=" jdbc:mysql://local host/"+ db;
Class. forName ("com.mysql. jdbc. Driver");
Connection con = DriverManager.getConnection(DBJJRL, "root"," " );

(b) Swagatika is a programmer at xyz enterprises. She created the following GUI:

Help her to write code in Java for the following:
(i) The percentage marks are to be entered in the text field (marksTF) and upon clicking the button (calcBTN) corresponding grade (as per following rules) should be displayed in the Table (resultLbl) below command button:
> = 90                        A + +
80 – 90                        A +
75 – 80                        A
60 – 75                        B
50 – 60                        C
40 – 50                        D
< 40                            Fail

(ii) Write the code for FocusLost event of text field (marksTF) to ensure that the user does not enter a negative or zero value. If a negative or a zero value is entered, then the text field should be made blank and a warning message should be displayed.
(iii) If you are asked to add a clear button to the application, which code would you write for it so that the text field marksTF and label resultLbl get cleared when it is clicked?

(c)
(i) What will be display in jTextArea 1 after the execution of the following code?

int a=4;
do
{
jTextAreal. setTextlInteger. toString(++a));
a=a+l;
}whi1e(a<=8);

(ii) Find output of the following Java code snippet:

String b="Monkey";
String c="No jump";
String d=b+c;
System.out.println(d);
d=b.concat(c);
System.out.println(d);

(d) A class Person with the data members name and id. Another class Employee with the data member salary. Write definitions for classes Person and Employee for the following situations:
(i) Objects of both class are able to access all the data members of both the classes individually.
(ii) Only the members of class Employee can access all the data members of both the class.

Question 5.
(a) Write MySQL command to open an existing database.
(b) Ms. Meera wants to remove the entire content of a table “EMPLOYEE” alongwith its structure to release the storage space. Which MySQL statement should she use?
(c) Wiite the output of the following SQL queries:

(i) SELECT RIGHT ('COMPUTER' , 2);
(ii) SELECT INSTR ('Family’, 'mi');
(iii) SELECT DAY0FM0NTH('2016 - 05 - 25');
(iv) SELECT ROUND(76, 987, 2);

(d) Ihble “EMP” is shown below. Wiite commands in SQL for (i) and (ii) and output of query for (iii) and (iv).

(i) lb display list of all employees below 25 years old.
(ii) lb count the numbers of employees with names starting with ‘P’.

(iii) SELECT Name. Age FROM EMP WHERE Sex ='F';
(iv) SELECT Name, Contact FROM EMP WHERE Contact LIKE ’99%’;

Question 6.
(a)
(i) Write MySQL command to create the table PRODUCT including its constraints.

(ii) In a database ’BigBajar’ there are two tables with a sample data given below:

I. Identity the foreign key in the table Product.
II. P_Id column in the PRODUCT table is the …………… key.
Cust ld column in the CUSTOMER table is the ……………. key.
(b) With reference to the above-given tables (in Q6 (a) (ii)), write SQL commands for (i) and (ii) and output for(iii).
(i) To display Cust_Id, C_Name, P_Name, Price where price is greater than 50000.
(ii) To add a column P_Type with datatype VARCHAR and size 20 in the table PRODUCT.

(iii) SELECT P.P_Name, C.C_Name FROM PRODUCT P, CUSTOMER C WHERE P.Cust_Id=C.Cust_Id;

Question 7.
(a) What do you think about the most outstanding feature of E-Leaming?
(b) Which all features would you suggest for an effective front-end?
(c) Madhvi works for a shipping mart. She wants to create controls on a form for the following operations. Choose most appropriate controls out of TextBox, Label, RadioButton, ListBox, ComboBox, CheckBox and CommandButton.

(a) A switch would serve the required purpose. Along with that, a switch is also responsible for filtering, i.e. transforming data in a specific way and for forwarding packets between LAN segments.
(b) Domain Name System (DNS) is a network service that translates domain name to the associated IP address.
(c) An advantage of star topology In star topology, the central node is connected directly to every other node in the network means that faults are easily detected and isolated.
A disadvantage of star topology If the central node in the star network fails, the entire network goes down.
(d) Hubs should be preferred over repeaters when more than two computers are to be connected in a network while repeaters are only used for signal modification.
(e) In packet switched networks, the message gets broken into small data packets. These packets are sent out from the computer and they travel around the network seeking out the
most efficient route to travel as circuits become available.
(f) Four criteria for distribution of OSS are as follows:
(i) No discrimination against person on groups.
(ii) No discrimination against fields of endeavor.
(iii) License must not be specific to a product.
(iv) License must not restricted other software.
(g) In order to use FTP effectively, one need to be an authorised user. However, anonymous FTP (i.e. logging in as an anonymous user) is a method whereby FTP server allows the general public to access files on an FTP server. Uploading of files refer to the transfer of files from one’s computer onto FTP server. An anonymous user generally is not allowed to upload files.

(a) ‘JTextArea’ is best option to display the multiple rows table because JTextField accepts only single line of text whereas JTextArea accepts multiple line of text.
(b) Output
User is between 19 and 39
(c) Output

(d) The difference in the given code fragments is code
(ii) executes one time more than code
(i) because code
(ii) is implemented using do-while loop, do-while loop executes at least once even if the while condition is false, whereas, in while loop, it first checks the condition and then enter the loops, if the condition is true.
Output of code
(i) 12 (ii)2 4
(e)

(i) private int compareSqr (int a, int b)
{
if( (a*a) > (b*b))
return a;
else
return b;
}

(ii) if (ro11 == 1)
Section='A’;
else if(roll == 2)
Section=’B’;
else
Section='C';

(a)

(b) Mr. Shivam must be trying to enter a value of ID in Table2, which is not present in the ID column of Tablel.

(c) SELECT Project_Code FROM LAB WHERE Name = 'Arun';

(d)
(i) MODIFY, clause of ALTER TABLE statement should be used to add NOT NULL constraint to column E-MAIL in the table EMPLOYEES as given below:

ALTER TABLE EMPLOYEES MODIFY E-MAIL VARCHAR(IO) NOT NULL;
(ii) ALTER TABLE EMPLOYEES DROP FOREIGN KEY EMP_FK_DEPT;

(e)
(i) Domain A domain is a collection of all possible values from which the values for a given column or an attribute is drawn. A domain is said to be atomic if elements are considered to be individual units.
(ii) Relation A relation is a table with columns and rows which represent the data items and relationships among them. Relations have three important properties a name, cardinality and a degree.
(iii) Tuples The rows in a relation are also known as tuples. Each row or tuple has a set of permitted values for each attribute.
(iv) Attribute The heading columns of a table are known as attributes. Each attribute of a table has a distinct name.

(a) This code is creating a connection object namely con for MySQL database, whose name is obtained from the user using an InputDialog. UserlD of the database is root,
(b)

(i) private void calcBTNActionPerformedtjava.awt.event.ActionEvent evt)
{
float num = FI oat. parseFloat (marksTF. getText());
String S = "You get":
if(num >= 90)
S += "A++";
else if(num >= 80)
S += "A+";
else if(num >= 75)
S += "A";
else if(num >= 60)
S += "B";
else if(num >= 50)
S += "C";
el se if(num >= 40)
S += "D";
else
S = "Fail";
resultLbl. setText (S);
}
(ii) private void marksTFFocusLost(java.awt.event.FocusEvent evt)
{
int marks = Integer.parseInt(marksTF. getText());
if(marks <= 0)
{
marksTF.setText(" ");
JOptionPane.showMessageDialog(nul1,"Marks
cannot be negative or zero");
}
}
(iii) marksTF. setText(" ");
resultLbl.setText(" ");

(c)
(i) jTextarea will display
5
7
9
(ii) MonkeyNo jump
MonkeyNo jump
(d)

(i) class Person
{
public:
String name;
public:
int id;
}
class Employee
{
public:
int salary;
}
(ii) class Person
{
protected:
String name ;
}
class Employee extends Person
{
private:
int salary:
}

(a) USE <database name>;
(b) DROP TABLE EMPLOYEE;
(c)

(d)
(i) SELECT * FROM EMP WHERE AGE<25';
(ii) SELECT COUNT(*) FROM EMP WHERE NAME LIKE 'P%';


(a)

(i) CREATE TABLE PRODUCT
{
P_Id DECIMAK (4) PRIMARY KEY,
P_Name VARCHAR(20),
P_Company VARCHAR(20),
Price DEC IMAL(8) NOT NULL
};
(ii) I. Foreign key: Custjd
II. Primary, Primary

(b)

(i) SELECT Cust_Id, C_Name, P_Name, Price FROM PRODUCT P, CUSTOMER C
WHERE P.Cust_Id=C.Cust_Id AND Price>50000;
(ii) ALTER TABLE PRODUCT ADD P_Type VARCHARC20);