QB For IA1
QB For IA1
PART-A
1. Differentiate between a program and a script in Python.
2. What is a keyword in python? List any four keywords in Python.
3. Why is indentation important in Python?
4. Differentiate between a variable and a literal in Python.
5. What is the purpose of the print() function in Python.
6. What is a variable and state the rules for naming a variable along with an example?
7. What is the difference between a compiler and an interpreter?
8. What are literals in Python?
9. What are comments in Python? Why are they used?
10. What is string slicing and splitting? Provide an example.
11. What is the difference between if and if-else statements in Python?
12. What is the purpose of a while loop in Python?
13. What is the difference between required and default parameters in a Python function?
14. What is recursion in Python programming?
15. How would you define a function with variable-length arguments in Python? Provide an
example.
16. Write a Python code snippet using an if statement to check if a number is positive.
17. How does a for loop work in Python? Provide an example of iterating through a list using
a for loop.
18. What is the difference between local and global variables in Python?
19. Define function along with its types and advantage.
20. What does function composition mean in the context of Python programming?
21. Define a list slice and provide an example
22. How would you clone a list in Python? Provide an example
23. Given a list, how would you remove the first occurrence of an element in Python.
24. How do you access the first and last elements of a list?
25. What will be the output of list(range(3, 10, 2))?
26. What does the sort() method do in a list?
27. How do you insert an element at a specific position in a list?
28. How do you copy a list without modifying the original list?
29. What is list comprehension in Python?
30. How do you remove a specific element from a list by value?
PART-B
1. Discuss the significance of operators and their precedence in Python with suitable
expressions.
2. Explain the concept of string formatting, comparison, slicing, and splitting with
examples.
3. Explain the working of input() and print() functions in Python with examples.
4. Write a Python program to find the Fibonacci series of a number.
5. Write a Python program to calculate the distance between two points given their
coordinates.
6. Develop a Python script to circulate the values of variables and justify its working with
an example.
7. Summarize the different types of data types available in Python and their use cases.
8. Illustrate the importance of indentation in python with examples and explain how it
affects program execution.
9. Explain Python expressions in detail, along with their types and examples.
10. Explain the concept of functions in python programming in detail.
11. Explain the different types of parameters that can be used in functions in Python, with
suitable examples for each.
12. Write a recursive function to compute the factorial of a number.
13. Explain how a function is invoked in Python and illustrate the significance of the return
statement with examples.
14. Explain the following with an example program: Lamda functions and Function
Composition.
15. Write a recursive function to compute the Fibonacci of a number.
16. Explain how a function accesses both local and global variables in Python with an
example program. Describe the behavior of local and global variables within the function.
17. Write a program to search a number from the given list of numbers using linear search
and binary search along with the output.
18. Discuss the concept of list slicing in Python. Provide examples for slicing a list and
explain its behavior when used with negative indices.
19. Explain the concept of list looping, aliasing, cloning and comprehension in detail with
suitable example programs.
20. Discuss the concept of list slicing in Python. Provide examples for slicing a list and
explain its behavior when used with negative indices.