KnowledgeBoat Logo
OPEN IN APP

CBSE Sample Paper

Practice Paper

Class 12 - Informatics Practices Sumita Arora



Section A (1 Mark Each)

Question 1

A ............... is a device that connects the organization's network with the outside world of the Internet.

  1. Hub
  2. Modem
  3. Gateway
  4. Repeater

Answer

Gateway

Reason — A gateway is a node on a network that serves as an entrance to another network. In an organization, the gateway is a device that connects the organization's network with the outside world, including the Internet.

Question 2

When e-waste such as electronic circuit boards are burnt for disposal, the elements contained in them create a harmful chemical called ............... which causes skin diseases, allergies and an increased risk of lung cancer.

  1. Hydrogen
  2. Beryllium
  3. Chlorine
  4. Oxygen

Answer

Beryllium

Reason — When electronic circuit boards containing beryllium are burnt for disposal, they release beryllium oxide, a harmful chemical compound. Inhalation or skin contact with beryllium oxide can lead to skin diseases, allergies, and an increased risk of lung cancer.

Question 3

Copyright, Patent and Trademark comes under :

  1. Intellectual Property Right
  2. Individual Property Right
  3. Industrial Property Right
  4. None of the above

Answer

Intellectual Property Right

Reason — Copyright, patent, and trademark are all forms of intellectual property rights.

Question 4

Predict the output of the following query :

SELECT MOD(9, 0);
  1. 0
  2. NULL
  3. NaN
  4. 9

Answer

NULL

Reason — The MOD() function returns NULL when the divisor is zero because division by zero is undefined in SQL.

Question 5

Which of the following SQL functions does not belong to the Math functions category ?

  1. POWER()
  2. ROUND()
  3. LENGTH()
  4. MOD()

Answer

LENGTH()

ReasonLENGTH() is a text/string function that returns the length of a given string in bytes.

Question 6

............... is not a FOSS tool.

  1. Libre Office
  2. Mozilla Firefox
  3. Google Chrome
  4. Python

Answer

Google Chrome

Reason — Google Chrome is not a Free and Open Source Software (FOSS) tool. It is a web browser developed by Google, which means its source code is not openly available for users to view, modify, or distribute. In contrast, LibreOffice, Mozilla Firefox, and Python are all examples of FOSS tools with open-source code that can be freely used, modified, and distributed by anyone.

Question 7

CSV stands for :

  1. Column Separated Value
  2. Class Separated Value
  3. Comma Separated Value
  4. None of the above

Answer

Comma Separated Value

Reason — The acronym CSV is short for Comma-Separated Value.

Question 8

Raj, a Database Administrator, needs to display the average pay of workers from those departments which have more than five employees. He is experiencing a problem while running the following query :

SELECT DEPT, AVG(SAL) FROM EMP WHERE COUNT(*) > 5 GROUP BY DEPT;

Which of the following is a correct query to perform the given task ?

(i) SELECT DEPT, AVG(SAL) FROM EMP WHERE COUNT(*) > 5 GROUP BY DEPT;

(ii) SELECT DEPT, AVG(SAL) FROM EMP HAVING COUNT(*) > 5 GROUP BY DEPT;

(iii) SELECT DEPT, AVG(SAL) FROM EMP GROUP BY DEPT WHERE COUNT(*) > 5;

(iv) SELECT DEPT, AVG(SAL) FROM EMP GROUP BY DEPT HAVING COUNT(*) > 5;

Answer

SELECT DEPT, AVG(SAL) FROM EMP GROUP BY DEPT HAVING COUNT(*) > 5;

Reason — In the above query, the WHERE clause cannot be used with aggregate functions like COUNT(*) because it is meant to filter individual rows before the aggregation. On the other hand, the HAVING clause filters the groups created by the GROUP BY clause to include only those departments (DEPT) that have more than five employees.

Question 9

Predict the output of the following query :

SELECT LCASE(MONTHNAME('2023-03-05'));
  1. May
  2. March
  3. may
  4. march

Answer

march

Reason — The MONTHNAME() function in MySQL returns the name of the month for a given date. In this case, the date '2023-03-05' corresponds to March, so MONTHNAME('2023-03-05') will return "March". Then LCASE() function is used to convert the result to lowercase, resulting in "march" as the output.

Question 10

Which of the following command will show the last 3 rows from a Pandas Series named NP ?

  1. NP.Tail()
  2. NP.tail(3)
  3. NP.TAIL(3)
  4. All of the above

Answer

NP.tail(3)

Reason — The syntax to display the last n rows of a Series object is <Series Object>.tail([n]). Therefore, according to this syntax, NP.tail(3) will display last three rows of a Series object NP.

Question 11

With reference to SQL, identify the invalid data type.

  1. Date
  2. Integer
  3. Year
  4. Month

Answer

Year, Month

Reason — In SQL, 'Year' and 'Month' are not valid data types.

Question 12

In Python Pandas, while performing mathematical operations on series, index matching is implemented and all missing values are filled in with ............... by default.

  1. Null
  2. Blank
  3. NaN
  4. Zero

Answer

NaN

Reason — When performing mathematical operations on pandas Series objects, index matching is implemented (this is called data alignment in Pandas objects), and missing values are filled with NaN (Not a Number) by default.

Question 13

By restricting the server and encrypting the data, a software company's server is unethically accessed in order to obtain sensitive information. The attacker blackmails the company to pay money for getting access to the data, and threatens to publish sensitive information unless price is paid. This kind of attack is known as :

  1. Phishing
  2. Identity Theft
  3. Plagiarism
  4. Ransomware

Answer

Ransomware

Reason — Ransomware is a type of malicious attack where an attacker gains unauthorized access to a system or server, encrypts the data, and demands a ransom in exchange for the information. In this scenario, the attacker is threatening to publish sensitive information unless the company pays the ransom, which is a characteristic of a ransomware attack.

Question 14

In SQL, the equivalent of UCASE() is :

  1. UPPERCASE()
  2. CAPITALCASE()
  3. UPPER()
  4. TITLE()

Answer

UPPER()

Reason — The equivalent function in SQL to UCASE() is UPPER(). Both perform the same operation, which is to convert all characters in a string to uppercase.

Question 15

Collection of hyper linked documents available on the internet is known as ............... .

  1. Website
  2. Webpage
  3. Web Server
  4. Web Hosting

Answer

Website

Reason — A website or a site is a group of related web pages hosted on a web server and are linked together (through hyperlinks and hypertext) and share a common interface and design.

Question 16

............... is a non-profit organization that aims to build a publicly accessible global platform where a range of creative and academic work is shared freely.

  1. Creative Cost
  2. Critical Commons
  3. Creative Commons
  4. Creative Common

Answer

Creative Commons

Reason — Creative Commons is a non-profit organization that aims to build a publicly accessible global platform where a range of creative and academic work is shared freely.

Question 17

Assertion (A). MODEM stands for modulator-demodulator.

Reasoning (R). It is a computer hardware device that converts data from a digital format to analog and vice versa.

  1. Both A and R are true and R is the correct explanation of A.
  2. Both A and R are true but R is not the correct explanation of A.
  3. A is true but R is false.
  4. A is false but R is true.

Answer

Both A and R are true and R is the correct explanation of A.

Explanation
MODEM stands for modulator-demodulator. It is a computer hardware device that allows connecting and communicating with other computers via telephone lines. It converts digital data from a computer into analog signals suitable for transmission over telephone lines, and vice versa, converting incoming analog signals back into digital data that the computer can understand.

Question 18

Assertion (A). To use the Pandas library in a Python program, one must import it.

Reasoning (R). The only alias name that can be used with the Pandas library is pd.

  1. Both A and R are true and R is the correct explanation of A.
  2. Both A and R are true but R is not the correct explanation of A.
  3. A is true but R is false.
  4. A is false but R is true.

Answer

A is true but R is false.

Explanation
In order to work with Pandas in Python, we need to import the Pandas library into our Python environment using the statement import pandas as pd. While pd is a common alias used with the Pandas library, it's not the only alias that can be used. We can import Pandas using other alias names as well.

Section B (2 Marks Each)

Question 19(a)

Briefly explain the basic concepts of a web server and web hosting.

Answer

A web server is a WWW server that stores web documents and responds to requests made by web browsers. Some examples are Apache, IIS, Nginx, GWS, and Netsite.

A website is physically located on a web host. A group of linked web pages qualifies to be called a website only when hosted on a web server. When the user specifies the address of the website, the web pages are transmitted to the user's computer from the web host.

Question 19(b)

Rati is doing a course in networking. She is unable to understand the concept of URL. Help her by explaining it with the help of suitable example.

Answer

A URL (Uniform Resource Locator) is a location on a net server. The Internet structure of the World Wide Web is built on a set of rules called Hypertext Transfer Protocol (HTTP), which uses Internet addresses in a special format called a URL.

URLs look like this : type://address/path, where type: specifies the type of server in which the file is located, address is the address of server, and path tells the location of file on the server.

For example, in the following URL http://encycle.msn.com/getinfo/styles.asp, http: specifies the type of server, encycle.msn.com is the address of server and getinfo/style.asp is the path of the file styles.asp.

Question 20

The python code written below has syntactical errors. Rewrite the correct code and underline the corrections made.

Import pandas as pd
df = {"Technology" : ["Programming", "Robotics", "3D Printing"], 
"Time(in months)" : [4, 4, 3]}
df = Pd.dataframe(df)
Print(df)

Answer

Import pandas as pd #Error 1
df = {"Technology" : ["Programming", "Robotics", "3D Printing"], 
"Time(in months)" : [4, 4, 3]}
df = Pd.dataframe(df) #Error 2
Print(df) #Error 3

Error 1 — The 'i' in import statement should be in lowercase as it's a reserved keyword in Python.

Error 2 — Alias pd for pandas library should be same as defined with lowercase 'p' and the DataFrame constructor should have a capital 'D' and capital 'F'.

Error 3 — The print function should be written with 'p' in lowercase, as it's a built-in Python function.

The corrected code is :

import pandas as pd
df = {"Technology" : ["Programming", "Robotics", "3D Printing"], 
"Time(in months)" : [4, 4, 3]}
df = pd.DataFrame(df)
print(df)

Question 21

Consider the given SQL string :

"12#All the Best!"

Write suitable SQL queries for the following :

(i) Returns the position of the first occurrence of the substring "the" in the given string.

(ii) To extract last five characters from the string.

Answer

(i)

SELECT INSTR("12#All the Best!", 'the') AS the_position;
Output
+--------------+
| the_position |
+--------------+
|            8 |
+--------------+

(ii)

SELECT SUBSTR("12#All the Best!", -5) AS last_five;
Output
+-----------+
| last_five |
+-----------+
| Best!     |
+-----------+

Question 22

Predict the output of the given Python code :

import pandas as pd
list1 = [-10, -20, -30]
ser = pd.Series(list1 * 2)
print(ser)

Answer

Output
0   -10
1   -20
2   -30
3   -10
4   -20
5   -30
dtype: int64
Explanation

The above code imports the pandas library and assigns it the alias pd. Then, it defines a Python list named list1. The (list1 * 2) expression repeats the list list1 twice. In Python, when we multiply a list by an integer, it creates a new list that contains the original list repeated that number of times. Finally, a Pandas Series object named ser is created from this new list, and the Series ser is printed.

Question 23

Differentiate between the active digital footprint and passive digital footprints.

Answer

Differences between active digital footprint and passive digital footprint are:

Active digital footprintPassive digital footprint
It includes data that we intentionally submit online.It gets created through our data trail that we unintentionally leave online.
Example : Sending an email, sending messages online, posting a social media post, replying to post or commenting online etc.Example : When we visit a website, the web server may log our IP address, which identifies our Internet service provider and our approximate location.

Question 24

Complete the given Python code to get the required output as: Rajasthan

import ............... as pd
di = { 'Corbett' : 'Uttarakhand', 'Sariska ' : 'Rajasthan', 'Kanha' : 
'Madhya Pradesh', 'Gir' : 'Gujarat ' }
NP = ............... . Series( ............... )
print(NP[ ............... ])

Answer

import pandas as pd
di = { 'Corbett' : 'Uttarakhand', 'Sariska' : 'Rajasthan', 'Kanha' : 
'Madhya Pradesh', 'Gir' : 'Gujarat' }
NP = pd. Series(di)
print(NP['Sariska'])
Output
Rajasthan
Explanation
  1. import pandas as pd : This line imports the pandas library and assign it the alias pd.
  2. NP = pd.Series(di) : This line creates a pandas Series object NP from the dictionary di.
  3. print(NP['Sariska']) : This line accesses the value associated with the key 'Sariska' in the Series object NP and print it. Since the value is 'Rajasthan', it gets printed.

Question 25

What are aggregate functions in SQL? Name any two.

Answer

Aggregate functions in SQL work with data from multiple rows at a time and return a single aggregated value.

Examples of aggregate functions include SUM(), COUNT().

Section C (3 Marks Each)

Question 26(a)

Based on the SQL table CAR_SALES, write suitable queries for the following :

NUMBERSEGMENTFUELQT1QT2
1Compact HatchbackPetrol5600070000
2Compact HatchbackDiesel3400040000
3MUVPetrol3300035000
4MUVDiesel1400015000
5SUVPetrol2700054000
6SUVDiesel1800030000
7SedanPetrol800010000
8SedanDiesel10005000

(i) Display fuel wise average sales in the first quarter. :

(ii) Display segment wise highest sales in the second quarter. '

(iii) Display the records in the descending order of sales in the second quarter.

Answer

(i)

SELECT FUEL, AVG(QT1) AS Avg_Sales_QT1 
FROM CAR_SALES 
GROUP BY FUEL;
Output
+--------+---------------+
| FUEL   | Avg_Sales_QT1 |
+--------+---------------+
| Petrol |    31000.0000 |
| Diesel |    16750.0000 |
+--------+---------------+

(ii)

SELECT SEGMENT, MAX(QT2) AS HIGHEST_SALES
FROM CAR_SALES
GROUP BY SEGMENT;
Output
+-------------------+---------------+
| SEGMENT           | HIGHEST_SALES |
+-------------------+---------------+
| Compact HatchBack |         70000 |
| MUV               |         35000 |
| SUV               |         54000 |
| Sedan             |         10000 |
+-------------------+---------------+

(iii)

SELECT * FROM CAR_SALES
ORDER BY QT2 DESC;
Output
+--------+-------------------+--------+-------+-------+
| NUMBER | SEGMENT           | FUEL   | QT1   | QT2   |
+--------+-------------------+--------+-------+-------+
|      1 | Compact HatchBack | Petrol | 56000 | 70000 |
|      5 | SUV               | Petrol | 27000 | 54000 |
|      2 | Compact HatchBack | Diesel | 34000 | 40000 |
|      3 | MUV               | Petrol | 33000 | 35000 |
|      6 | SUV               | Diesel | 18000 | 30000 |
|      4 | MUV               | Diesel | 14000 | 15000 |
|      7 | Sedan             | Petrol |  8000 | 10000 |
|      8 | Sedan             | Diesel |  1000 |  5000 |
+--------+-------------------+--------+-------+-------+

Question 26(b)

Predict the output of the following queries based on the table CAR_SALES given below :

NUMBERSEGMENTFUELQT1QT2
1Compact HatchbackPetrol5600070000
2Compact HatchbackDiesel3400040000
3MUVPetrol3300035000
4MUVDiesel1400015000
5SUVPetrol2700054000
6SUVDiesel1800030000
7SedanPetrol800010000
8SedanDiesel10005000

(i) SELECT LEFT(SEGMENT, 2) FROM CAR_SALES WHERE FUEL= "PETROL";

(ii)SELECT (QT2-QT1)/2 "AVG SALE" FROM CAR_SALES WHERE SEGMENT= "SUV";

(iii) SELECT SUM(QT1) "TOT SALE" FROM CAR_SALES WHERE FUEL= "DIESEL";

Answer

(i)

Output
+------------------+
| LEFT(SEGMENT, 2) |
+------------------+
| Co               |
| MU               |
| SU               |
| Se               |
+------------------+
Explanation

In the query SELECT LEFT(SEGMENT, 2) FROM CAR_SALES WHERE FUEL= "PETROL";, the function LEFT(SEGMENT, 2) takes the leftmost characters of each SEGMENT value, starting from the first character, and returns two characters. The WHERE FUEL = 'PETROL' clause filters the rows to include only those with 'PETROL' as the fuel type.

(ii)

Output
+------------+
| AVG SALE   |
+------------+
| 13500.0000 |
|  6000.0000 |
+------------+
Explanation

The SQL query SELECT (QT2-QT1)/2 "AVG SALE" FROM CAR_SALES WHERE SEGMENT= "SUV"; calculates the average sale for the "SUV" segment in the CAR_SALES table. It does this by subtracting the first quarter sales (QT1) from the second quarter sales (QT2) for each record in the "SUV" segment and then dividing the result by 2. The alias "AVG SALE" is assigned to the computed value.

(iii)

Output
+----------+
| TOT SALE |
+----------+
|    67000 |
+----------+
Explanation

The query SELECT SUM(QT1) "TOT SALE" FROM CAR_SALES WHERE FUEL= "DIESEL"; calculates the total sales for the "DIESEL" fuel type in the CAR_SALES table. It does this by summing up the values in the QT1 column for rows where the FUEL column is equal to "DIESEL". The alias "TOT SALE" is assigned to the computed sum.

Question 27

Create a DataFrame in Python from the given list :

[['Divya', 'HR', 95000], ['Mamta', 'Marketing' ,97000],
['Payal', 'IT', 98000], ['Deepak', 'Sales', 7900]]

Also give appropriate column headings as shown below :

 NameDepartmentSalary
0DivyaHR95000
1MamtaMarketing97000
3PayalIT980000
4DeepakSales79000

Answer

import pandas as pd
data = [['Divya', 'HR', 95000], ['Mamta', 'Marketing', 97000], ['Payal', 'IT', 980000], ['Deepak', 'Sales', 79000]]
df = pd.DataFrame(data, columns=['Name', 'Department', 'Salary'])
print(df)
Output
    Name Department  Salary
0   Divya         HR   95000
1   Mamta  Marketing   97000
2   Payal         IT  980000
3  Deepak      Sales   79000

Question 28

Write MySQL statements for the following :

(i) To create a database named FOOD.

(ii) To create a table named Nutrients based on the following specification :

Column NameData TypeConstraints
Food_ItemVarchar(20)Primary Key
CalorieInteger

Answer

(i)

CREATE DATABASE FOOD;

(ii)

CREATE TABLE Nutrients
(Food_Item Varchar(20) Primary Key,
Calorie integer);

Question 29(a)

Richa, recently started using her social media account. Within a few days, she befriends many people she knows and some that she does not know. After some time, she starts getting negative comments on her posts. She also finds that her pictures are being shared online without her permission.

Based on the given information, answer the questions given below :

(i) Identify the type of cyber crime she is a victim of.

(ii) Under which act, she can lodge a complaint to the relevant authorities ?

(iii) Suggest her any two precautionary measures which she should take in future while being online to avoid any such situations.

Answer

(i) Richa is a victim of cyber bullying. This involves receiving negative comments and harassment on her social media posts.

(ii) Richa can lodge a complaint under the Information Technology Act, 2000, specifically targeting cyber bullying and harassment.

(iii) The two precautionary measures which she should take in future are as follows :

  1. Richa should change her social media privacy settings to ensure only trusted friends can see her posts and pictures.
  2. Richa should be cautious about accepting friend requests. She should only accept requests from people she knows personally and trusts.

Question 29(b)

Mention any three health hazards associated with inappropriate and excessive use of gadgets.

Answer

The three health hazards associated with inappropriate and excessive use of gadgets are as follows :

  1. Impact on Hearing — Listening to loud music for over 15 minutes can cause hearing damage. Using headphones for long periods increases bacteria in the ears by over 700 times.

  2. Impact on Bones and Joints — Technology affects posture due to prolonged sitting and repetitive movements, leading to muscle and joint strain. Repetitive Strain Injuries (RSIs) affect muscles, nerves, tendons, ligaments, and joints.

  3. Eye Problems — Constant screen exposure from smartphones, laptops, and computers can damage vision, especially due to blue light, leading to potential vision loss. Computer Vision Syndrome (CVS) is a related eye condition.

Question 30

Consider the given DataFrame ‘Genre’ :

 typecode
0FictionF
1Non-fictionNF
2DramaD
3PoetryP

Write suitable Python statements for the following :

(i) Add a column called Num_Copies with the following data : [300, 290, 450, 760].

(ii) Add a new genre of type ‘Folk Tale’ having code as “FT” and 600 number of copies.

(iii) Rename the column ‘Code’ to ‘Book_Code’.

Answer

(i)

Genre['Num_Copies'] = [300, 290, 450, 760]

(ii)

Genre = Genre.append({'Type': 'Folk Tale', 'Code': 'FT', 'Num_Copies': 600}, ignore_index=True)

(iii)

Genre.rename(columns = {'Code': 'Book_Code'}, inplace = True)

Section D (4 Marks Each)

Question 31

Preeti manages database in a blockchain start-up. For business purposes, she created a table named BLOCKCHAIN. Assist her by writing the following queries :

TABLE : BLOCKCHAIN

iduservaluehashtransaction_date
1Steve900ERTYU2020-09-19
2Meesha145@345r2021-03-23
3Nimisha567#wert52020-05-06
4Pihu678%rtyu2022-07-13
5Kopal768rrt4%2021-05-15
7Palakshi534wer@32022-11-29

(i) Write a query to display the year of oldest transaction.

(ii) Write a query to display the month of most recent transaction.

(iii) Write a query to display all the transactions done in the month of May.

(iv) Write a query to count total number of transactions in the year 2022.

Answer

(i)

SELECT YEAR(MIN(transaction_date)) AS oldest_year
FROM BLOCKCHAIN;
Output
+-------------+
| oldest_year |
+-------------+
|        2020 |
+-------------+

(ii)

SELECT MONTH(MAX(transaction_date)) AS most_recent_month
FROM BLOCKCHAIN;
Output
+-------------------+
| most_recent_month |
+-------------------+
|                11 |
+-------------------+

(iii)

SELECT *
FROM BLOCKCHAIN
WHERE MONTH(transaction_date) = 5;
Output
+----+---------+-------+--------+------------------+
| id | user    | value | hash   | transaction_date |
+----+---------+-------+--------+------------------+
|  3 | Nimisha |   567 | #wert5 | 2020-05-06       |
|  5 | Kopal   |   768 | rrt4%  | 2021-05-15       |
+----+---------+-------+--------+------------------+

(iv)

SELECT COUNT(*) AS total_transactions_2022
FROM BLOCKCHAIN
WHERE YEAR(transaction_date) = 2022;
Output
+-------------------------+
| total_transactions_2022 |
+-------------------------+
|                       2 |
+-------------------------+

Question 32

Ekam, a Data Analyst with a multinational brand has designed the DataFrame df that contains the four quarter’s sales data of different stores as shown below :

 StoreQtr1Qtr2Qtr3Qtr4
0Store1300240450230
1Store2350340403210
2Store3250180145160

Answer the following questions :

(i) Predict the output of the following python statement :

(a) print(df.size)
(b) print(df[1:3])

(ii) Delete the last row from the DataFrame.

(iii) Write Python statement to add a new column Total_Sales which is the addition of all the 4 quarter sales.

Or (Option for part (iii) only)

Write Python statement to export the DataFrame to a CSV file named data.csv stored at D: drive.

Answer

(i)

(a) print(df.size)

Output
15
Explanation

The size attribute of a DataFrame returns the total number of elements in the DataFrame df.

(b) print(df[1:3])

Output
    Store  Qtr1  Qtr2  Qtr3  Qtr4
1  Store2   350   340   403   210
2  Store3   250   180   145   160
Explanation

This statement uses slicing to extract rows 1 and 2 from the DataFrame df.

(ii)

df = df.drop(2)
Output
    Store  Qtr1  Qtr2  Qtr3  Qtr4
0  Store1   300   240   450   230
1  Store2   350   340   403   210

(iii)

df['Total_Sales'] = df['Qtr1'] + df['Qtr2'] + df['Qtr3'] + df['Qtr4']
Output
    Store  Qtr1  Qtr2  Qtr3  Qtr4  Total_Sales
0  Store1   300   240   450   230         1220
1  Store2   350   340   403   210         1303
2  Store3   250   180   145   160          735

Or

DataFrame.to_csv('D:\\data.csv')

Section E (5 Marks Each)

Question 33(a)

Write suitable SQL queries for the following :

(i) To calculate the exponent for 3 raised to the power of 4.

(ii) To display current date and time.

(iii) To round off the value -34.4567 to 2 decimal place.

(iv) To remove all the probable leading and trailing spaces from the column userid of the table named user.

(v) To display the length of the string ‘FIFA World Cup’.

Answer

(i)

SELECT POWER(3, 4);
Output
+-------------+
| POWER(3, 4) |
+-------------+
|          81 |
+-------------+

(ii)

SELECT NOW();
Output
+---------------------+
| NOW()               |
+---------------------+
| 2024-05-21 12:20:03 |
+---------------------+

(iii)

SELECT ROUND(-34.4567, 2);
Output
+--------------------+
| ROUND(-34.4567, 2) |
+--------------------+
|             -34.46 |
+--------------------+

(iv)

UPDATE user
SET userid = TRIM(userid);

(v)

SELECT LENGTH("FIFA World Cup");
Output
+--------------------------+
| LENGTH("FIFA WORLD CUP") |
+--------------------------+
|                       14 |
+--------------------------+

Question 33(b)

Kabir has created following table named exam :

RegNoNameSubjectMarks
1SanyaComputer Science98
2SanchayIP100
3VineshCS90
4SnehaIP99
5AkshitaIP100

Help him in writing SQL queries to the perform the following task :

(i) Insert a new record in the table having following values : [6, 'Khushi', 'CS', 85]

(ii) To change the value "IP" to "Informatics Practices" in subject column.

(iii) To remove the records of those students whose marks are less than 30. ,

(iv) To add a new column Grade of suitable datatype.

(v) To display records of "Informatics Practices" subject.

Answer

(i)

INSERT INTO exam(RegNo, Name, Subject, Marks)
VALUES(6, 'Khushi', 'CS', 85);

(ii)

UPDATE exam 
SET Subject = 'Informatics Practices' 
WHERE Subject = 'IP';

(iii)

DELETE FROM EXAM
WHERE MARKS < 30 ;

(iv)

ALTER TABLE EXAM
ADD COLUMN (Grade VARCHAR(1));

(v)

SELECT * FROM EXAM
WHERE Subject = "Informatics Practices";

Question 34

XYZ Media house campus is in Delhi and has 4 blocks named Z1, Z2, Z3 and Z4. The tables given below show the distance between different blocks and the number of computers in each block.

Block Z1 to Block Z280 metres
Block Z1 to Block Z365 metres
Block Z1 to Block Z490 metres
Block Z2 to Block Z345 metres
Block Z2 to Block Z4120 metres
Block Z3 to Block Z460 metres

Number of computers installed at various buildings are as follows :

BlockNumber of computers
Z1135
Z2290
Z3180
Z4195

The company is planning to form a network by joining these blocks.

(i) Out of the four blocks on campus, suggest the location of the server that will provide the best connectivity. Explain your response.

(ii) For very fast and efficient connections between various blocks within the campus, suggest a suitable topology and draw the same.

(iii) Suggest the placement of the following devices with justification

  1. Repeater
  2. Hub/Switch

(iv) VoIP technology is to be used which allows one to make voice calls using a broadband internet connection. Expand the term VoIP.

(v) The XYZ Media House intends to link its Mumbai and Delhi centers. Out of LAN, MAN, or WAN, what kind of network will be created? Justify your answer.

Answer

(i) Block Z3 has the shortest distances to all other blocks :

Z3 to Z1: 65 metres
Z3 to Z2: 45 metres
Z3 to Z4: 60 metres

Considering this, Block Z3 could be a good location for the server to provide the best connectivity within the XYZ Media House campus.

(ii) For fast and efficient connections between blocks, a Star Topology would be suitable. In a Star Topology, all blocks are connected directly to a central device (the server in this context).

XYZ Media house campus is in Delhi and has 4 blocks named Z1, Z2, Z3 and Z4. The tables given below show the distance between different blocks and the number of computers in each block. Informatics Practices Computer Science Sumita Arora Solutions CBSE Class 12

(iii) The placement of devices:

  1. Repeater — A repeater should be placed between Z2 block and Z4 block due to the 120-meter distance, as it is used to regenerate and amplify signals to cover longer distances without losing quality.
  2. Hub/Switch — A hub or switch connects multiple devices within a compound, allowing them to communicate with each other and the broader network. So, there should be one hub per block.

(iv) VoIP stands for Voice over Internet Protocol.

(v) To link Mumbai and Delhi centers, a WAN (Wide Area Network) would be created. WANs are designed to connect networks across large geographical areas, making them suitable for inter-city or inter-region communication. Given the distance of connecting two different city centers, a WAN provides the necessary infrastructure and scalability for such connectivity.

Question 35(a)

The heights of 10 students of eighth grade are given below :

Height_cms = [145, 141, 142, 142, 143, 144, 141, 140, 143, 144] 

Write suitable Python code to generate a histogram based on the given data, along with an appropriate chart title and both axis labels. Also give suitable python statement to save this chart.

Answer

import matplotlib.pyplot as plt
Height_cms = [145, 141, 142, 142, 143, 144, 141, 140, 143, 144] 
plt.hist(Height_cms)
plt.title('Distribution of Heights of Eighth Grade Students')
plt.xlabel('Height (cm)')
plt.ylabel('Frequency')
plt.savefig('heights_histogram.png')
plt.show()
Output
The heights of 10 students of eighth grade are given below : Informatics Practices Computer Science Sumita Arora Solutions CBSE Class 12

Question 35(b)

Write suitable Python code to create 'Favourite Hobby' Bar Chart as shown below :

Write suitable Python code to create 'Favourite Hobby' Bar Chart as shown below : Informatics Practices Computer Science Sumita Arora Solutions CBSE Class 12

Also give suitable python statement to save this chart.

Answer

import matplotlib.pyplot as plt
hobbies = ['Dance', 'Music', 'Painting', 'Playing Sports']
people_count = [300, 400, 100, 500]
plt.bar(hobbies, people_count)
plt.xlabel('Hobbies')
plt.ylabel('Number of People')
plt.title('Favourite Hobby')
plt.savefig('favourite_hobby_chart.png')
plt.show()
Output
Write suitable Python code to create 'Favourite Hobby' Bar Chart as shown below : Plotting with Pyplot, Informatics Practices Computer Science Sumita Arora Solutions CBSE Class 12
PrevNext