0% found this document useful (0 votes)
5 views3 pages

Python and MySQL Programming Tasks

The document contains a series of programming questions focused on Python and MySQL, covering topics such as menu-driven programs, data manipulation, file handling, and database operations. Each question requires writing specific code to perform tasks like displaying non-prime numbers, handling student records, and executing SQL queries. The questions aim to test the understanding and application of programming concepts and database management.
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)
5 views3 pages

Python and MySQL Programming Tasks

The document contains a series of programming questions focused on Python and MySQL, covering topics such as menu-driven programs, data manipulation, file handling, and database operations. Each question requires writing specific code to perform tasks like displaying non-prime numbers, handling student records, and executing SQL queries. The questions aim to test the understanding and application of programming concepts and database management.
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

Questions

PYTHON

Q1. Write a python code for a menu driven program for the following:
(i) To display all non-prime numbers between two numbers.
(ii) To display Fibonacci series till nth term.
(iii) To display the LCM of three integers.

Q2. A school wants to make an online application form on website for registration of students who want
to apply for the various posts of school leaders. The form requires First Name, Last Name and Post.
Write a python code for a menu driven program for the following tasks:
(i) Display all the correct entries. (those names whose first letters of First Name, Last Name and Post are
in capital letters)
(ii) Display all the incorrect entries.

Q3. Write a python program to perform the following operations on a list:


(i) Insert an item on selected index.
(ii) Delete the item on selected index.
(iii) Count and display different types of data.

Q4. Write a python code to rotate the elements of a list, i.e., the last element moves to second, the first
element moves to second, second element moves to third and so on.
Also give choice to the user for the direction of the rotation. (Left or Right)

Q5. Write a menu driven python program using dictionary which contains the following data- Roll no. as
key and Name & Marks as values and do the following operations:
(i) Adding records to dictionary.
(ii) Displaying all the records in tabular form.
(iii) Search record by Roll no. and update Name and Marks.
(iv) Search by Roll no. and delete the record.

Q6. Write a menu driven python program for Bubble Sort and Selection Sort using a list.

Q7. Write a python program to enter numbers in a list of integers and do Linear Search and Binary
Search.

Q8. Write a python program to show and count the number of lines in a text file ‘[Link]’ which start
with the word ‘The’ or ‘the’.

Q9. Write a python program to read data from file ‘[Link]’ and display each word with number of
vowels and number of consonants.

Q10. Write a program to enter records of students (Format: [Roll no., Name, Average marks]) in a file
‘[Link]’ and display the records of all the students who have passed. (Passing Marks: 51 and above)
Questions
Q11. Write a python program to enter records of employees (Format: [emp no., ename, sal]) and display
the records of the employees who are getting salary between Rs.20000 and Rs.40000.

Q12. Write a python program to make a quiz of guessing a number from a given range. If the number is
matched with the number entered by the user then display ‘Congratulations! You guessed it right!’
otherwise display ‘You guessed it wrong! Try Again!’.

Q13. Write a python program to illustrate push, pop, display in stack.

Q14. Write a python program that asks the user to enter a sentence and then writes that sentence in a
file ‘[Link]’ and displays all the content on the file.

Q15. Write a python program that asks the user for a file name if the file exists then prints the first line
in the file and if it doesn’t exist then it displays ‘ERROR! File Not Found!’

MySQL

Q16. Display all records from a table empl.

Q17. Display the records of the students who have scored more than 90 marks from a table marks.

Q18. Display the records of the students having ‘H’ as first letter of their name from a table student.

Q19. Display all records of the employees from a table empl having salary more than 10000.

Q20. Update the salary of an employee named ‘Jaykrishnan’ by increasing the salary by 10% in a table
empl display the updated table.

Q21. Create a table teachers with columns name , class , sec , salary and add records of 3 teachers.

Q22. Create a table empl having columns ename , job , depno and sal and add records of 3 employees
and display the records.

Q23. Create a table student having columns sname , class , roll number and age and add records of 3
students.

Q24. Display the records of the students who are older than 18 from a table student.

Q25. Display the records of the students who have scored less than 60 marks from a table marks.

Q26. Display all the records from the table student.

Q27. Display all the records from a table marks.

Q28. Alter a table empl and change the column sal into ‘salary’ and display the altered table.
Questions
Q29. Increase the salaries of all the employees by 5% in a table empl and display the updated table.

Q30. Alter a table empl and change the column job into designation and display all records.

You might also like