Worksheets
Worksheets
4. Python is free and open source language. here, what is free and open source?
a=20
b=a+1
a=33
print(a+b)
a=20
print(a)
b=33
print(b)
6. What is wrong with following code fragment?
name="freya"
classs=4
print(name+classs)
a,b=3,4
a,b,c=b,a+3,b-1
print(a,b,c)
a,b=3,4
c,a=b*4,a+4
print(a,b,c)
print(9//2)
a,b=5,6
a,b,c=10,b,a
a,b,c=c/2,a+4,b*6+2
print(a)
print(b)
print(c)
_________________________________________________
MEDI-CAPS INTERNATIONAL SCHOOL
6.CONDITIONAL AND ITERATIVE STATEMENTS
WORKSHEET
1.What is the use of range() function in python?
2.Else clause is available with if as well as loop construct, can you differentiate the use of else in
both.
x = ['dc', 'ba']
for i in x:
i.upper()
print(x)
x = 321
for i in x:
print(i)
print (i)
MEDI-CAPS INTERNATIONAL SCHOOL
7.STRING MANIPULATION/TEXT HANDLING
WORKSHEET
1. What is the output of the following Python program section?
st='Computer Science'
x=st.lower()
y=x.replace('computer','Computer')
print(y)
2. What would be printed from the following Python program section?
txt='computer science and informatics practices'
words=txt.split(' ')
l=len(words)
print (l)
3. What would be printed from the following Python program section?
st=['C','o','m','p','u','t','e','r']
w=''.join(st)
print(w)
4. Write a Python program to calculate the length of a string
5. Write a Python program to count the character frequency in a string
6. What is the output of the following?
my_string = "python"
i = "i"
while i in my_string:
print(i, end =" ")
25. What is the output of the following?
my_string = "python"
for i in range(my_string):
print(i)
7. What is the output of the following?
my_string = 'python'
for i in range(len(my_string)):
my_string[i].upper()
print (my_string)
8. Write a Python program to Check Whether a String is Palindrome or Not
MEDI-CAPS INTERNATIONAL SCHOOL
8.LIST MANIPULATION
WORKSHEET
1. Write difference between append() and extend() methods of list.
a=[101,123,561,[178]]
b=list(a)
a[3][0]=915
a[1]=134
print(b)
a=[132,526,127]
a.append([827])
a.extend([425,627])
print(a)
MEDI-CAPS INTERNATIONAL SCHOOL
9.DICTIONARIES
WORKSHEET
1. Is dictionary more useful than list,if yes then how?
5. Read the code shown below carefully and pick out the keys?
6. Suppose dict = {'freya':10, 'mohak':1},to delete the entry for “freya” what
print('amit' in dict)
del dict[1]
dict[1] = 'D'
del dict[2]
print(len(dict))
dict ={}
dict['dict']= 1
dict['b']=[2, 3, 4]
print(dict)
MEDI-CAPS INTERNATIONAL SCHOOL
9.MODULE
WORKSHEET
1. What is module in python?
6. Define a module factorial with a function factcal which accept a number and
print(math.factorial(5))
10.PANDAS
WORKSHEET
1. Name a few libraries in Python used for Data Analysis and Scientific computations.
2. What is the main difference between a Pandas series and a single-column DataFrame in
Python?
4. Can we create a DataFrame with multiple data types in Python? If yes, how can we do it?
11. How we can delete Indices, Rows or Columns From a Pandas Data Frame
csv file?
5. Write python code to Create a dataframe with name and dob of three person and
6. Write python code to read csv file into dataframe and then display the contents of
this dataframe.
9. Write the names of two important modules required to interact with sql databases
with dataframe
MEDI-CAPS INTERNATIONAL SCHOOL
11.RELATIONAL DATABASE CONCEPTS
WORKSHEET
1. What is database?
2. What is dbms?
3. What is RDBMS?
a. Tuple
b. Relation
c. Attribute
d. Entity
e. Cardinality
f. Degree
7. A table “Transport” in a database has degree 3 and cardinality 8. What is the number of rows
10. A table STUDENT has 4 rows and 2 columns and another table TEACHER has 3
row and 4 columns. How many rows and columns will be there if we obtain the
3. Write SQL command to create the table VEHICLE with given constraint:
Table : VEHICLE
Regdate DATE
Owner VARCHAR(30)
Address VARCHAR(40)
4. Write MySQL command to create the table “Toyz” with the following
Table : TOYZ
Tou_name Varchar(20)
Type Char(10)
Price Decimal(8,2)
Colour Varchar(15)
5. Write MySQL command to create the Table ‘LIBRARY’ with given constraints.
Table: LIBRARY
Type Char(4)
Author Varchar(40)
No_Copies Int(6)
Price Decimal(8,2)
6. Consider the table EXAM given below. Write commands in MySql for(i) to (iv)
Table: EXAM
(i) To list the names of those students, who have obtained Division as FIRST in
(ii) To display a report listing NAME, SUBJECT and Annual stipend received
(iii) To count the number of students, who have either accounts or informatics as
subject.
6,”Mohan”,500,”English”,73,”Second”
7. Consider the following table names EXAM with details of marks. Rite
command of MySQl for (i) to (IV) and Output for (v) to (Vii).
Table : EXAM.
of percentage.
(ii) To display Adno, Name, Percentage and Stream of those students whose
(iii) To add another column Bus)Fees with datatype and size as decimal (8,2).
(vi) SELECT Sname, Percentage FROM EXAM WHERE Name LIKE “N%”;
8.In a database there are two tables: Table ITEM: Table BRAND:
(i) To display ICode,IName and corresponding Brand of those Items, whose price
(ii) To display ICode, Price and BName of the item which has IName as“Television”?
6. What is cybercrime?
7. What is virus?
8. What is phishing?
a. Spyware
b. Spam
c. Pc intrusion
d. Adware
e. Denial of services
f. Sweeper attacks