Please select a subject first
Advertisements
Advertisements
Consider the following table named “Product”, showing details of products being sold in a grocery shop.
| PCode | PName | UPrice | Manufacturer |
| P01 | Washing Powder | 120 | Surf |
| P02 | Toothpaste | 54 | Colgate |
| P03 | Soap | 25 | Lux |
| P04 | Toothpaste | 65 | Pepsodent |
| P05 | Soap | 38 | Dove |
| P06 | Shampoo | 245 | Dove |
Write SQL queries for the following:
- Create the table Product with appropriate data types and constraints.
- Identify the primary key in the Product.
- List the Product Code, Product Name, and price in descending order of their product name. If PName is the same, then display the data in ascending order of price.
- Add a new column Discount to the table Product.
- Calculate the value of the discount in the table Product as 10 percent of the UPrice for all those products where the UPrice is more than 100, otherwise, the discount will be 0.
- Increase the price by 12 percent for all the products manufactured by Dove.
- Display the total number of products manufactured by each manufacturer. Write the output(s) produced by executing the following queries on the basis of the information given above in the table Product:
- SELECT PName, Average (UPrice) FROM Product GROUP BY Pname;
i) SELECT DISTINCT Manufacturer FROM Product;
j) SELECT COUNT (DISTINCT PName) FROM Product;
k) SELECT PName, MAX(UPrice), MIN(UPrice) FROM Product GROUP BY PName;
Concept: undefined >> undefined
Write a short note on White, Black, and Grey Hat Hackers.
Concept: undefined >> undefined
Advertisements
Given the following dictionaries.
dict_exam={"Exam":"AISSCE", "Year":2023}
dict_result={"Total":500, "Pass_Marks":165}
Which statement will merge the contents of both dictionaries?
Concept: undefined >> undefined
Write the output of the queries based on the table, TECH_COURSE given below:
| Table: TECH_COURSE | ||||
| CID | CNAME | FEES | STARTDATE | TID |
| C201 | Animation and VFX | 12000 | 2022-07-02 | 101 |
| C202 | CADD | 15000 | 2021-11-15 | NULL |
| C203 | DCA | 10000 | 2020-10-01 | 102 |
| C204 | DDTP | 9000 | 2021-09-15 | 104 |
| C205 | Mobile Application Development |
18000 | 2022-11-01 | 101 |
| C206 | Digital Marketing | 16000 | 2022-07-25 | 103 |
- SELECT DISTINCT TID FROM TECH_COURSE;
- SELECT TID, COUNT(*), MIN(FEES) FROM TECH_COURSE GROUP BY TID HAVING COUNT(TID)>1;
- SELECT CNAME FROM TECH_COURSE WHERE FEES>15000 ORDER BY CNAME;
- SELECT AVG(FEES) FROM TECH_COURSE WHERE FEES BETWEEN 15000 AND 17000;
Concept: undefined >> undefined
Aman is a Python programmer. He has written a code and created a binary file record.dat with employeeid, ename, and salary. The file contains 10 records.
He now has to update a record based on the employee id entered by the user and update the salary. The updated record is then to be written in the file temp.dat. The records which are not to be updated also have to be written to the file temp.dat. If the employee id is not found, an appropriate message should be displayed.
As a Python expert, help him to complete the following code based on the requirement given above:
import _______ #Statement 1
def update_data():
rec={}
fin=open("record.dat","rb")
fout=open("_____________") #Statement 2
found=False
eid=int(input("Enter employee id to update their salary :: "))
while True:
try:
rec=______________ #Statement 3
if rec["Employee id"]==eid:
found=True
rec["Salary"]=int(input("Enter new salary :: "))
pickle.____________ #Statement 4
else:
pickle.dump(rec,fout)
except:
break
if found==True:
print("The salary of employee id ",eid," has
been updated.")
else:
print("No employee with such id is not found")
fin.close()
fout.close()
- Which module should be imported into the program? (Statement 1)
- Write the correct statement required to open a temporary file named temp.dat. (Statement 2)
- Which statement should Aman fill in Statement 3 to read the data from the binary file, record.dat, and in Statement 4 to write the updated data in the file, temp.dat?
Concept: undefined >> undefined
Consider a file, SPORT.DAT, containing records of the following structure:
[SportName, TeamName, No_Players]
Write a function, copyData(), that reads contents from the file SPORT.DAT and copies the records with Sport name as “Basket Ball” to the file named BASKET.DAT. The function should return the total number of records copied to the file BASKET.DAT.
Concept: undefined >> undefined
A Binary file, CINEMA.DAT has the following structure:
{MNO:[MNAME, MTYPE]}
Where
- MNO - Movie Number
- MNAME - Movie Name
- MTYPE is Movie Type
Write a user defined function, findType(mtype), that accepts mtype as parameter and displays all the records from the binary file CINEMA.DAT, that have the value of Movie Type as mtype.
Concept: undefined >> undefined
What do you understand by Cartesian Product?
Concept: undefined >> undefined
Write a short note on the following:
HTTP
Concept: undefined >> undefined
Write a short note on the following:
DNS
Concept: undefined >> undefined
What is protocol in data communication? Explain with an example.
Concept: undefined >> undefined
Write the full form of the following:
SMTP
Concept: undefined >> undefined
Write the full form of the following:
PPP
Concept: undefined >> undefined
What is the use of TELNET?
Concept: undefined >> undefined
Expand the following in the context of Internet Protocol:
POP3
Concept: undefined >> undefined
What is the need for Protocols?
Concept: undefined >> undefined
Define production function.
Concept: undefined >> undefined
Distinguish between short-run and long-run production functions.
Concept: undefined >> undefined
Give one example of negative externalities.
Concept: undefined >> undefined
