Students must start practicing the questions from CBSE Sample Papers for Class 12 Informatics Practices with Solutions Set 6 are designed as per the revised syllabus.

CBSE Sample Papers for Class 12 Informatics Practices Set 6 with Solutions

Time Allowed: 3 hours
Maximum Marks: 70

General Instructions :

  1. This question paper contains five sections, Sections A to E.
  2. All questions are compulsory.
  3. Section A has 18 questions carrying 01 mark each.
  4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
  5. Section C has 05 Short Answer type questions carrying 03 marks each.
  6. Section D has 03 Long Answer type questions carrying 05 marks each.
  7. Section E has 02 questions carrying 04 marks each. One internal choice is given in Q35 against part c only.
  8. All programming questions are to be answered using Python Language only.

Section – A

Multiple Choice Questions

Question 1.
Consider the following Series in Python:
data = pd.Series({5, 2, 3, 7], index = [‘a’, ‘b’, ‘c’,’d’])
Which Statement will display all odd values?
(A) print(data%2==0)
(B) print(data(data%2!=0))
(C) print(data mod 2!=0)
(D) print(data[data%2.=0]) [1]
Answer:
(D) print(data[data%2.=0])
Explanation: print(data) will print the complete series. print(data[data%2! = 0]) will print those elements from the series which are odd. [1]

CBSE Sample Papers for Class 12 Informatics Practices Set 6 with Solutions

Question 2.
Consider the following series:
ser=pd.Series([‘C’,’O’, ‘M’, F’,’O’,ʻR”, “T’, A’, ‘B’, ‘L’, ‘E’],
index= [1,2,3,4,5,6,7,8, 9, 10, 11])
print (ser[4: ))

(A)

4 F

5 O

6 R

7 T

8 A

9 B

10 L

11 E

ditype: object

(B)

4 F

5 O

6 R

7  T

8 A

ditype: object

(C)

4 F

5 O

6 R

7  T

8 A

9 B

ditype: object

(D)

5 O

6 R

7 T

8 A

9 B

10 L

11 E

ditype: object

[1]
Answer:
Option (D) is correct.
Explanation: Slicing takes index numbering from 4, not from the index 0. [1]

Question 3.
Abhay is a student of class XII’, and he is aware of some concepts of python. He has created the DataFrame, but he is getting errors after executing the code. Help him by identifying the correct statement that will create the
DataFrame:
import pandas as pd
stuname=[Muskan’, ‘Radhika’, ‘Gopar’, ‘pihu’]
term1= [70, 63, 74, 90]
term2=[67, 70, 86,95]
(A) df=pd.DataFrame({“Name”:stuname,”marks1″:term1,”marks2″:term2})
(B) df=pd.dataframe([stuname, terml,term2],columns=[‘stuName’,”marks1″,”marks2″])
(C) df=pd.DataFrame({stuname,terml,term2})
(D) df=pd.dataframe({stuname,terml.term2}) [1]
Answer:
(A) df=pd.DataFrame({“Name”:stuname,”marks1″:term1,”marks2″:term2})
Explanation: Dataframe can be created in multiple ways. We can use the lists, dictionary and from a list of dictionary, etc. [1]

Question 4.
What is the meaning of “HAVING” clause in Mysql?
(A) To filter out the row values
(B) To filter out the column values
(C) To filter out the row and column values
(D) None of the above [1]
Answer:
(A) To filter out the row values
Explanation: A HAVING clause in SQL specifies that an SQL SELECT statement must only return rows where aggregate values meet the specified conditions. After the aggregating operation, HAVING is applied, filtering out the rows that don’t match the specified conditions. [1]

Question 5.
“COUNT” keyword belongs to which categories in Mysql?
(A) Aggregate functions
(B) Operators
(C) Clauses
(D) All of the mentioned [1]
Answer:
(A) Aggregate functions
Explanation: COUNT(*) returns the number of rows in a specified table, and it preserves duplicate rows. It counts each row separately. This includes rows that contain null values. [1]

Question 6.
The string function that returns the index of the first occurrence of substring is
(A) INSERT ( )
(B) INSTR ( )
(C) INSTRING ( )
(D) INFSTR ( ) [1]
Answer:
(B) INSTR ( )
Explanation: The INSTR( ) function returns the position of the first occurrence of a string in another string. This function performs a case-insensitive search.
Syntax
INSTR(string1, string2) [1]

CBSE Sample Papers for Class 12 Informatics Practices Set 6 with Solutions

Question 7.
Which amongst the following is not an example of browser ?
(A) Chrome
(B) Firefox
(C) Avast
(D) Edge [1]
Answer:
(C) Avast
Explanation: Avast Antivirus is a family of crossplatform internet security applications developed by Avast for Microsoft Windows, macOS, Android and iOS. [1]

Question 8.
Which is called a smart HUB ?
(A) HUB with high speed ports
(B) Switch
(C) Router
(D) All of the Above [1]
Answer:
(B) Switch
Explanation: A switch is a device in a computer network that connects other devices together. Each device connected to a switch port can transfer data to any of the other ports at any time and the transmissions will not interfere. [1]

Question 9.
Which of the following action can be taken to keep the digital footprint clean?
(A) Search what information you leftover social media and the internet
(B) Be smart and sensible while using any website, sending an email or opening a link
(C) Control visibility settings from the browser or website/app settings
(D) Remove any private details like mobile number, school, college name, address, photos, etc. [1]
Answer:
(D) Remove any private details like mobile number, school, college name, address, photos, etc.
Explanation: The user’s should restrain from over sharing digital footprint and be more vigilant in its usage as there are possibility of risk of cyber bullying, identity theft, humiliation and embarrassment beside violation of privacy. [1]

Question 10.
Companies get their Trademark registered to protect?
(A) logos, names and brands
(B) word, phrase, or symbol
(C) slogans, stylized fonts, and colors.
(D) company furniture, worker, brands
Answer:
(B) word, phrase, or symbol
Explanation: A trademark can be any word, symbol or phrase that recognizes a particular company. [1]

Question 11.
______ is the practice of taking someone else’s work or ideas and passing them off as one’s own: [1]
(A) Plagiarism
(B) Copyright
(C) Patent
(D) All of the above
Answer:
(A) Plagiarism
Explanation: Plagiarism is the practice of taking someone else’s work or ideas and passing them off as one’s own. [1]

Question 12.
Saharsh is a student of class 9 and he is a very frequent user of internet applications. One day he got an unpleasant message on his instant messenger. What do you think he should do?
(A) Ignore it and start chatting to someone else.
(B) Reply back to them and find out what their problem is.
(C) Shut down the computer and hope they’ll leave him alone in future.
(D) Go to his parents, teacher, or other trusted adult and let them know that he feels uncomfortable
Answer:
(D) Go to his parents, teacher, or other trusted adult and let them know that he feels uncomfortable
Explanation: It is the case of cybercrime, So, Saharsh should share this act to his parent, teachers or police. [1]

Question 13.
Who is responsible for the disposal of the product when it becomes e-waste?
(A) The sellers
(B) The producers
(C) The customers
(D) The vendors [1]
Answer:
(B) The producers
Explanation: There are two components to every electronic device; hardware and software, but only one component becomes e-waste. It will be interesting to see how software advancements can reduce our dependence on hardware and in turn help to minimize the amount of e-waste created in the first place. [1]

Question 14.
Which clause is similar to “HAVING” clause in Mysql?
(A) SELECT
(B) WHERE
(C) FROM
(D) None of the above [1]
Answer:
(B) WHERE
Explanation: A HAVING clause in SQL specifies that an SQL SELECT statement must only return rows where aggregate values meet the specified conditions. After the aggregating operation, HAVING is applied, filtering out the rows that don’t match the specified conditions. [1]

15. Nested grouping can be done by providing ______ in the GROUP BY expression.
(A) SINGLE ROW
(B) MULTIPLE FIELDS
(C) SINGLE COLUMN
(D) MULTIPLE TABLES [1]
Answer:
(B) MULTIPLE FIELDS
Explanation: The GROUP BY Statement in SQL is used to arrange identical data into groups with the help of some functions. i.e if a particular column has same values in different rows then it will arrange these rows in a group. [1]

CBSE Sample Papers for Class 12 Informatics Practices Set 6 with Solutions

Question 16.
The month( ) function in MySql is an example of …………..
(A) Math function
(B) Text function
(C) Date Function
(D) Aggregate Function [1]
Answer:
(C) Date Function
Explanation: This function returns the month for date, in the range 1 to 12 for January to December. If it returns 0 then month part of the given date contains NULL. [1]

Assertion & Reason

Directions: In the following questions, a statement of assertion (A) is followed by a statement of reason (R). Mark the correct choice as:
(A) Both assertion (A) and reason (R) are true and reason (R) is the correct explanation of assertion (A).
(B) Both assertion (A) and reason (R) are true but reason (R) is NOT the correct explanation of assertion (A).
(C) Assertion (A) is true but reason (R) is false.
(D) Assertion (A) is false but reason (R) is true.

Question 17.
Assertion (A): Browser is the software to access internet based webpages in the computer.
Reason (R): Local Area Network (LAN) is a network where two or more computers are connected within 1 km.
Answer:
(B) Both assertion (A) and reason (R) are true but reason (R) is NOT the correct explanation of assertion (A).
Explanation: A web browser is application software for accessing the World Wide Web. When a user follows the URL of a web page from a particular website, the web browser retrieves the necessary content from the website’s web server and then displays the page on the user’s device. A local area network is a computer network that interconnects computers within a limited area such as a residence, school, laboratory, university campus or office building. Home WiFi networks and small business networks are common examples of LANs. [1]

Question 18.
Assertion (A): A histogram is an accurate representation of the distribution of numerical data.
Reason (R): Histogram is a kind of bar graph.
Answer:
(B) Both assertion (A) and reason (R) are true but reason (R) is NOT the correct explanation of assertion (A).
Explanation: A histogram is an accurate representation of the distribution of numerical data. It is an estimate of the probability distribution of a continuous variable. It is a kind of bar graph. [1]

Section – B

Question 19.
A say, “In this network topology, one malfunctioning node does not affect that rest of the network and it is easy to add and remove nodes.
B says, “In this network topology, cable length required is less but if the main cable encounters some problem, whole network breaks down.
Name the topologies A and B are talking about. [2]
OR
ABC bank has many computers connected in a building. What type of network is formed ? Name two hardware resources that can be shared by the computers connected in the bank network.
Answer:
A – Star topology
B – Bus topology [2]
OR
Type of network that is formed: LAN/Local Area Network. The Hardware Resources that can be shared:

  • Modem
  • Printer
  • Scanner
  • Hard disk

Question 20.
What is the use of SUBSTR( ) function?
Answer:
The SUBSTR( ) function returns the specified number of character from a particular position of a given string.
e. g.
mysql> SELECT SUBSTR (‘COMPUTER’, 4, 3);
Output
PUT [2]

Commonly Made Error:
Students get confused in functions of string and they wrote wrong definition.

Answering Tip:
Students should learn all concepts carefully.

CBSE Sample Papers for Class 12 Informatics Practices Set 6 with Solutions

Question 21.
Consider the following SQL string: “Organization”
Write commands to display:
(a) “zation”
(b) “gan”
Answer:
(a) SELECT SUBSTR(“Organization”, 7);
(b) SELECT MID (“Organization”, 3, 3); [2]

Question 22.
What do you mean by Matplotlib ? [2]
Answer:
Matplotlib is an amazing visualization library in Python that used for 2D plots of arrays. It is a multi-platform data visualization library which buildsNumPy arrays. Matplotlib was introduced by John Hunter in the year 2002. [2]

Question 23.
Explain active digital footprint.
OR
Explain the term trademark. [2]
Answer:
When a user knowingly share the personal data in order to share information about the user by the means of social networking sites or other websites then it is known as active digital footprint.For example when a user comments or posts something on social media. [2]
OR
Trademark include any symbols, word, name, design, slogan, label, etc., that distinguishes the brands or commercial enterprises, from other brands or commercial enterprises. For example, no company other than ABC can use the ABC brand to sell shoes or clothes. It also prevents others from using a confusingly similar mark, including works or phrases.

Question 24.
Give the output of the code
import pandas as pd
data = pd. DataFrame ([ ‘one’, ‘Two’, Three’,’Four’], index = [‘A’, ‘B’, ‘c’,’d’],
columns = [‘Fixed’])
print (data) [2]
Answer:

Fixed
A One
B Two
C Three
D Four

25. Which type of graph is widely used in mathematics, especially in statistics? Explain. [2]
Answer:
Histogram is a type of graph that is widely used in mathematics, especially in statistics. The histogram represents the frequency of occurrence of specific phenomena which lie within a specific range of values, which are arranged in consecutive and fixed intervals. [2]

Section – C

Question 26.
Consider the following table Activity. Write SQL Commands for the statements (i) to (ii) and output for SQL queries (iii):

PID PARTICIPANT GRADE EVENT POINTS EVENTDATE HOUSE
101 Amit Dubey A Running 200 2018-12-19 Gandhi
102 Shivraj Singh A Hopping bag 300 2019-01-12 Bose
103 Raj Arora B Skipping 200 2018-12-19 Gandhi
104 Kapil Raj A Bean bag 250 2018-12-19 Bhagat
105 Deepshikha Sen A Obstacle 350 2018-03-31 Bose
106 Saloni Raj B Egg \& Spoon 200 2018-12-20 Bose

(i) To display names of Participants and points in descending order of points.
(ii) To display House wise total points scored along with House name.
(i.e. display the HOUSE and total points scored by each HOUSE.)
(iii) SELECT AVERAGE (POINTS) FROM Activity WHERE HOUSE = ‘Gandhi’ or HOUSE = ‘Bose’; [3]
Answer:
(i) SELECT PARTICIPANT, POINTS FROM
Activity ORDER BY POINTS DESC;
(ii) SELECT HOUSE, SUM (POINTS) FROM Activity GROUP BY HOUSE;
(iii) 250 [3]

CBSE Sample Papers for Class 12 Informatics Practices Set 6 with Solutions

Question 27.
Consider two objects A and B. A is a list where as B is a Series. Both have values 20, 35, 60, 90, 120. What will be the output of the following two statements considering that the above objects have been created already?
(a) print (A*2)
(b) print(B*2)
Justify your answer.
Answer:
(a) will give the output as:
[20, 35, 60, 90, 120, 20, 35, 60, 90, 120]
(b) will give the output as

0 40
1 70
2 120
3 180
4 240

Justification: In the first statement, A represents a list so when a list is multiplied by a number, it is replicated that many number of times. The second B represents a series. When a series is multiplied by a value, then each element of the series is multiplied by that number. [3]

Question 28.
Below is given the velocity of a moving body at different instances of time. Draw the velocity time graph.

Time (s) 0 5 10 15 20 25 30
Velocity (ms-1) 10 15 20 20 30 15 0

Answer:
from matplotlib import pyplot as plt
import numpy as np
t = np.arange(0, 35, 5)
velocity = [10, 15, 20, 20, 30, 15, 0]
plt.plot(t, velocity)
plt.xlabel(‘velocity m/s’)
plt.ylabel(‘Time(s)’)
plt.title(‘velocity-Time graph’)
plt.show( ) [3]

Question 29.
How to apply netiquettes ? [3]
OR
List the types of plagiarism.
Answer:
Netiquettes play vital role while communicating online. Online communication is non verbal so your messages could be misunderstood if you don’t apply netiquettes carefully. Keep following things in mind while applying netiquettes.

(i) Always use netiquettes to express your emotions because if you don’t use netiquettes it becomes difficult for the other person to understand it correctly because of the non-verbal communication.

(ii) When you are cracking a joke or creating humour then you should be careful because if you don’t make clear that you are creating a joke then your message could be taken on other way. Without netiquettes understanding humour is not easy. But you can do this easily by using netiquettes. You can use emotions; you can add lots of laughter (LOL) at the end.

(iii) Don’t send same message again and again it create negative impact and irritate the other person no matter how good this messages is and how much netiquettes you applied.

(iv) Always take permission of the other person before sharing their personal information, photo sets. If you don’t take permission before sharing the information of other person then it’s bad netiquettes.

(v) Never make bad comments about anyone on social media it will degrade your reputation and don’t catch into fight on social media even try to avoid such situation. [3]
OR
Types of Plagiarism
(i) Direct Plagiarism, is the word-to-word transcription of a section of someone else’s work, without attribution and without quotation marks
(ii) Self Plagiarism occurs when a student submits his or her own previous work or mixes parts of previous works, without permission from all professors involved.
(iii) Mosaic Plagiarism occurs when a student’s arrows parades from a source without using quotation marks.
(iv) Accidental Plagiarism occurs when a person neglects to cite their sources or misquotes their sources.

Apart from this, other categories of plagiarism are as below:

  • CLONE: Cloning is the most problematic and common form of plagiarism.
  • CTRL- C: In this type of plagiarism, a particular portion of the text is copied from a single source without any alteration.
  • FIND-REPLACE: Most common keywords of the copied content are changed.
  • REMIX: Information from various sources is collected and mixed. [3]

Question 30.
Write the Output of the following SQL queries : [3]
(i) SELECT RIGHT(‘Software’, 2);
(ii) SELECT ROUND (79.987, 2);
(iii) SELECT POWER (7,3);
OR
Considering the same string “Organization”
Write SQL commands to display:
(i) The position of the substring‘zať in the given string
(ii) The last 3 letters of the string
(iii) The length of given string
Answer:
(i) re
(ii) 79.99
(iii) 343 [3]
OR
(i) SELECT INSTR(“Organization”, “zat”);
(ii) SELECT RIGHT(“Organization”, 3);
(iii) SELECT LENGTH(“Organization”);

Section – D

Question 31.
Define the POWER( ) function. Also explain its two examples. [5]
OR
Consider the tables given below :
Table : PARTICIPANT

ADMNO NAME HOUSE ACTIVITY_CODE
6473 Kapil Shah Gandhi A105
7134 Joy Matthew Bose A101
8786 Saba Khan Gandhi A102
6477 Kapil Shah Bose A101
7658 Faizal Ahmed Bhagat A104

Table : ACTIVITY

ACTIVITY_CODE ACTIVITY_NAME POINTS
A101 Running 200
A102 Hopping bag 300
A103 Skipping 200
A104 Bean bag 250
A105 Obstacle 350

(i) To display Activity code along with number of participants participating in each activity (Activity Code Wise) from the table Participant.
(ii) To display names of Participants, Activity Code, Activity Name in alphabetic ascending order of names of participants.
(iii) To display Names of Participants along with Activity Codes and Activity Names for only those participants who are taking part in Activities that have ‘bagʻin their Activity Names and Points of activity are above 250.
(iv) Identify data type and size to be used for column Activity code in table Activity.
(v) 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.
Answer:
POWER ( ) function accepts two arguments; the first specifies the expression, the second specifies the power with which to raise that expression.
The return value is the same data type as the first argument.
Syntax :
POWER (m, n) e.g. POWER (2, 4) = 16
Parameter :
m : It is a base value in the calculation
n : It is exponent value in the calculation
This function returns m raised to the nth power Example 1:
Mysql>SELECT POWER(2, 3) AS Result;
Output
CBSE Sample Papers for Class 12 Informatics Practices Set 6 Img 3

Example 2: Here’s an example of passing in a negative value for the first argument.
SELECT
POWER(-2, 3) ‘Result 1’,
POWER(-20, 3) ‘Result 2’,
POWER(-2, 30) ‘Result 3’;
Output
CBSE Sample Papers for Class 12 Informatics Practices Set 6 Img 4

And here’s a negative value for the second argument: SELECT
POWER(2, -3) ‘Result 1’,
POWER(20, -20) ‘Result 2’,
POWER(200, -300) ‘Result 3’;
Output
CBSE Sample Papers for Class 12 Informatics Practices Set 6 Img 5

(i) SELECT ACTIVITY_CODE,COUNT(*)
FROM PARTICIPANT
GROUP BY ACTIVITY_CODE;
OR
SELECT CONCAT(ACTIVITY_CODE,COUNT(*))
FROM PARTICIPANT
GROUP BY ACTIVITY_CODE;

(ii) Select Name, PActivity_Code, Activity_Name From Participant P, Activity A
Where EActivity_Code = A. Activity_Code Order By Name ASC.;

(iii) Select Name, PActivity_Code, Activity_Name From Participant P Activity A

(iv) Datatype-Varchar
Size = 5

(v) NAME column has duplicate values ,cannot be considered as Primary key, therefore Admno is to be considered as Primary Key.

CBSE Sample Papers for Class 12 Informatics Practices Set 6 with Solutions

Question 32.
Uplifting skills Hub India is a knowledge and skill community which has an aim to uplift the standard of knowledge and skills in the society. It is planning to setup its training centres in multiple towns and villages in India with its head offices in the nearest cities. They have created a model of their network with a city, a town and 3 villages as follows. As a network consultant, you have to suggest the best network related solutions for their issues problems raised in (i) to (iv) keeping in mind the distance between various locations and given parameters.
CBSE Sample Papers for Class 12 Informatics Practices Set 6 Img 1
Shortest distance between various location :

VILLAGE 1 to B_TOWN 2 km
VILLAGE 2 to B_TOWN 1.0 km
VILLAGE 3 to B_TOWN 1.5 km
VILLAGE 1 to VILLAGE 2 3.5 km
VILLAGE 1 to VILLAGE 3 4.5 km
VILLAGE 2 to VILLAGE 3 2.5 km
A-CITY Head Office to B_HUB 25  km

Number of computers installed at various locations are as follows:

B_TOWN 120
VILLAGE 1 15
VILLAGE 2 10
VILLAGE 3 15
A_CITY Head OFFICE 6

Note:
In villages, there are community centres, in which one room has been given as training centre to this organization to install computers. The organization gets financial support from the government and top IT companies.

(i) Suggest the most appropriate locations of the SERVER in the B_HUB out of the 4 locations, to get the best and effective connectivity. Justify you answer.
(ii) Suggest the best wired medium and draw the cable various locations within the B_HUB.
(iii) Which hardware device will you suggest to connect all the computers within each location of B_HUB?
(iv) Which service/protocol will be most helpful to conduct live interactions of experts from Head office and people at all locations of B_HUB?
(v) The organisation also has inquiry office in another dty about 50-60 km away in hilly region. Suggest the suitable transmission media to interconnect to school and inquiry office out of the following : i Fiber optic cable, i Microwave, i Radiowave [5]
Answer:
(i) B_TOWN can house the server as it has the maximum no. of computers.
(ii) Optical fibre cable is the best for this start topology.
CBSE Sample Papers for Class 12 Informatics Practices Set 6 Img 6
(iii) Switch
(iv) VoIP
(v) Radiowaves can be used in hilly regions as they can travel through obstacles. [5]

Question 33.
Write a code for column deletion in DataFrame. [5]
OR
Write the code which will represent the following plot
CBSE Sample Papers for Class 12 Informatics Practices Set 6 Img 2
Answer:
import pandas as pd
d={‘One’ : pd.Series ([1, 2, 3],
index=[‘a’, ‘b’, ‘c’]),
‘Two’ :pd.Series([1, 2, 3, 4],
index=[‘a’, ‘b’, ‘c’, ‘d’]),
‘Three’ :pd.Series ([10, 20, 30], index
= [‘a’, ‘b’, ‘c’])}
df=pd.DataFrame(d)
print(“our dataframe is :”, df)
#Deletion using del function
print(“Deleting the first column using del :”)
del df[‘one’]
print (df) [5]

Commonly Made Error:
Some students do not use proper format to write the code.

Answering Tip:
Students should practice the program on their computer practically.

OR
import pandas as pd
product = pd.DataFrame ({“Year”:[2014,2015,2016, 2017, 2018],

Where P.Activity_Code = A.Activity_Code AND Activity_Name LIKE “\%bag\%”
AND POINTS >250;

“ProdASales” : [2000, 3000, 4000, 3500, 6000],
“ProdBSales” : [3000, 4000, 3500, 3500, 5500]})
# Multi line plot
ax = product.plot(“Year”, “ProdASales”, kind= “line”, label = ‘Product A Sales’)
product.plot(“Year”, “ProdBSales”, ax= ax , kind = “line”,
label = ‘Product B Sales’, title= ‘MultiLine PloP)
#ax : axes object
# Set axes
ax.set(ylabel=’Sales’, xlabel = ‘Year’, xticks =df[“Year”])

Section – E

Case based Subjective Questions

Question 34.
A Gift Gallery has different stores in India. Database Administrator Abhay wants to maintain database of their Salesmen in SQL to store the data, He has decided that Name of the database: GiftGallery Name of the table: Salesman Attributes of the tables: Scode – Numeric, Sname – Character 25, Address – Character 25, Dojoin – Date, Sales – Numeric and Area – Character 10

Consider the following records in ‘Salesman’ table and answer the given questions:

Scode Sname Address Dojoin Sales Area
100 Amit Delhi 2017 / 09 / 29 5000.90 East
101 Sushant Gurgaon 2018 / 01 / 01 7000.75 East
102 Priya Noida 2018 / 04 / 25 3450.45 West
103 Mohit Delhi 2018 / 11 / 03 6000.50 North
104 Pryianshi Delhi 2019 / 12 / 15 8000.62 North

(i) Help Priya to display sname and sales of east and west areas.
(ii) The command to display the name of the salesman along with the sales amount rounded off to one decimal point.
(iii) What will be the output of the following command? Also, define the round( ) function. [2]
Select Right (Sname,3), Round (Sales) from Salesman Where Sname Like “P%”;

OR (Option for part iii only)

Identify the primary key of table Salesman. Also, explain primary key. [2]
Answer:
(i) Select sname, sales from Salesman where area=”East” or area=”West”; [1]
(ii) Select sname, round(sales,1) from salesman; [1]
(iii)

Right(Sname,3) Round(Sale)
iya 3,450
shi 8,001

The ROUND( ) function in MySQL is used to round a number to a specified number of decimal places. If no specified number of decimal places is provided for round off, it rounds off the number to the nearest integer. [2]
OR
Primary key of table Salesman is Scode
The PRIMARY KEY constraint uniquely identifies each record in a table. Primary keys must contain UNIQUE values, and cannot contain NULL values. A table can have only ONE primary key; and in the table, this primary key can consist of single or multiple columns (fields).

CBSE Sample Papers for Class 12 Informatics Practices Set 6 with Solutions

Question 35.
Zeenat has created the following data frame dataframel to keep track of data Rollno, Name, Marks1 and Marks2 for various students of her class where row indexes are taken as the default values:

Roll No. Name Marks Marks
1. Swapnil Sharma 30 50
2. Raj Batra 75 45
3. Bhoomi Singh 82 95
4. Jay Batra 90 95

(a) (i) Which command will give 90, 95 as output.
(ii) She wants to add a new column Marks3 with relevant data. Help her choose the command to perform this task.
(b) Write the command to delete the 3rd column using del keyword. Also, define the del keyword.
OR
(Option for part iii only)
Which command will display the total number of elements in the dataframe? Also, define the size attribute. [2]
Answer:
(a) (i) print((dataframe1.Marks1.max( )),
(dataframe1.Marks2.max( ))) [1]
(ii) dataframel [‘Marks3’]= [ 45,52,90,95] [1]
(b) del dataframe1[‘Marks1’]
The del keyword delete any variable, list of values from a list. [2]
OR
print(dataframe1. size)
The size property returns the number of elements in the DataFrame. The number of elements is the number of rows * the number of columns