19CS403 PYTHON LAB EXAM Questions
19CS403 PYTHON LAB EXAM Questions
Evaluation
Evaluation Evaluation Criteria Marks
Component
Program 1 Write up 05
Execution 10
Program 2 Write up 05
Execution 20
Viva-Voce 10
Total 50
PART-A
Q. Question Description CO
No
1 Build a program called “GuessMyNumber”. The computer will generate a random 1
number between 1 and 10. The user types in a number and the computer replies
“lower” if the random number is lower than the guess, “higher” if the random number
is higher , and “correct!” if the guess is correct. The player can continue guessing until
the guess is right.
2 Write a python program to create two separate lists of integers. List elements of both 1
the list shall be read from keyboard input. Program should display “Lists are
symmetrical” if both the lists contain equal number of even and odd numbers.
3 Write a Python program to generate first ‘n ’Fibonacci numbers. 1
4 Given below is the list of marks scored by students. Find top three scorers for 2
the course and also display the average marks scored by all students.
Implement the solution using Python Programming.
Student Marks
Name
John 86.5
Jack 91.2
Jill 84.5
Harry 72.1
Joe 80.5
(ISO 9001:2015 Certified)
Accredited with ‘A’ Grade by NAAC
Department of Computer Science and Engineering
5 Write a program to count the number of capital letters and display the position of each 2
capital letter in a user entered string via keyboard.
6 Write a program to count the number of each vowel in a given string. 2
7 Write a program to remove all punctuations like “’!()-[]{};:’’’,\,<>,/,?,@,#,$,%^&*_~” 2
from the string provided by the user.
8 Consider two strings, String1 and String2 and display the merged string 2
as output. The merged string should be the capital letters from both the
strings in the order they appear.
Sample Input:
String1:ILikeC
String2:MaryLikesPython
Merged string should be ILCMLPS
Scenario: There are 10 students and answers to 10 multiple choice questions of each student is stored
in a file called marks.txt. Each answer is delimited by space. Each line provides a student’s answers
to the questions, as shown below. The answer key is stored in a file named keys.txt. The format of
answer keys as shown below.
Key D B D C C D A E A D
Marks.txt
Student0 A B A C C D E E A D
Student1 D B A B C A E E A D
Student2 E D D A C B E E A D
Student3 C B A E D C E E A D
Student4 A B D C C D E E A D
Student5 B B E C C D E E A D
Student6 B B A C C D E E A D
Student7 E B E C C D E E A D
Student8 C B A E D C E E A D
Student9 A B D C C D E E A D
(ISO 9001:2015 Certified)
Accredited with ‘A’ Grade by NAAC
Department of Computer Science and Engineering
15 Write a program to create a list to maintain country names, respective capital and its population. The 3
program should support following operations
16 CIE and SEE marks of Ten students for 3rd semester is stored in a CSV file. Marks details are 4
stored in a worksheet and the format of marks details is shown below. The worksheet
provides CIE and SEE marks for the courses CS301 TO CS306. Perform data analysis using
numpy, pandas, matplotlib python libraries for the following scenarios.
a) Display the subject code with highest avg score in the semester
b) Visualize each student’s avg CIE and avg SEE for 3rd sem using a bar chart graph.
Sample chart is shown below.
(ISO 9001:2015 Certified)
Accredited with ‘A’ Grade by NAAC
Department of Computer Science and Engineering
17 CIE and SEE marks of Ten students for 3rd semester are stored in a CSV file. Marks details 5
are stored in a worksheet and the format of marks details is shown below. The worksheet
provides CIE and SEE marks for the courses CS301 TO CS306. Perform data analysis using
numpy, pandas, matplotlib python libraries for the following scenarios.
a) Display the usn with highest total score.
b) Visualize grade analysis (No of students with S,A,F grades) for each subjects using a
bar chart graph. Sample chart is shown below.
Grade calculation: S : CIE + SEE >=90
18 Placement data distribution across various branches and companies is shown in the table 5
below for the academic year 2020.Perform data analysis using numpy, pandas, matplotlib
python libraries for the following scenarios.
a) Display the branch name with highest no of total placements across all the companies.
b) Display the company name with highest no of total placements across all the branches.
c) Display branch name and company name having highest no of placements.(e.g,’CSE’-‘DXC’)
d) Draw a pie chart showing distribution of total placements across all the branches.
e) Draw a pie chart showing distribution of total placements across all the companies.
Cap- Hexa TCS Hack-
Mind- gemi Acce- - Code- TCS Cogni- with Infosys
Branch DXC Tree ni nture ware vita Ninja zant Infy (CRP)
Civil 2 1 1 1 1
Mech. 15 1 1 7 2 6
E&E 9 4 6 4 1 3 4 5
E&C 34 18 39 22 3 2 15 10 23
CSE 76 66 34 44 4 5 10 13 6 21
ISE 39 28 16 20 4 9 9
BT 2
MCA 9 5 1 3 1 2