Sunteți pe pagina 1din 13

Q1. Write a program to sort a sequence using insertion sort.

Illustrate with example.

OUTPUT
Q2. Write a program to sort a sequence using bubble sort.

Illustrate with example.

OUTPUT
Q3. Write a program that repeatedly asks user to enter product

names and prices. Store all them in dictionary whose keys are product
names and values are prices. Allow them to repeatedly enter the

product name and print price or message if product isn’t in dictionary.

OUTPUT
Q4. Write a program that takes a value and check whether it is in part
of dictionary or not .If it is, it should print corresponding value or print
error message.

OUTPUT
Q5. Write a program that inputs 2 tuples seq_a and seq_b and prints
true if every element in seq_a is also in seq_b else print false.

OUTPUT
Q6. Write a program that interactively creates nested tuple to store the
marks in 3 subjects of 5 students.

OUTPUT
Q7. Write a program to find minimum element from list of element
along with its index in list.

OUTPUT
Q8. Write a program to calculate the mean of given list of numbers.

OUTPUT
Q9. Write a program to ask user enter the strings. Create new list

that contains of those strings with their first character removed.

OUTPUT
Q10. Write a program that takes any 2 lists of same size and adds
their elements to form a new list whose elements are sum of elements
in 2 lists.

OUTPUT
Q11. Given following relation of students.

RELATION: Student
NO. NAME AGE DEPART- DATE FEE SEX
MENT OF ADM
1. Pankaj 24 Computer 10/01/97 120 M
2. Shalini 21 History 24/03/98 200 F
3. Sanjay 22 Hindi 12/12/96 300 M
4. Indu 25 History 01/02/99 400 F
5. Rakesh 22 Hindi 25/09/97 250 M
6. Shakeel 30 Hindi 27/06/98 300 M
7. Surya 34 Computer 25/02/97 210 M
8. Shikha 23 Hindi 31/02/97 200 F

1. SELECT count (DISTICT department ) FROM student;


2. SELECT max age(AGE) FROM student WHERE (sex=F);

3. SELECT avg(FEE) FROM student WHERE (date of adm<


01/01/98);

4. SELECT sum(FEE) FROM student WHERE(date of adm<

01/01/98);
5. SELECT * FROM student ORDER BY AGE desc;
Ans. 1.
SELECT count (DISTICT department ) FROM student

3
2.

SELECT max age(AGE) FROM student WHERE (sex=F)


25
3.

SELECT avg(FEE) FROM student WHERE (date of adm<


01/01/98)
216
4.

SELECT sum(FEE) FROM student WHERE(date of adm< 01/01/98)


1080
5.

NO. NAME AGE DEPART- DATE FEE SEX


MENT OF ADM
7. Surya 34 Computer 25/02/97 210 M
6. Shakeel 30 Hindi 27/06/98 300 M
4. Indu 25 History 01/02/99 400 F
1. Pankaj 24 Computer 10/01/97 120 M
8. Shikha 23 Hindi 31/02/97 200 F
5. Rakesh 22 Hindi 25/09/97 250 M
3. Sanjay 22 Hindi 12/12/96 300 M
2. Shalini 21 History 24/03/98 200 F
Q12. 1. Create table as per following table instance chart.
Cust_ID Cust_Name Cust_add1 Cust_add2 Pincode Cust_ph.
NUMBER VARCHAR VARCHAR VARCHAR NUMBER VARCHAR
7 30 20 30 6 10

2. Add 1 column Email of data type VARCHAR and size 30 to the

table.

3. Add one more column CustomerIncomeGroup of datatype

VARCHAR(10).

4. Drop the column CustomerIncomeGroup from the table customer.

Ans. 1. CREATE table Customer(Cust_ID INTEGER (7), Cust_Name


VARCHAR(30), Cust_Address1 VARCHAR(20), Cust_Address2 VARCHAR(30),

Pincode INTEGER(6), Cust_Phone VARCHAR(10)) ;

2. ADD (Cust_Email VARCHAR(30));

3. ADD(CustomerIncomeGroup VARCHAR(10));

4. ALTER Table Customer DROP COLUMN CustomerIncomeGroup ;

S-ar putea să vă placă și