A ............... is a device that connects the organization's network with the outside world of the Internet.
- Hub
- Modem
- Gateway
- 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.
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.
- Hydrogen
- Beryllium
- Chlorine
- 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.
Copyright, Patent and Trademark comes under :
- Intellectual Property Right
- Individual Property Right
- Industrial Property Right
- None of the above
Answer
Intellectual Property Right
Reason — Copyright, patent, and trademark are all forms of intellectual property rights.
Predict the output of the following query :
SELECT MOD(9, 0);
- 0
- NULL
- NaN
- 9
Answer
NULL
Reason — The MOD()
function returns NULL when the divisor is zero because division by zero is undefined in SQL.
Which of the following SQL functions does not belong to the Math functions category ?
- POWER()
- ROUND()
- LENGTH()
- MOD()
Answer
LENGTH()
Reason — LENGTH()
is a text/string function that returns the length of a given string in bytes.
............... is not a FOSS tool.
- Libre Office
- Mozilla Firefox
- Google Chrome
- 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.
CSV stands for :
- Column Separated Value
- Class Separated Value
- Comma Separated Value
- None of the above
Answer
Comma Separated Value
Reason — The acronym CSV is short for Comma-Separated Value.
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.
Predict the output of the following query :
SELECT LCASE(MONTHNAME('2023-03-05'));
- May
- March
- may
- 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.
Which of the following command will show the last 3 rows from a Pandas Series named NP ?
- NP.Tail()
- NP.tail(3)
- NP.TAIL(3)
- 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
.
With reference to SQL, identify the invalid data type.
- Date
- Integer
- Year
- Month
Answer
Year, Month
Reason — In SQL, 'Year' and 'Month' are not valid data types.
In Python Pandas, while performing mathematical operations on series, index matching is implemented and all missing values are filled in with ............... by default.
- Null
- Blank
- NaN
- 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.
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 :
- Phishing
- Identity Theft
- Plagiarism
- 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.
In SQL, the equivalent of UCASE() is :
- UPPERCASE()
- CAPITALCASE()
- UPPER()
- 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.
Collection of hyper linked documents available on the internet is known as ............... .
- Website
- Webpage
- Web Server
- 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.
............... 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.
- Creative Cost
- Critical Commons
- Creative Commons
- 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.
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.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- 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.
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.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- 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.
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.
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
.
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)
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;
+--------------+
| the_position |
+--------------+
| 8 |
+--------------+
(ii)
SELECT SUBSTR("12#All the Best!", -5) AS last_five;
+-----------+
| last_five |
+-----------+
| Best! |
+-----------+
Predict the output of the given Python code :
import pandas as pd
list1 = [-10, -20, -30]
ser = pd.Series(list1 * 2)
print(ser)
Answer
0 -10
1 -20
2 -30
3 -10
4 -20
5 -30
dtype: int64
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.
Differentiate between the active digital footprint and passive digital footprints.
Answer
Differences between active digital footprint and passive digital footprint are:
Active digital footprint | Passive 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. |
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'])
Rajasthan
import pandas as pd
: This line imports the pandas library and assign it the aliaspd
.NP = pd.Series(di)
: This line creates a pandas Series objectNP
from the dictionarydi
.print(NP['Sariska'])
: This line accesses the value associated with the key 'Sariska' in the Series objectNP
and print it. Since the value is 'Rajasthan', it gets printed.
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().
Based on the SQL table CAR_SALES, write suitable queries for the following :
NUMBER | SEGMENT | FUEL | QT1 | QT2 |
---|---|---|---|---|
1 | Compact Hatchback | Petrol | 56000 | 70000 |
2 | Compact Hatchback | Diesel | 34000 | 40000 |
3 | MUV | Petrol | 33000 | 35000 |
4 | MUV | Diesel | 14000 | 15000 |
5 | SUV | Petrol | 27000 | 54000 |
6 | SUV | Diesel | 18000 | 30000 |
7 | Sedan | Petrol | 8000 | 10000 |
8 | Sedan | Diesel | 1000 | 5000 |
(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;
+--------+---------------+
| FUEL | Avg_Sales_QT1 |
+--------+---------------+
| Petrol | 31000.0000 |
| Diesel | 16750.0000 |
+--------+---------------+
(ii)
SELECT SEGMENT, MAX(QT2) AS HIGHEST_SALES
FROM CAR_SALES
GROUP BY SEGMENT;
+-------------------+---------------+
| SEGMENT | HIGHEST_SALES |
+-------------------+---------------+
| Compact HatchBack | 70000 |
| MUV | 35000 |
| SUV | 54000 |
| Sedan | 10000 |
+-------------------+---------------+
(iii)
SELECT * FROM CAR_SALES
ORDER BY QT2 DESC;
+--------+-------------------+--------+-------+-------+
| 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 |
+--------+-------------------+--------+-------+-------+
Predict the output of the following queries based on the table CAR_SALES given below :
NUMBER | SEGMENT | FUEL | QT1 | QT2 |
---|---|---|---|---|
1 | Compact Hatchback | Petrol | 56000 | 70000 |
2 | Compact Hatchback | Diesel | 34000 | 40000 |
3 | MUV | Petrol | 33000 | 35000 |
4 | MUV | Diesel | 14000 | 15000 |
5 | SUV | Petrol | 27000 | 54000 |
6 | SUV | Diesel | 18000 | 30000 |
7 | Sedan | Petrol | 8000 | 10000 |
8 | Sedan | Diesel | 1000 | 5000 |
(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)
+------------------+
| LEFT(SEGMENT, 2) |
+------------------+
| Co |
| MU |
| SU |
| Se |
+------------------+
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)
+------------+
| AVG SALE |
+------------+
| 13500.0000 |
| 6000.0000 |
+------------+
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)
+----------+
| TOT SALE |
+----------+
| 67000 |
+----------+
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.
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 :
Name | Department | Salary | |
---|---|---|---|
0 | Divya | HR | 95000 |
1 | Mamta | Marketing | 97000 |
3 | Payal | IT | 980000 |
4 | Deepak | Sales | 79000 |
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)
Name Department Salary
0 Divya HR 95000
1 Mamta Marketing 97000
2 Payal IT 980000
3 Deepak Sales 79000
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 Name | Data Type | Constraints |
---|---|---|
Food_Item | Varchar(20) | Primary Key |
Calorie | Integer |
Answer
(i)
CREATE DATABASE FOOD;
(ii)
CREATE TABLE Nutrients
(Food_Item Varchar(20) Primary Key,
Calorie integer);
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 :
- Richa should change her social media privacy settings to ensure only trusted friends can see her posts and pictures.
- Richa should be cautious about accepting friend requests. She should only accept requests from people she knows personally and trusts.
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 :
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.
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.
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.
Consider the given DataFrame ‘Genre’ :
type | code | |
---|---|---|
0 | Fiction | F |
1 | Non-fiction | NF |
2 | Drama | D |
3 | Poetry | P |
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)
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
id | user | value | hash | transaction_date |
---|---|---|---|---|
1 | Steve | 900 | ERTYU | 2020-09-19 |
2 | Meesha | 145 | @345r | 2021-03-23 |
3 | Nimisha | 567 | #wert5 | 2020-05-06 |
4 | Pihu | 678 | %rtyu | 2022-07-13 |
5 | Kopal | 768 | rrt4% | 2021-05-15 |
7 | Palakshi | 534 | wer@3 | 2022-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;
+-------------+
| oldest_year |
+-------------+
| 2020 |
+-------------+
(ii)
SELECT MONTH(MAX(transaction_date)) AS most_recent_month
FROM BLOCKCHAIN;
+-------------------+
| most_recent_month |
+-------------------+
| 11 |
+-------------------+
(iii)
SELECT *
FROM BLOCKCHAIN
WHERE MONTH(transaction_date) = 5;
+----+---------+-------+--------+------------------+
| 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;
+-------------------------+
| total_transactions_2022 |
+-------------------------+
| 2 |
+-------------------------+
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 :
Store | Qtr1 | Qtr2 | Qtr3 | Qtr4 | |
---|---|---|---|---|---|
0 | Store1 | 300 | 240 | 450 | 230 |
1 | Store2 | 350 | 340 | 403 | 210 |
2 | Store3 | 250 | 180 | 145 | 160 |
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)
15
The size
attribute of a DataFrame returns the total number of elements in the DataFrame df
.
(b) print(df[1:3])
Store Qtr1 Qtr2 Qtr3 Qtr4
1 Store2 350 340 403 210
2 Store3 250 180 145 160
This statement uses slicing to extract rows 1 and 2 from the DataFrame df
.
(ii)
df = df.drop(2)
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']
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')
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);
+-------------+
| POWER(3, 4) |
+-------------+
| 81 |
+-------------+
(ii)
SELECT NOW();
+---------------------+
| NOW() |
+---------------------+
| 2024-05-21 12:20:03 |
+---------------------+
(iii)
SELECT ROUND(-34.4567, 2);
+--------------------+
| ROUND(-34.4567, 2) |
+--------------------+
| -34.46 |
+--------------------+
(iv)
UPDATE user
SET userid = TRIM(userid);
(v)
SELECT LENGTH("FIFA World Cup");
+--------------------------+
| LENGTH("FIFA WORLD CUP") |
+--------------------------+
| 14 |
+--------------------------+
Kabir has created following table named exam :
RegNo | Name | Subject | Marks |
---|---|---|---|
1 | Sanya | Computer Science | 98 |
2 | Sanchay | IP | 100 |
3 | Vinesh | CS | 90 |
4 | Sneha | IP | 99 |
5 | Akshita | IP | 100 |
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";
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 Z2 | 80 metres |
Block Z1 to Block Z3 | 65 metres |
Block Z1 to Block Z4 | 90 metres |
Block Z2 to Block Z3 | 45 metres |
Block Z2 to Block Z4 | 120 metres |
Block Z3 to Block Z4 | 60 metres |
Number of computers installed at various buildings are as follows :
Block | Number of computers |
---|---|
Z1 | 135 |
Z2 | 290 |
Z3 | 180 |
Z4 | 195 |
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
- Repeater
- 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).
(iii) The placement of devices:
- 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.
- 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.
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()
Write suitable Python code to create 'Favourite Hobby' Bar Chart as shown below :
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()