Please select a subject first
Advertisements
Advertisements
Zack is working in a database named SPORT, in which he has created a table named “Sports” containing columns SportId, SportName, no_of_players, and category.
After creating the table, he realized that the attribute, category has to be deleted from the table and a new attribute TypeSport of data type string has to be added. This attribute TypeSport cannot be left blank. Help Zack write the commands to complete both the tasks.
Concept: undefined >> undefined
How are text files different from binary files?
Concept: undefined >> undefined
Advertisements
Sartaj has created a table named Student in MYSQL database, SCHOOL:
- rno(Roll number )- integer
- name(Name) - string
- DOB (Date of birth) – Date
- Fee – float
Note the following to establish connectivity between Python and MySQL:
- Username - root
- Password - tiger
- Host - localhost
Sartaj, now wants to display the records of students whose fee is more than 5000. Help Sartaj to write the program in Python.
Concept: undefined >> undefined
Consider the code given below and fill in the blanks.
print (" Learning Exceptions…")
try:
num1 = int(input ("Enter the first number")
num2 = int(input("Enter the second number"))
quotient=(num1/num2)
print ("Both the numbers entered were correct")
except ________: # to enter only integers
print (" Please enter only numbers")
except __________: # Denominator should not be zero
print(" Number 2 should not be zero")
else:
print(" Great .. you are a good programmer")
___________________ : # to be executed at the end
print(" JOB OVER… GO GET SOME REST")Concept: undefined >> undefined
Write the use and syntax for the following method:
open()
Concept: undefined >> undefined
Write a command(s) to write the following lines to the text file named hello.txt. Assume that the file is opened in append mode.
“ Welcome my class”
“It is a fun place”
“You will learn and play”
Concept: undefined >> undefined
Write a Python program to open the file hello.txt used below in read mode to display its contents. What will be the difference if the file was opened in write mode instead of append mode?
“ Welcome my class”
“It is a fun place”
“You will learn and play”
Concept: undefined >> undefined
Write a program to accept string/sentences from the user till the user enters “END” to. Save the data in a text file and then display only those sentences which begin with an uppercase alphabet.
Concept: undefined >> undefined
All the branches of XYZ school conducted an aptitude test for all the students in the age group 14 - 16. There were a total of n students. The marks of n students are stored in a list. Write a program using a user defined function that accepts a list of marks as an argument and calculates the ‘xth’ percentile (where x is any number between 0 and 100).You are required to perform the following steps to be able to calculate the ‘xth’ percentile.
Note: Percentile is a measure of relative performance i.e. It is calculated based on a candidate’s performance with respect to others. For example: If a candidate's score is in the 90th percentile, that means she/he scored better than 90% of people who took the test.
Steps to calculate the xth percentile:
I. Order all the values in the data set from smallest to largest using Selection Sort. In general any of the sorting methods can be used.
II. Calculate index by multiplying x percent by the total number of values, n.
For example: to find 90th percentile for 120 students: 0.90*120 = 108
III. Ensure that the index is a whole number by using math.round()
IV. Display the value at the index obtained in Step 3.
The corresponding value in the list is the xth percentile.
Concept: undefined >> undefined
Write a program that takes as input a list of 10 integers and a key value and applies binary search to find whether the key is present in the list or not. If the key is present it should display the position of the key in the list otherwise it should print an appropriate message. Run the program for at least 3 different key values and note the results.
Concept: undefined >> undefined
Estimate the number of key comparisons required in binary search and linear search if we need to find the details of a person in a sorted database having 230 (1,073, 741, 824) records when details of the person being searched lie at the middle position in the database. What do you interpret from your findings?
Concept: undefined >> undefined
Differentiate between the following statement:
ALTER and UPDATE
Concept: undefined >> undefined
A shop called Wonderful Garments which sells school uniforms maintains a database SCHOOLUNIFORM as shown below. It consisted of two relations - UNIFORM and COST. They made UniformCode the primary key for UNIFORM relations. Further, they used UniformCode and Size to be composite keys for COSTrelation. By analyzing the database schema and database state, specify SQL queries to rectify the following anomalies.
- M/S Wonderful Garments also keeps handkerchiefs of red colour, medium size of Rs. 100 each.
- INSERT INTO COST (UCode, Size, Price) values (7, 'M', 100);
When the above query is used to insert data, the values for the handkerchief without entering its details in the UNIFORM relation are entered. Make a provision so that the data can be entered in the COST table only if it is already there in the UNIFORM table. - Further, they should be able to assign a new UCode to an item only if it has a valid UName. Write a query to add appropriate constraints to the SCHOOLUNIFORM database.
- Add the constraint so that the price of an item is always greater than zero.
Concept: undefined >> undefined
Suppose your school management has decided to conduct cricket matches between students of Class XI and Class XII. Students of each class are asked to join any one of the four teams – Team Titan, Team Rockers, Team Magnet, and Team Hurricane. During summer vacations, various matches will be conducted between these teams. Help your sports teacher to do the following:
- Create a database “Sports”.
- Create a table “TEAM” with the following considerations:
i) It should have a column TeamID for storing an integer value between 1 to 9, which refers to the unique identification of a team.
ii) Each TeamID should have its associated name (TeamName), which should be a string of length not less than 10 characters. - Using table level constraint, make TeamID the primary key.
- Show the structure of the table TEAM using a SQL statement.
- As per the preferences of the students four teams were formed as given below. Insert these four rows in the TEAM table:
Row 1: (1, Team Titan)
Row 2: (2, Team Rockers)
Row 3: (3, Team Magnet)
Row 3: (4, Team Hurricane) - Show the contents of the table TEAM using a DML statement.
- Now create another table MATCH_DETAILS and insert data as shown below. Choose appropriate data types and constraints for each attribute.
| Table: MATCH_DETAILS | |||||
| MatchID | MatchDate | FirstTeamID | SecondTeamID | FirstTeamScore | SecondTeamScore |
| M1 | 2018-07-17 | 1 | 2 | 90 | 86 |
| M2 | 2018-07-18 | 3 | 4 | 45 | 48 |
| M3 | 2018-07-19 | 1 | 3 | 78 | 56 |
| M4 | 2018-07-19 | 2 | 4 | 56 | 67 |
| M5 | 2018-07-18 | 1 | 4 | 32 | 87 |
| M6 | 2018-07-17 | 2 | 3 | 67 | 51 |
Concept: undefined >> undefined
Using the CARSHOWROOM database given in the chapter, write the SQL queries for the following:
- Add a new column Discount in the INVENTORY table.
- Set appropriate discount values for all cars keeping in mind the following:
(i) No discount is available on the LXI model.
(ii) VXI model gives a 10 percent discount.
(iii) A 12 percent discount is given on cars other than the LXI model and VXI model. - Display the name of the costliest car with the fuel type “Petrol”.
- Calculate the average discount and total discount available on Baleno cars.
- List the total number of cars having no discount.
Concept: undefined >> undefined
Among LAN, MAN, and WAN, which has the highest speed, and which one can cover the largest area?
Concept: undefined >> undefined
18 Gbps is equal to how many Bits per second?
Concept: undefined >> undefined
Write a short note on the following:
Bandwidth
Concept: undefined >> undefined
Write a short note on the following:
Data transfer rate
Concept: undefined >> undefined
A composite signal contains frequencies between 500 MHz and 1GHz. What is the bandwidth of a signal?
Concept: undefined >> undefined
