You are on page 1of 7

HOLIDAY ASSESSMENT (2023-2024)

CLASS:XII SUBJECT: Computer Science

S.NO DATE QUESTIONS

1. Write a python program to check if a number is odd or even


2. Write a python program to display the multiplication table
3. Write a python program to find the sum of natural numbers
4. Write a python program to calculate the compound interest
5. Consider the String s= “CHANDRAYAAN2”. Write the
statement in Python to implement the following.
1 02.05.23
a)To display the string “CHAND”
b)To display the last four characters .
c)To repeat the string 2 times.
d)To display the output “CADAAN”
e)To display the substring “CHANDRA” in one line and “YAAN2” in
second line
1. Write a program to take in the marks of 5 subjects and display
the grade.
2. Write a python program to calculate the factorial of a numbers
3. Write down Python program to check whether a given character
is an uppercase or a lowercase character or a digit
4. Write a Python program a python program to check whether a
number is a prime or not.
2 03.05.23 5. Write a Python Program to print the following pattern .
1. Consider the list

L1 = [„Rohit‟, 12, „Manisha‟, 30 ]

L2 = [ „Sarika‟, 54 ]

What will be the output of the following?

print (L1 + L2)

L2 += L1

print( L2)

print (L2 * 2)

print (54 in L2)

print („Manisha‟ not in L1)

2. What will be the output of the following Python code?

x = 'abcd'
3 04.05.23
for i in range(len(x)):
print(i)
3. Write the output of following code:

p=8.6

q=12

r=15

s=450

print(int(p)+q*2)

print(p/2)

print(s//r)

print(float(10+int(p)%5))

print(r%4//2)
4. What will be the output of the following Python code?

myList = [1, 5, 5, 5, 5, 1]
max = myList[0]
indexOfMax = 0
for i in range(1, len(myList)):
if myList[i] > max:
max = myList[i]
indexOfMax = i
print(indexOfMax)
5. What will be the output of the following Python code?
A = [[1, 2, 3],[4, 5, 6], [7, 8, 9]]
print(A[1])

1. Explain about conditional statements with example program.


2. Explain about Looping statements with example program.
3. What is primary key in a table?
4. Define database management system(DBMS)?
4 05.05.23
5. Explain the following list methods with an example.

a) append() b) extend() c) insert() d) index() e)


sort()

1. Explain about DDL and DML statements with example

2. Explain about break and continue statements with example


program.

3. Write for loop to display “ICC WORLD CUP 2020” letter by


letter

4. Write a for loop to display first 10 even numbers in reverse order


5 06.05.23

5. Write python code for following.

a)To calculate area of circle

b)To calculate Division ,percentage and total marks of 5 subject


of any student assume that max marks for each subject is 100.
And division as per criteria given below
Percentage Division

60>= First

<60 but >=45 second

<45 but >=33 third

< 33 Fail

1. How are dictionaries different from lists ?


2. What is the output of the following of code?
a = { j : j * 2 for j in range(1,10,2)}

print (a)

3. Write a SQL statement to create a table named jobs including


columns job_id, job_title, min_salary, max_salary
4. Write a program to input your friend‟s names and their Phone
6 08.05.23 Numbers and store them in the dictionary as the key-value pair.
Perform the following operations on the dictionary:
a) Display the name and phone number of all your friends
b) Add a new key-value pair in this dictionary and display the
modified dictionary
c) Delete a particular friend from the dictionary
d) Modify the phone number of an existing friend
e) Check if a friend is present in the dictionary or not

1. Start with the list[8,9,10]. Do the following using list functions


(a) Set the second entry (index 1) to 17

(b) Add 4, 5 and 6 to the end of the list.

(c) Remove the first entry from the list.

7 09.05.23 (d) Sort the list.

(e) Double the list.

(f) Insert 25 at index 3

2. What is the output of the following program?


list1 = ['physics', 'chemistry', 1997, 2000]
list2 = [1, 2, 3, 4, 5, 6, 7 ]
print "list1[0]: ", list1[:-4] #statement 1
print "list1[0]: ", list1[-2] #statement 2
print "list1[-2]: ", list1[1:] #statement 3
print "list2[1:5]: ", list2[1:5] #statement 4
3. How many Aggregate functions are available in SQL?
4. Write a query to show the details of a student from Students table
whose name start with K?

Fill in the Blanks:


1. Strings are immutable in Python, which means a string cannot
be__________
2. ___________ method used to convert String "Welcome to the
Beautiful World of PYthon" to "Welcome to the beautiful world
8 09.05.23 of python"
3. _________________are the reserved words in python.
4. The elements in ___________ are stored as key–value pairs.
5. ___________function checks that all characters of a string are
in upper case.

Predict the output of the following Python Programs:


1. nameList = ['Harsh', 'Pratik', 'Bob', 'Dhruv']

print(nameList[1][-1])
2. sum = 0

for i in range(12,2,-2):
sum+=i
print( sum)
9 10.05.23
3. n=50

i=5
s=0
while i<n:
s+=i
i+=10
print("i=",i)
print ("sum=",s)
4. for i in range(1,6):

for j in range(1,i+1):
print(i, end=" ")
print('\n')

5. n=5

for i in range(1,n+1):
print("*"*i)
for i in range(n-1,-1,-1):
print("*"*i)

1. Python program to print even numbers in a list


2. Python program to check whether the input character is an
alphabet
3. Write a program to take an integer a as an input and check
10. 11.05.23 whether it ends with 4 or 8. If it ends with 4 print “ends with
4”, if it ends with 8, print “ends with 8”, otherwise print “ends
with neither”.
4. Difference between Delete and Drop in SQL
5. Explain about Constrains

1. Explain the string function with an example.

2. Write a python program to count the word “ he “ in a text file


“ram.txt‟.

3. Differentiate read() and readlines().


11 12.05.23

4. Write a Python program to find the number of lines in a text


file “abc.txt‟

5. What is SQL?

1. What is IDLE?
12 13.05.23
2. Define Variable
3. How will you convert a string to an integer in python?

4. What are the two modes in Python ?

5. Define String data type with example.

NOTE:

*Submit return copy of all the home works on the school reopen day

* Test will be conducted from the above portions in the first week of June.

You might also like