Please select a subject first
Advertisements
Advertisements
Sahil, a class X student, has just started understanding the basics of Internet and web technologies. He is a bit confused between the terms “World Wide Web” and “Internet”. Help him in understanding both terms with the help of suitable examples of each.
Concept: undefined >> undefined
List one advantage and disadvantage of using Cookies.
Concept: undefined >> undefined
Advertisements
Which function is used to display the total number of records from a table in a database?
Concept: undefined >> undefined
Differentiate between count() and count(*) functions in SQL with appropriate examples.
Concept: undefined >> undefined
Write the outputs of the SQL queries based on the relations Teacher and Placement given below:
Table: Teacher
| T_ID | Name | Age | Department | Date_of_join | Salary | Gender |
| 1 | Arunan | 34 | Computer Sc | 2019-01-10 | 12000 | M |
| 2 | Saman | 31 | History | 2017-03-24 | 20000 | F |
| 3 | Randeep | 32 | Mathematics | 2020-12-12 | 30000 | M |
| 4 | Samira | 35 | History | 2018-07-01 | 40000 | F |
| 5 | Raman | 42 | Mathematics | 2021-09-05 | 25000 | M |
| 6 | Shyam | 50 | History | 2019-06-27 | 30000 | M |
| 7 | Shiv | 44 | Computer Sc | 2019-02-25 | 21000 | M |
| 8 | Shalakha | 33 | Mathematics | 2018-07-31 | 20000 | F |
Table: Placement
| P_ID | Department | Place |
| 1 | History | Ahmedabad |
| 2 | Mathematics | Jaipur |
| 3 | Computer Sc | Nagpur |
- SELECT Department, avg(salary) FROM Teacher GROUP BY Department;
- SELECT MAX(Date_of_Join), MIN(Date_of_Join) FROM Teacher;
- SELECT Name, Salary, T.Department, Place FROM Teacher T, Placement P WHERE T.Department = P.Department AND Salary>20000;
- SELECT Name, Place FROM Teacher T, Placement P WHERE Gender = ’F’ AND T.Department = P.Department;
Concept: undefined >> undefined
Predict the output of the code given below:
s="welcome2cs"
n = len(s)
m=""
for i in range(0, n):
if (s[i] >= 'a' and s[i] <= 'm'):
m = m +s[i].upper()
elif (s[i] >= 'n' and s[i] <= 'z'):
m = m +s[i-1]
elif (s[i].isupper()):
m = m + s[i].lower()
else:
m = m +'&'
print(m)Concept: undefined >> undefined
Which function returns the sum of all elements of a list?
Concept: undefined >> undefined
Write the use and syntax for the following method:
dump()
Concept: undefined >> undefined
Define pickling in Python. Explain serialization and deserialization of Python object.
Concept: undefined >> undefined
What is the purpose of the following clause in a select statement?
ORDER BY
Concept: undefined >> undefined
What is the purpose of the following clause in a select statement?
GROUP BY
Concept: undefined >> undefined
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
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
