21EC643 - Question Bank 1 for Modules 1 to 4

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

21EC643 Question Bank

1. List and explain the significant features of Python Programming Language.


2. Describe the Python functions int ( ), float ( ) and str ( ) with example
3. Write the math operators in Python from highest to lowest Precedence with an
example for each. Write the steps how Python is evaluating the expression (5 - 1) *
((7 + 1) / (3 - 1)) and reduces it to a single value.
4. List and explain the different comparison and Boolean operators, along with
examples.
5. Write a program to find the factorial of a number using a function
6. Explain the local and global scope of the variable with a suitable example.
7. What is a list? Explain the concept of list slicing and list traversing with an example.
8. Discuss the methods that are used to delete items from the list
9. For the following three questions, let’s say spam contains the list ['a','b', 'c', 'd',[3,4]]. i.
What does spam[int('3' * 2) / 11] evaluate to? ii. What does spam[-2] evaluate to? iii.
What does spam[4][1] evaluate to?
10. Compare and contrast tuples with lists. Explain the following operations in tuples i.
Sum of two tuples ii. Slicing operators iii. Compression of two tuples iv Assignments
to variables
11. What is a dictionary? How is it different from List? Write a program to count the
number of occurrences of characters in a string
12. Demonstrate with example of upper(), lower(), and isupper(),String Methods
13. Explain the finding patterns of text without regular expressions with example
14. With example, explain the following Pattern Matching with Regular Expressions. (1).
Grouping with Parentheses (ii) Matching Multiple Groups with the Pipe
15. What are Regular Expressions? Explain the basic steps to use Regular Expressions in Python
with examples.
16. Explain the concept of file handling. Also explain the reading and writing process
with suitable example.
17. What is Findall() method, explain the same in detail with appropriate examples.
18. Write a program to implement search and replace multiple occurrences of a given substring in
the main string in a list
19. Explain with suitable Python program segments: (i) os.path.basename()
(ii)os.path.join().
20. Elaborate on the differences between Absolute and Relative file paths.
21. Differentiate between class variables and instance variables with suitable examples
22. Write a function called print time that takes a time object and print it in the form of
hour: minute: second.
23. Explain how to save variables with the Shelve module.
24. Briefly explain the concept of Prototyping and planning
25. Write a program that searches a directory and all of its subdirectories, recursively, and returns
a list of complete paths for all files with a given suffix.
26. Explain the creation of a user-defined type in Python, and ways to access the attributes and
methods of one such type.
27. Write a program to create a class called Rectangle with the help of appropriate attributes. Also
write functions to find the area and perimeter of a rectangle.

Irene Martina, Assistant Professor, Dept of ETE, Sir.MVIT.


21EC643 Question Bank

28. Explain – intit( ) and – str( ) methods with an example.


29. What is __init__ method? Explain with an example.
30. Write a simple code to explain the concept of Polymorphism in Python .
31. Explain operator overloading and polymorphism with examples
32. Demonstrate with syntax of python functions Print( ), input ( ) and format()
33. With proper syntax and example, explain the control statements (1) If (2) else (3) elif
(4) break statement.
34. Define a Python function with suitable parameters to generate first N Fibonacci
numbers. The first two Fibonacci numbers are 0 and 1 and the Fibonacci sequence is
defined as a function F as Fn = Fn-1 + Fn-2.
35. Explain the string concatenation and string replication operator with an example.
36. What are user-defined functions? How can we pass parameters in user-defined
functions? Explain with a suitable example
37. Develop a program to read the student details like Name, USN and Marks in three
subjects. Display the student details, total marks and percentage with suitable
messages.
38. What is list? Explain append (), insert () and remove () methods with examples
39. Describe any two list operations and list methods. Write a Python program to accept
‘n’ numbers from the user. Find the sum of all even numbers and the product of all
odd numbers in the entered list.
40. When do we encounter TypeError and ValueError and IndexError while operating on
Lists?
41. What are the different ways of deleting elements from a list? Discuss with suitable
functions.
42. Explain the concept of comparing tuples. Describe the working of sort function with
python code
43. List merits of dictionary over list. Write a python program to accept USN and marks
obtained. Find maximum, minimum and students USN who have scored in the range
100-85, 85-75,75-60 and below 60 marks separately.
44. Explain the basic steps for creating and finding regular expression objects with
Python,
45. List shorthand codes for common character classes. Brief out the step involved in to
making your own character classes.
46. Explain reading and saving python program variables using shelve module with
suitable Python program.
47. Explain the concept of file path. Also discuss absolute and relative file path.
48. Write a python program that accepts a sentence and find the number of words, digits,
uppercase letters and lower case letters.
49. Define Class, Objects and Attributes with an example
50. Write a program to create a class called Rectangle with the help of a corner point,
width and height. Write the following functions and demonstrate their working: a. To
find and display center of the rectangle b. To display point as an ordered pair c. To
resize the rectangle d. To find area and perimeter of a rectangle
51. Justify the statement “Objects are mutable” with suitable examples

Irene Martina, Assistant Professor, Dept of ETE, Sir.MVIT.


21EC643 Question Bank

52. Demonstrate pure functions and modifiers with example


53. With the help of programming examples explain the difference between Prototype and
Planned Programming Development

Irene Martina, Assistant Professor, Dept of ETE, Sir.MVIT.

You might also like