Computers connected by a network across different cities is an example of ............... .
- LAN
- MAN
- WAN
- PAN
Answer
MAN
Reason — Computers connected by a network across different cities is an example of MAN (Metropolitan Area Network).
Out of the following, which crime(s) will come under the cybercrime category?
- Identity theft
- Invasion of privacy
- Online harassment
- All of these
Answer
All of these
Reason — The term cyber crime is a general term that covers crime like phishing, credit card frauds, illegal downloading, industrial espionage, child pornography, cyber bullying, cyber stalking, cyber terrorism, creation and/or distribution of viruses, spam and so on.
E-waste is harmful to the environment and human health if not properly treated or disposed of, therefore, it must be handled with care. What are the health hazards which can be caused by E-waste?
- Lung cancer
- DNA damage
- Brain damage
- All of these
Answer
All of these
Reason — E-waste contains hazardous substances such as lead, mercury, cadmium, arsenic etc. Improper handling or disposal of e-waste can release these toxic substances into the environment, leading to various health hazards including lung cancer, DNA damage, and brain damage.
What will be returned by the given query?
SELECT RIGHT("LEFT", 2) ;
Answer
+------------------+
| RIGHT("LEFT", 2) |
+------------------+
| FT |
+------------------+
The RIGHT()
function in SQL extracts a specified number of characters from the right side of a string. The second parameter, 2, specifies that we want to extract 2 characters from the right end of the string "LEFT". Therefore, the result will be "FT".
In the table 'Student' in MySQL, if column 'Fees' contains the data (5000, 8000, 7500, NULL, 5000, 8000), what will be the output after the execution of the given query?
SELECT COUNT(DISTINCT Fees) FROM student;
Answer
The above query will return 3 as the output.
The query SELECT COUNT(DISTINCT Fees) FROM student;
returns 3 because it counts the unique non-null values in the Fees column of the Student table. In the given data (5000, 8000, 7500, NULL, 5000, 8000), the distinct non-null values are 5000, 8000, and 7500. The NULL value is excluded from the distinct count, resulting in a count of 3.
Online ............... is a theft of personal information in order to commit a fraud.
Answer
identity theft
Identify the Single Row function of MySQL among the following:
- Trim ()
- Max ()
- Avg()
- Count()
Answer
Trim()
Reason — Trim() is a single row function that removes leading and trailing spaces from a string.
What will be returned by the given query?
select round(23456.1234, -2) ;
- 23456.00
- 23400
- 23500
- 23456.1200
Answer
23500
Reason — The query SELECT ROUND(23456.1234, -2);
will return 23500. This is because the ROUND()
function in SQL rounds the number 23456.1234 to the nearest hundredth position specified by -2, resulting in 23500.
Which one of the following functions is used to find the smallest value from the given data in MySQL?
- MIN()
- MINIMUM()
- SMALL()
- SMALLEST()
Answer
MIN()
Reason — The MIN()
is an aggregate function in MySQL that returns the minimum value from a set of values.
Choose the correct statement to print the label in the line chart.
- pl.xlabel("some values")
- pl.xlable("some values")
- pl.plotlabel("some values")
- None of these
Answer
pl.xlabel("some values")
Reason — In matplotlib, pl.xlabel("some values") is used to set the label for the x-axis of a plot.
Which clause is used in the query to place the condition on group in MySQL?
- WHERE
- HAVING
- GROUP BY
- Both (i) and (ii)
Answer
HAVING
Reason — The HAVING
clause is used in SQL queries to place conditions on groups when using the GROUP BY
clause.
Which of the following codes will display the total number of rows in the DataFrame stud?
- print (len(stud.axes[0]))
- print (stud.len(0) )
- print (stud.len [axes=0] )
- print (len (stud.axes[row] )
Answer
print(len(stud.axes[0]))
Reason — The command stud.axes[0]
gives access to the index labels along the 0th axis (rows) of the DataFrame stud
. The len(stud.axes[0])
returns the length of this index label array, which corresponds to the total number of rows in the DataFrame stud
.
The legal term to describe the rights of a creator of original creative or artistic work is−
- Copyright
- Copylef
- GPL
- FOSS
Answer
Copyright
Reason — A copyright is a legal term to describe the rights of the creator of an original creative work such as a literary work, an artistic work, a design, song, movie or software etc.
In SQL, which clause is used to select specific rows?
Answer
In SQL, the WHERE
clause is used to select specific rows based on certain conditions or criteria.
Which is the device that connects dissimilar networks?
Answer
A gateway is a network device that connects dissimilar networks.
Name the primary law in India dealing with cybercrime?
Answer
The primary law in India dealing with cybercrime is Information Technology Act, 2000.
Assertion (A): A repeater is an electronic device that receives a signal and retransmits it.
Reasoning (R): Repeaters are used to extend transmissions so that the signal can cover longer distances.
- 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
A repeater is an electronic device that receives a signal, amplifies it, and retransmits it. Repeaters are used to extend transmissions so that the signal can cover longer distances and overcome signal degradation that occurs over long distances.
Assertion (A): In Series, values of data are Immutable: Value of elements cannot be changed.
Reasoning (R): Pandas Series are homogeneous one-dimensional objects, i.e., all data are of the same type.
- 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 false but R is true.
Explanation
In a Pandas Series, the values of data are mutable, meaning they can be changed. A Pandas Series is a one-dimensional structure with elements of homogeneous data types, which can include integers, strings, floats, or Python objects etc.
How do computer networks reduce hardware costs of an organization? Explain with the help of an example.
Answer
Computer networks reduce hardware costs by enabling resource sharing and centralized management. For instance, shared printers and network storage reduce the need for multiple devices per user or department. Centralized management allows IT to monitor and maintain hardware from one location, reducing maintenance costs and improving efficiency. This approach minimizes the number of physical devices needed, lowers power consumption, and optimizes hardware utilization across the organization.
Distinguish between Static and Dynamic web pages.
Answer
Static web pages | Dynamic web pages |
---|---|
In static web pages, the contents of the web pages remains fixed or unchanging. These web pages are loaded on the client's browser exactly in the same way as they are stored on the web server. | A dynamic web page is created upon user request, displaying unique content based on interactions. Each view is tailored to the user and exist only for that moment. |
A user can only read the information but cannot make any modifications or interact with the data. | Dynamic web page is an Interactive web page that is highly functional and users can interact with it. |
Static web pages are created by using only HTML. | Dynamic web pages can be created by using ASP, PHP, or DHTML. |
Carefully observe the following code:
import pandas as pd
list_of_dict = [
{ 'Name' : 'Sourab' , 'Age' : 35, 'Marks' : 91},
{ 'Name' : 'Rohan', 'Age' : 31, 'Marks' : 87} ,
{ 'Name' : ' Shalini', 'Age' : 33, 'Marks' : 78},
{ 'Name' : ' Divya' , 'Age' : 23, 'Marks' : 93}
]
df = pd. DataFrame (list_of_dict)
print (df)
Answer the following:
(i) List the index of the DataFrame df.
(ii) List the column names of DataFrame df.
Answer
(i) The index of the DataFrame df
will be the default integer index range starting from 0 to the number of rows minus one. In this case, since df
is created from a list of dictionaries, the index will be [0, 1, 2, 3].
(ii) The column names of DataFrame df
is 'Name', 'Age', 'Marks'.
What is the purpose of the DROP TABLE command in MySQL? How is it different from the DELETE command?
Answer
The DROP TABLE
command in MySql is used to permanently delete an entire table from the database, including its structure, data, indexes, triggers, and constraints. The DELETE
command, on the other hand, is used to remove specific rows or all rows from a table, leaving the table structure intact.
Write Python code to create the following Series Stock (using list):
1 PEN
2 PENCIL
3 ERASER
Answer
import pandas as pd
items = ['PEN', 'PENCIL', 'ERASER']
Stock = pd.Series(items, index=[1, 2, 3])
print(Stock)
1 PEN
2 PENCIL
3 ERASER
dtype: object
Ms. Samantha has many electronic gadgets which are not usable due to outdated hardware and software. Help her to find the three best ways to dispose of the used electronic gadgets.
Answer
The three ways to dispose of the used electronic gadgets are as follows:
- Recycling Centers and E-Waste Events
- Manufacturer Take-Back Programs
- Certified E-Waste Recyclers
What do you understand about Netiquette? Explain any two such etiquette.
Answer
Net Etiquettes refers to online manners while using Internet or working online. While online, we should be courteous, truthful and respectful of others.
The two netiquettes are as follows:
Refrain from personal abuse — If we disagree to something, we may express robust disagreement, but never call them names or threaten them with personal violence.
Never spam — We should not repeatedly post the same advertisement for products or services.
Give the output:
import pandas as pd
name = ['Rahul','Aman','Karan']
p=pd.Series (name, index= [0,1,2] )
p1 = p.reindex ([1,2,3])
print(p)
print(p1)
Answer
0 Rahul
1 Aman
2 Karan
dtype: object
1 Aman
2 Karan
3 NaN
dtype: object
The provided Python code utilizes Pandas to create a Series p
using the list name
with indices [0, 1, 2]. Subsequently, p
is reindexed using p.reindex([1, 2, 3])
, creating a new Series p1
. The output displays both p
and p1
.
What is Mathematical function in SQL? Name any two.
Answer
In SQL, mathematical functions are built-in functions that perform mathematical operations on numeric data. POWER
and SQRT
are two examples of mathematical functions.
Mr. Sombuddha, an HR Manager in a multinational company "Star-X World", has created the following table to store the records of employees:
Table: Emp
Eid | EName | Department | DOB | DOJ |
---|---|---|---|---|
Star1 | Dev | Sales | 1994-08-28 | 2020-02-14 |
Star2 | Melinda | IT | 1997-10-15 | 2021-11-19 |
Star3 | Raj | Accounts | 1998-10-02 | 2019-04-02 |
Star4 | Michael | Sales | 2000-02-17 | 2020-05-01 |
Star5 | Sajal | IT | 2001-12-05 | 2018-06-13 |
Star6 | John | Accounts | 1995-01-03 | 2019-07-15 |
Star7 | Julia | Sales | 1985-11-13 | 2020-08-19 |
Predict the output of the following queries that he has written:
(i) Select max(year(DOB)) from emp;
(ii) Select ENAME from emp where month(DOJ) = 11;
(iii) Select length(EName) from emp where Department = "IT";
Answer
(i)
+----------------+
| max(year(DOB)) |
+----------------+
| 2001 |
+----------------+
(ii)
+---------+
| ENAME |
+---------+
| MELINDA |
+---------+
(iii)
+---------------+
| length(EName) |
+---------------+
| 7 |
| 5 |
+---------------+
Write a Python code to create a dataframe with appropriate headings from the list given below:
['S101', 'Amy', 70], ['S102', 'Bandhi', 69], ['S104', 'Cathy', 75], ['S105', 'Gundaho', 82]
Answer
import pandas as pd
data = [
['S101', 'Amy', 70],
['S102', 'Bandhi', 69],
['S104', 'Cathy', 75],
['S105', 'Gundaho', 82]
]
columns = ['ID', 'Name', 'Score']
df = pd.DataFrame(data, columns=columns)
print(df)
ID Name Score
0 S101 Amy 70
1 S102 Bandhi 69
2 S104 Cathy 75
3 S105 Gundaho 82
A relation Vehicles is given below:
V_no | Type | Company | Price | Qty |
---|---|---|---|---|
AW125 | WagonR | Maruti | 250000 | 25 |
J0083 | Jeep | Mahindra | 4000000 | 15 |
S9090 | SUV | Mitsubishi | 2500000 | 18 |
M0892 | Mini van | Datsun | 1500000 | 26 |
W9760 | SUV | Maruti | 2500000 | 18 |
R2409 | Mini van | Mahindra | 350000 | 15 |
Write SQL commands to:
(i) Display the average price of each type of vehicle having a quantity of more than 20.
(ii) Count the type of vehicles manufactured by each company.
(iii) Display the total price of all types of vehicles.
Answer
(i)
SELECT Type, AVG(Price) AS Average_Price
FROM Vehicles
WHERE Qty > 20
GROUP BY Type;
+----------+---------------+
| Type | Average_Price |
+----------+---------------+
| WagonR | 250000.0000 |
| Mini van | 1500000.0000 |
+----------+---------------+
(ii)
SELECT Company, COUNT(DISTINCT Type) AS Num_Vehicle_Types
FROM Vehicles
GROUP BY Company;
+------------+-------------------+
| Company | Num_Vehicle_Types |
+------------+-------------------+
| Datsun | 1 |
| Mahindra | 2 |
| Maruti | 2 |
| Mitsubishi | 1 |
+------------+-------------------+
(iii)
SELECT SUM(Price * Qty) AS Total_Price
FROM Vehicles;
+-------------+
| Total_Price |
+-------------+
| 200500000 |
+-------------+
What is the difference between the order by and group by clauses when used along with a select statement? Explain with an example.
Answer
ORDER BY:
The ORDER BY
clause is used to sort the result set in ascending or descending order based on one or more columns.
Example:
SELECT *
FROM Vehicles
ORDER BY Price ASC;
This query selects all columns (*) from the Vehicles table and sorts the result set in ascending order (ASC) based on the Price column. The output will display the vehicles with the lowest price first.
GROUP BY:
The GROUP BY
clause is used to group the result set based on one or more columns. It divides the result set into groups, and each group contains rows with the same values in the specified columns.
Example:
SELECT Type, AVG(Price) AS Average_Price
FROM Vehicles
GROUP BY Type;
This query selects the Type column and calculates the average price (AVG(Price)) for each group of vehicles with the same Type. The result set will display the average price for each type of vehicle.
Prerna received an email from her bank stating that there is a problem with her account. The email provides instructions and a link, by clicking on which she can log in to her account and fix the problem. Help Prerna by telling her the precautions she should take when she receives these types of emails.
Answer
When Prerna receives an email from her bank stating that there is a problem with her account, she should be cautious to avoid falling prey to phishing scams. She should check the sender's email address to ensure it's legitimate, avoid clicking on any links provided in the email, and instead manually type in the bank's website address in her browser. She should contact the bank directly using the phone number or email address listed on the bank's official website, and check for signs of phishing such as poor grammar or a sense of urgency. Additionally, she should never share personal information such as her username, password, or account number in response to an email, and keep her computer and antivirus software up-to-date to protect against malware and other security threats.
Write the names of any two common types of Intellectual Property Rights which are protected by law.
Answer
The two common types of Intellectual Property Rights that are protected by law are:
- Copyright
- Patent
Consider the dataframe SHOP given below:
Item Qty City Price
101 Biscuit 100 Delhi 10
102 Jam 110 Kolkata 25
103 Coffee 200 Kolkata 55
104 Sauce 56 Mumbai 55
105 Chocolate 170 Delhi 25
Write commands to:
(i) Write short code to show the information having city = "Delhi".
(ii) Calculate Qty * Price and assign to column 'Net_Price'.
(iii) Display Items of all rows.
Answer
(i)
info = SHOP[SHOP['City'] == 'Delhi']
print(info)
Item Qty City Price
101 Biscuit 100 Delhi 10
105 Chocolate 170 Delhi 25
(ii)
SHOP['Net_Price'] = SHOP['Qty'] * SHOP['Price']
print(SHOP)
Item Qty City Price Net_Price
101 Biscuit 100 Delhi 10 1000
102 Jam 110 Kolkata 25 2750
103 Coffee 200 Kolkata 55 11000
104 Sauce 56 Mumbai 55 3080
105 Chocolate 170 Delhi 25 4250
(iii)
items = SHOP['Item']
print(items)
101 Biscuit
102 Jam
103 Coffee
104 Sauce
105 Chocolate
Name: Item, dtype: object
Consider the following table named "Student":
RollNo | Name | Marks | Grade | Fees | Stream |
---|---|---|---|---|---|
1 | Mishra | 30 | C | 6000 | Commerce |
2 | Gupta | 48 | B | 15000 | Arts |
3 | Khan | 66 | A | 4800 | Science |
4 | Chaddha | 24 | C | 12500 | Commerce |
5 | Yadav | 23 | A | 10000 | Arts |
Write the SQL functions which will perform the following operations:
(i) To show the sum of fees of all students.
(ii) To display maximum and minimum marks.
(iii) To count different types of grades available.
(iv) Write a query to count grade-wise total number of students.
Answer
(i)
SELECT SUM(Fees) AS Total_Fees
FROM Student;
+------------+
| Total_Fees |
+------------+
| 48300 |
+------------+
(ii)
SELECT MAX(Marks) AS Max_Marks, MIN(Marks) AS Min_Marks
FROM Student;
+-----------+-----------+
| Max_Marks | Min_Marks |
+-----------+-----------+
| 66 | 23 |
+-----------+-----------+
(iii)
SELECT COUNT(DISTINCT Grade) AS Different_Grades
FROM Student;
+------------------+
| Different_Grades |
+------------------+
| 3 |
+------------------+
(iv)
SELECT Grade, COUNT(*) AS Total_Students
FROM Student
GROUP BY Grade;
+-------+----------------+
| Grade | Total_Students |
+-------+----------------+
| C | 2 |
| B | 1 |
| A | 2 |
+-------+----------------+
(i) Consider the dataframe "EMP":
Name Basic Da Hra
E1 Sanya 9500 3000 2000
E2 Krish 7000 5000 1900
E3 Rishav 9650 1500 2100
E4 Deepak 7500 2000 2700
E5 Kriti 9200 1800 500
Give the output
EMP.iloc[1, 2]=8000
EMP.Hra = EMP.Hra + 200
print(EMP)
(ii) Write a Python statement to change the name 'Rishav' to 'Rishab' in the above dataframe.
Or
(Option for part ii only)
Write a Python statement to calculate the sum of Basic, Da, and Hra and assign it to the column 'Salary'.
Answer
Name Basic Da Hra
E1 Sanya 9500 3000 2200
E2 Krish 7000 8000 2100
E3 Rishav 9650 1500 2300
E4 Deepak 7500 2000 2900
E5 Kriti 9200 1800 700
(ii)
EMP.loc[EMP['Name'] == 'Rishav', 'Name'] = 'Rishab'
Or
(Option for part ii only)
EMP['Salary'] = EMP['Basic'] + EMP['Da'] + EMP['Hra']
Name Basic Da Hra Salary
E1 Sanya 9500 3000 2200 14700
E2 Krish 7000 8000 2100 17100
E3 Rishab 9650 1500 2300 13450
E4 Deepak 7500 2000 2900 12400
E5 Kriti 9200 1800 700 11700
Consider the following table named "GARMENT".
GCODE | GNAME | SIZE | COLOUR | PRICE |
---|---|---|---|---|
111 | T-Shirt | XL | Red | 1400.234 |
112 | Jeans | L | Blue | 1600.123 |
113 | Skirt | M | Black | 1100.65 |
115 | Trousers | L | Brown | 1500.50 |
116 | Ladies Top | L | Pink | 1200.25 |
Write SQL queries using SQL functions to perform the following operations:
(i) Display the name and price after rounding off to one decimal place.
(ii) Display all Gname in upper case.
(iii) Display the last three characters from Gname.
(iv) Display the highest Gcode from the table GARMENT.
(v) Display the sum of all prices of size 'L'.
Answer
(i)
SELECT GNAME, ROUND(PRICE, 1) AS ROUNDED_PRICE
FROM GARMENT;
+------------+---------------+
| GNAME | ROUNDED_PRICE |
+------------+---------------+
| T-Shirt | 1400.2 |
| Jeans | 1600.1 |
| Skirt | 1100.7 |
| Trousers | 1500.5 |
| Ladies Top | 1200.3 |
+------------+---------------+
(ii)
SELECT UPPER(GNAME) AS GNAME_UPPERCASE
FROM GARMENT;
+-----------------+
| GNAME_UPPERCASE |
+-----------------+
| T-SHIRT |
| JEANS |
| SKIRT |
| TROUSERS |
| LADIES TOP |
+-----------------+
(iii)
SELECT RIGHT(GNAME, 3) AS LAST_THREE_CHARACTERS
FROM GARMENT;
+-----------------------+
| LAST_THREE_CHARACTERS |
+-----------------------+
| irt |
| ans |
| irt |
| ers |
| Top |
+-----------------------+
(iv)
SELECT MAX(GCODE) AS HIGHEST_GCODE
FROM GARMENT;
+---------------+
| HIGHEST_GCODE |
+---------------+
| 116 |
+---------------+
(v)
SELECT SUM(PRICE) AS TOTAL_PRICE_SIZE_L
FROM GARMENT
WHERE SIZE = 'L';
+--------------------+
| TOTAL_PRICE_SIZE_L |
+--------------------+
| 4300.873 |
+--------------------+
Write the SQL functions which will perform the following operations:
(i) To return the summation of all non-NULL values of a data set.
(ii) To extract a substring starting from a position with a specific length.
(iii) To convert a string to uppercase.
(iv) To return the year for a specified date.
(v) To round off a number to a specified number of decimal places.
Answer
(i)
SELECT SUM(column_name)
FROM table_name;
(ii)
SELECT SUBSTRING(column_name, start_position, length)
FROM table_name;
(iii)
SELECT UPPER(column_name)
FROM table_name;
(iv)
SELECT YEAR(date_column)
FROM table_name;
(v)
SELECT ROUND(column_name, decimal_places)
FROM table_name;
A company in Mega Enterprises has 4 wings of buildings as shown in the diagram:
Centre-to-centre distances between various buildings:
W3 to W1 — 50m
W1 to W2 — 60m
W2 to W4 — 25m
W4 to W3 — 170m
W3 to W2 — 125m
W1 to W4 — 90m
Number of computers in each of the wings:
W1 — 150
W2 — 15
W3 — 15
W4 — 25
Computers in each wing are networked but the wings are not networked. The company has now decided to connect the wings also.
(i) Suggest the most suitable cable layout for the above connections.
(ii) Suggest the most appropriate topology of the connection between the wings.
(iii) The company wants internet accessibility in all the wings. Suggest a suitable technology.
(iv) Suggest the placement of the repeater with justification.
(v) Suggest the placement of the Hub/Switch with justification if the company wants to minimize network traffic.
Answer
(i) A possible cable layout that connects all buildings with the minimum total distance could be: W3 → W1 → W2 → W4 as shown below:
(ii) Bus topology is the most appropriate topology for connecting the wings.
(iii) The company should setup an internet proxy server in wing W1. Computers of all the other wings will access the internet through this proxy server.
(iv) A repeater should be placed between W4 and W3, and another one between W3 and W2 to ensure signal strength is maintained over these longer distances.
(v) To minimize network traffic and ensure efficient data handling, the hub/switch should be placed in all wings.
Write Python code to draw the following Bar graph representing the number of students in each class.
Answer
import matplotlib.pyplot as plt
x = ['IX', 'X', 'XI', 'XII']
y = [40, 45, 35, 45]
plt.bar(x, y)
plt.show()
Write Python code to create a Line graph using the list of elements x and y. Set ylabel as "marks" and xlabel as "names". The title of the graph is 'Result'.
x = ['A', 'B', 'C', 'D', 'E']
y = [82, 25, 87, 14, 90]
Answer
import matplotlib.pyplot as plt
x = ['A', 'B', 'C', 'D', 'E']
y = [82, 25, 87, 14, 90]
plt.plot(x, y, marker='o')
plt.xlabel('names')
plt.ylabel('marks')
plt.title('Result')
plt.show()