You are on page 1of 1

Q1 (A) Write a Python program to read a List A.

Create another List B with the help of corresponding (8)


elements of List A, i.e., if A[n] is zero, B[n] should also be zero, if A[n] is positive, B[n] should
be 1 and if A[n] is negative, B[n] should be -1. Display the both Lists A and B.
For example:
If the content of the List A is –
[45, 0, -4, 6, -3, -34]
Then the content of the B should become –
[1, 0, -1, 1, -1, -1]
OR
Write a Python program to create a dictionary of students where name is the key, marks is the
value. Create another dictionary from the existing one after removing keys containing duplicate
values from the given dictionary.
For example:
If the dictionary is: {‘Amit’: 12, ‘Sim’: 10, ‘Bhawna’: 12, ‘Hari’:13}
New dictionary: {‘Amit’: 12, ‘Sim’: 10, ‘Hari’:13}
(B) Some educational institutes use programming as a tool to measure knowledge level, abilities
and/or skills of their pupils either on a general level or in a specific field of study. The IT
instructor of Genius Academy has given the following questions to his students based on list
manipulations. Help them solve these. Write the output of the following:
(i) str = ‘computer’
print(list(str))
(ii) L=[2, 3, 4, 3, 5, 6, 3, 7, 3, 6, 8]
C=L.count(3)
print(C)
(iii) L=[‘P’, ‘Y’, ‘T’, ‘H’, ‘O’, ‘N’]
print(L.pop())
(iv) L1 = [20, 40, 30, 50]
L2 = [6, 8, 9, 10]
Print(L1+L2)
Q2 Consider the following table name ‘SOFTDRINK’. (7)
Table: SOFTDRINK
DRINKCODE DNAME PRICE CALORIES
101 Lime and Lemon 25.00 120
102 Apple Drink 20.00 120
103 Nature Nectar 18.00 115
104 Green Mango 15.00 140
Based on the data given above, answer the following questions:
(i) Identify the most appropriate column which can be considered as Primary Key.
(ii) If two more columns and rows are added in the table SOFTDRINK, what will be the
new degree and cardinality of the above table?
Write SQL command or query for the following:
(i) Display DRINKCODE, DNAME with Price in the range of 15 and 20.
(ii) Display details of all the records in descending order of their price.
(iii) Insert a new row in the table with data as (105, Mango Juice Bahaar’)
Note: Student should use their own name, class and rollno to create a new database. For
example, if student’s name is Ramesh, studying in 11-B and the rollno is 42, then name of the
database will be Ramesh11B42.

You might also like