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

Python Questions For Beginners

Python questions you need to practice!

Uploaded by

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

Python Questions For Beginners

Python questions you need to practice!

Uploaded by

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

Q1. Write a program which finds the sum of digits of a number.

[10]

Q2.Create a class Student having members – rollno, name, age, gender accept n numbers of
record from user. Create a subclass called―Test with member marks of 3 subjects. Create three
objects of the Test class and display all the details of the students with total marks.
[15]

Q3. External Viva [05]


Q1. Write a program to calculate the factorial of a number. [10]

Q2.Write a Python program to count the frequency of each character in a given string using a
user defined function. [15]

Q3. External Viva [05]


Q1. Write a program which finds all factors of a number. [10]

Q2. Write a Python program to accept string and remove the characters which have odd index
values of a given string using a user defined function. [15]

Q3. External Viva [05]


Q1. Write a program to accept 5 numbers and calculate its Mean value [10]

Q2. Define a class Employee having members – id, name, department, salary. Create a subclass
called ―Manager‖ with member bonus. Define methods accept and display in both the classes.
Create n objects of the Manager class and display the details of the manager having the
maximum total salary (salary+bonus). [15]

Q3. External Viva [05]


Q1. Write a program which reverses a string and displays both original and reversed string. [10]

Q2.Write a program to create tuple of n numbers, print the first half values of tuple in one line
and the last half values of tuple on next line. [15]

Q3. External Viva [05]


Q1. Write a program which accepts 10 integers and prints "DUPLICATES" if any of the values
entered are duplicates otherwise prints "ALL UNIQUE". [10]

Q2.Define a class Person having members – name, address. Create a subclass called Employee
with member staffid,, salary. Create ‘n’ objects of the Employee class and display all the details
of the Employee. [15]

Q3. External Viva [05]


Q1. Write a Python program to accept two lists and merge the two lists into list of tuple. [10]

Q2.Define a class Employee having members – id, name, department, salary. Create a subclass
called ―Manager with member bonus. Define methods accept and display in both the classes.
Create n objects of the Manager class and display the details of the manager having the
maximum total salary (salary + bonus). [15]

Q3. External Viva [05]


Q1. Write a program which accepts an integer value 'n' and prints all prime numbers till 'n'. [10]

Q2.Define a class Student having members – rollno, name, age, gender. Create a subclass called
―Test with member marks of 3 subjects. Create three objects of the Test class and display all the
details of the student with total marks. [15]

Q4. External Viva [05]


Q1. Write a program to count the number of characters in a string. [10]

Q2.Write a python program to create class family.also perform subclass using multilevel
inheritance.accept and display the details of class. [15]

Q3. External Viva [05]


Q1. Write a program to create user defined module. [10]

Q2.Create a class Student having members – rollno, name, age, gender accept n numbers of
record from user. Create a subclass called―Test with member marks of 3 subjects. Create three
objects of the Test class and display all the details of the students with total marks and
percentage..

[15]

Q3. External Viva [05]


Q1. Write a Python program to accept n numbers in list and remove duplicates from a list.[10]

Q2. Write a python program to create a user defined package for students.
[15]

Q3. External Viva [05]


Q1. Write a program which finds the sum of digits of a number. [10]

Q2. Write a Python script to generate and print a dictionary that contains a number (between 1
and n) in the form (x, x*x).

Sample Dictionary (n = 5)
Expected Output : {1: 1, 2: 4, 3: 9, 4: 16, 5: 25} [15]

Q3. External Viva [05]


Q2. Write a Python program to accept n numbers in a list and find maximum and minimum
from list. [10]

Q2.Write a python program to create a user defined package. [15]

Q3. External Viva [05]


Q1. Write a program to find the repeated items of a tuple. [10]

Q2.Define a classTeacher having members – name, address. Create a subclass called


―Staff with member staffid, salary. Create three objects of the staff class and display all the
details of the Staff.
[15]

Q3. External Viva [10]


Q1. Write a program which checks whether an element exists within a tuple. [10]

Q2. Write python program using an Lambda function to find area of circle, circumference of circle
[15]

Q3. External Viva [10]


Q1.Write python program to accept and print string in reverse order using function. [10]

Q2.Write a Python Program to Create a Class which Performs Basic Calculator Operations. [15]

Q3. External Viva [05]


Q1. Write a Python program to check if a given key already exists in a dictionary. If a key
exists, replace it with another key/value pair. [10]

Q2. Write a program to accept a number 'n', and display the following pattern (Floyd's
triangle)n=3
1
23
456
[15]

Q3. External Viva [05]


Q1. Write python program using an anonymous function to find area of circle, circumference of
circle. [10]

Q2.Define a class named Shape and its subclass (Square/Circle). The subclass has an init
function which takes an argument (length/redious). Both classes have an area and
volume function which can print the area and volume of the given shape.
[15]

Q3. External Viva [10]


Q1. Write a program to accept a number and display its first ten multiples. [10]

Q2.Python Program to Create a Class in which One Method Accepts a String from the User
and Another method Prints it. Define a class named Country which has a method called
printNationality. Define subclass named state from Country which has a method called
printState . Write a method to print state, country and nationality. [15]

Q3. External Viva [05]


Q1. Write a program to accept 10 numbers, display the sum of odd numbers and sum of even
numbers. [10]

Q2. Write a program to accept a number 'n', and display the following pattern:
1
123
1234
12345 [15]

Q3. External Viva [05]


Q1. Write a program to check whether input number is divisible by 3 or 5 or both. [10]

Q2. Write a program to read a file convert the lowercase character to uppercase and write them to
another file, display another file.
[15]

Q3. External Viva [05]

You might also like