12 CS Worskheet
12 CS Worskheet
12 CS Worskheet
SECTION-B
Q1. What is sorting? Name some sorting techniques.
Q2. Why do number-of-comparisons reduce in every successive iteration in bubble sort?
Q3. What is the basic principle of sorting in insertion sort ?
Q4. Number of operations wise, compare bubble sort and insertion sort techniques
Q5. What is the main difference between Bubble sort and Insertion sort techniques?
Q6. Write a program in python to sort data using bubble sort.
Q7. Write a program in python to sort data using insertion sort.
Q8. What are the steps to sort a list using bubble sort.
Assume list a=[12,3,15,6,22,2]
Q9. What are the steps to sort a list using bubble sort.
Assume list a=[11,13,23,15,6,22,2]
Q10. If a is (1, 2, 3)(a) what is the difference (if any) between a * 3 and (a, a, a)? (b) is a * 3 equivalent to
a + a + a ? (c) what is the meaning of a[1:1] ?(d) what is the difference between a[1:2] and a[1:1] ?
Q11. Does the slice operator always produce a new tuple ?
Q12. The syntax for a tuple with a single item is simply the element enclosed in a pair of matching
parentheses as shown below : t = ("a") Is the above statement true? Why? Why not ?
Q13. Are the following two assignments same ? Why / why not ? (b) T3 = (3, 4, 5) T4 = ((3, 4, 5)) (a) T1 =3,
4, 5 T2 = (3,4 ,5)
Q14. What would following statements print? Given that we have tuple = ('t', 'p', 'I') (a) print("tuple") (b)
print(tuple(“tuple")) (c) print (tuple)
Q15. How is an empty tuple created?.
Q16. How is a tuple containing just one element created?
Q17. What is a function? How is it useful?
Q18. A program having multiple function is considered better designed than a program without any
function. Why?
Q19. What is an argument? Give an example.
Q20. What is Python module? What is its significance?
Q21. What is Python library? Explain with example.
Q22. Write a program to calculate the following using modules:
(a) Energy = m * g * h (b) distance = ut + + 1/2at2 (c) Speed = distance / time
Q23. Write a module to input total number of days and find the total number of months and remaining
days after months, and display it in another program.
Q24. Write a program to calculate the volume and area of a sphere inside separate modules and import
them in one complete package.
Volume = 4/3πr3
Surface Area = 4πr2
Q25. How do you reuse the functions defined in a module in your program?
Q26. What is a module? What is the file extension of a Python module?
Q27. How do you reuse the functions defined in a module in your program?
Q28. In how many ways can you import objects from a module?
Q29. How are following import statements different?
(a) import math
(b) from math import *
Q30. How does Python resolve the scope of a name or identifier?
Q31. How are keywords different from identifiers?
Q32. Differentiate between mutable and immutable objects in Python language with example.
Q33. What are literals in Python? How many types of literals are allowed in Python?
Q34. How many ways are there in Python to represent an integer literal?
Q35. What are data types? What are Python's built-in core data types?
Q36. What do you understand by the term Iteration?
Q37. What is indexing in context to Python strings? Why is it also called two-way indexing?
Q38. What is a string slice? How is it useful?
Q39. Write a program that reads a string and checks whether it is a palindrome string or not.
Q40. How are lists different from strings when both are sequences?
Q41. How many types of strings are supported in Python?
Q42. Write a program to accept values from a user in a tuple. Add a tuple to it and display its elements
one by one. Also display its maximum and minimum value.
Q43. What is a module list? Give at least two reasons why we need modules.
Q44. How do you create your own package in Python?
Q45. What is the difference between import statement and from import statement?
Q46. Define 'module' and 'package'.
Q47. Write a method in Python to find and display the prime numbers between 2 to N. Pass argument to
the method.
Q48. Write a program with a user-defined function with string as a parameter which replaces all vowels
in the string with "*".
Q49. What is the utility of built-in function help()?
Q50. Name the Python Library modules which need to be imported to invoke the following functions:
(i) sin() (ii) randint ()
Section C
Q1. Design the synopsis documentation of project from the following topics.
School Management System
Library Management System
Airline Booking System
Payroll Management System
Hotel Management System
Hospital Management System