0% found this document useful (0 votes)
7 views

CS Practical File

Uploaded by

apdps.0158
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

CS Practical File

Uploaded by

apdps.0158
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 36

DELHI PUBLIC SCHOOL

RANIPUR HARIDWAR

PRACTICAL FILE
COMPUTER SCIENCE (083)
SESSION 2024-25

SUBMITTED TO - SUBMITTED BY-

Mr. NADEEM DEBANJAN


BANDOPADHYA
COMPUTER SCIENCE DEPARTMENT
XI-H

27

2012/0332

1
INDEX

S. No. Programs Page Sign


No.
1. Write a program to check whether a person is eligible 5
for voting or not as per the age entered by the user.
2. Write a program to accept a number and display 6
whether the given number is Palindrome or not.
3. Write a program to print the factorial of a number 7
entered by the user
4. Write a program to print the sum of digits of a 8
number given by the user
5. Write a program to check whether the entered 9
number is Armstrong Number or not
6. Write a program to print Fibonacci Sequence upto 10
nth term, accepted from user.
7. Write a program to print the following star pyramid 11-12
pattern using concept of nested loop

a) 1 b) 1 c) 5 d) 1 2 3 4 5
12 22 44 1234
123 333 333 123
1234 4444 2222 12
12345 55555 11111 1

8. Write a program to print the following pattern using 13-14


concept of nested loop

a) * b) * * * * * c) *
** **** **
*** *** ***
**** ** ****
***** * *****

2
9. Write a program to print the following Alphabetical 15-16
pattern using concept of nested loop.

a) A b) A
AB BB
ABC CCC
ABCD DDDD
ABCDE EEEEE
10. Write a program to print the sum of following series upto n th 17
term entered by the user.
1! + 2! + 3! + 4! + ………n!
11. Write a program to accept a character from the user 18
and display whether it is a vowel or consonant.
12. Write a menu –driven program to perform the 19-20
following task according to the user’s choice as given
below:
1- Area of Circle 2- Area of Rectangle 3- Area of
Square
13. Write a program to accept the marks for five subjects 21-22
and calculate the total marks & percentage. Also find
the grade of the student as per following criteria :
Criteria Grade
percentage > 75 A
percentage < 75 && B
percentage >= 60
percentage < 60 && C
percentage >= 45
percentage < 45 && D
percentage >= 33
percentage < 33 Reappear
14. WAP to find the largest and smallest elements in the 23
list of integers entered by the user without using sort()
function.
15. Input a list of numbers and swap elements at the even 24
location with the elements at the odd location.
16. WAP that returns the largest even number in the list of 25
integers. If there is no even number in input, print “No even
number”.
17. Write a program that allow user to enter a list L, where L is 26
the list of numbers(positive, negative and zero). Then create
another list named ‘IndList’ that stores the indices of all
Non-Zero elements of L.
For example:
If the list entered by user L= [12,4,0,11,0,35]
The IndList will have - [0,1,3,5]
18. Write a program to convert small letters into capital letters 27
and vice versa in the string entered by the user.
19. WAP to print the alternate elements of a tuple T 28
entered by the user.
3
20. Write a program to find the frequency of every element of 29
tuple entered by user.
21. Write a program to check whether the tuple entered by 30
you hold the duplicate values or not.
22. Write a python program that inputs two tuples and creates a 31
third that contains all elements of the first followed by all
elements of the second.
23. Create a dictionary with the roll number, name and 32
marks of n students in a class and display the names of
students who have scored marks above 75.
24. Write a program that takes a dictionary ‘Books’ from user 33-34
containing book number and book name and displays the
names in uppercase of those books whose name starts with
a consonant.
For example: Consider the following dictionary
Books = {1:"Python", 2:"Internet
Fundamentals ", 3:"Networking ",
4:"Oracle sets", 5:"Understanding HTML"}
The output should be:
PYTHON
NETWORKING
25. Write a program to print the product of digits of a 35
number given by the user

4
Q1 - Write a program to check whether a person is eligible for voting
or not as per the age entered by the user.

CODE -

OUTPUT –

5
Q2 - Write a program to accept a number and display whether the
given number is Palindrome or not.

CODE -

OUTPUT -

6
Q3 - Write a program to print the factorial of a number entered by the
user.

CODE –

OUTPUT -

7
Q4 - Write a program to print the sum of digits of a number given by
the user.

CODE –

OUTPUT –

8
Q5 - Write a program to check whether the entered number is
Armstrong Number or not.

CODE –

OUTPUT –

9
Q6 - Write a program to print Fibonacci Sequence upto nth term,
accepted from user.

CODE –

OUTPUT –

10
Q7 - Write a program to print the following star pyramid pattern using
concept of nested loop

a) 1 b) 1 c) 5 d) 1 2 3 4 5
12 22 44 1234
123 333 333 123
1234 4444 2222 12
12345 55555 11111 1
CODE –

11
OUTPUT –

12
Q8 - Write a program to print the following pattern using concept of
nested loop

a) * b) * * * * * c) *
** **** **
*** *** ***
**** ** ****
***** * *****

CODE –

13
OUTPUT –

14
Q9 - Write a program to print the following Alphabetical pattern
using concept of nested loop.

a) A b) A
AB BB
ABC CCC
ABCD DDDD
ABCDE EEEEE

CODE –

15
OUTPUT –

16
Q10 - Write a program to print the sum of following series upto nth
term entered by the user.
1! + 2! + 3! + 4! + ………n!

CODE –

OUTPUT –

17
Q11 - Write a program to accept a character from the user and display
whether it is a vowel or consonant.

CODE –

OUTPUT –

18
Q12 - Write a menu –driven program to perform the following task
according to the user’s choice as given below:
1- Area of Circle 2- Area of Rectangle 3- Area of Square

CODE –

19
OUTPUT –

20
Q13 - Write a program to accept the marks for five subjects and
calculate the total marks & percentage. Also find the grade of the
student as per following criteria:
Criteria Grade
percentage > 75 A
percentage < 75 && percentage B
>= 60
percentage < 60 && percentage C
>= 45
percentage < 45 && percentage D
>= 33
percentage < 33 Reappear

CODE –

21
OUTPUT –

22
Q14 - WAP to find the largest and smallest elements in the list of
integers entered by the user without using sort() function.

CODE –

OUTPUT –

23
Q15 – Input a list of numbers and swap elements at the even location
with the elements at the odd location.

CODE –

OUTPUT –

24
Q16 - WAP that returns the largest even number in the list of
integers. If there is no even number in input, print “No even
number”.

CODE –

OUTPUT –

25
Q17 - Write a program that allow user to enter a list L, where L is the
list of numbers (positive, negative and zero). Then create another list
named ‘IndList’ that stores the indices of all Non-Zero elements of L.
For example:
If the list entered by user L= [12, 4, 0, 11, 0, 35]
The IndList will have - [0, 1, 3, 5]

CODE –

OUTPUT –

26
Q18 - Write a program to convert small letters into capital letters and
vice versa in the string entered by the user.

CODE –

OUTPUT –

27
Q19 - WAP to print the alternate elements of a tuple T entered by the
user.

CODE –

OUTPUT –

28
Q20 - Write a program to find the frequency of every element of tuple
entered by user.

CODE –

OUTPUT –

29
Q21 - Write a program to check whether the tuple entered by you hold
the duplicate values or not.

CODE –

OUTPUT –

30
Q22 – Write a python program that inputs two tuples and creates a
third that contains all elements of the first followed by all elements of
the second.

CODE –

OUTPUT –

31
Q23 - Create a dictionary with the roll number, name and marks of n
students in a class and display the names of students who have scored
marks above 75.

CODE –

OUTPUT –

32
Q24 - Write a program that takes a dictionary ‘Books’ from user
containing book number and book name and displays the names in
uppercase of those books whose name starts with a consonant.
For example: Consider the following dictionary
Books = {1:"Python", 2:"Internet Fundamentals ", 3:"Networking ",
4:"Oracle sets", 5:"Understanding HTML"}
The output should be:
PYTHON
NETWORKING

CODE –

33
OUTPUT –

34
Q25 - Write a program to print the product of digits of a number
given by the user.

CODE –

OUTPUT –

35
Thank You!

36

You might also like