0% found this document useful (0 votes)
57 views26 pages

Q1) Write A Program Using Function To Count Vowels (Names) That Returns The Total No. of Vowels From A List of Names Stored in The List Names'

The document contains 18 questions related to Python programming concepts like functions, classes, exception handling, files, and data structures. The questions cover topics like defining functions, creating classes, using data structures like stacks and queues, file handling, searching and sorting algorithms.

Uploaded by

Satpreet Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views26 pages

Q1) Write A Program Using Function To Count Vowels (Names) That Returns The Total No. of Vowels From A List of Names Stored in The List Names'

The document contains 18 questions related to Python programming concepts like functions, classes, exception handling, files, and data structures. The questions cover topics like defining functions, creating classes, using data structures like stacks and queues, file handling, searching and sorting algorithms.

Uploaded by

Satpreet Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 26

Q1) Write a program using function

to count vowels (names) that


returns the total no. of vowels from
a list of names stored in the list
names.

Q2) Write a program to find sum of


the series
1 + x/2! + x2/3! + x3/4! + . + xn/
(n+1)!

Q3) Write a menu driven


program to find the area of
a square, rectangle or

triangle based on users


choice.

Q4) Define a class with complete


function definitions COMPETITION
with following specifications:
Class attributes:
Event_no as integer
Description as string
Score as integer
Qualified as string

Class Methods:
Cinput() , award() , show()

Q5) Declare a class Transport in python


with the following specifications:
Data members:
Busno To store bus no
Travelfrom to store name of the destination
Btype to store bus type such as O for ordinary , D for
deluxe and S for super deluxe
Distance to store the distance in kilometers
Fare to store the bus fare

Member functions:
Constructor, seatallocate () , _calcfare() ,
showticket()

Q6) Declare a class student that contains


rollno , name and marks of student. It also
contains method acceptdata() and
dispdata() to accept and print detail . Inherit
class scholar that accept all the features of
class student and fathers name . Write a
method printscholar() that print all details of
students that have scored marks greater
than 80.

Q7) Write a menu driven program to sort


a list of elements (in ascending order)
using bubble sort , insertion sort ,
selection sort.

Q8) Write a program to search for


an element using linear search
method.

Q9) Write a program to


search for an element
using binary search
method

Q10) Write a program to create an


array and divide all those element
by 5 which are divisible by 5 and
multiply their remaining elements
by 2.

Q11) Write a program to


perform push and pop
operation in stack.

Q12) Write a program to


insert and delete the
element in a queue.

Q13) Write a program to


enter students rollno ,
name and marks into a file
called Student.txt .
Assume that first field of

the student records


{between rollno and name}
is separated with
comma(,).

Q14) Write a program to


read the contents of
Student.txt file contains
rollno , name and marks
fields. Assume that first
field of the student records
{between rollno and name}
is separated with a
comma(,).

Q15) A binary file


CAMERA.dat containing
the attributes of camera as
given below:
Model no , megapixel , company

Write the code for function


camera_add to enter data into
CAMERA.dat

Write the code for function


camera_search() to search for a camera
from CAMERA.dat according to the
modelno. The function should search and

display the details of the camera.

Q16) Write a program to take an


integer as users input and
the program code should use
exception handling to capture a
possible conversion error . Note that
is the user enter
something other than integer , an
exception is thrown
when the conversion to a number
occurs.

Q17) Write a
program to
generate cubes of
numbers over
time.

Q18) Write a
generator
function to print
Fibonacci series
for first 10 numbers.

You might also like