Python Viva Questions
1. What are data types in Python? Name a few with examples.
2. How does string concatenation and replication work in Python?
3. How can you convert temperature from Fahrenheit to Celsius in Python?
4. Explain the use of conditional statements in Python with an example.
5. Write the syntax of a while loop. How is it different from a for loop?
6. What is a function in Python? How do you call a function?
7. How does a recursive function work? Give an example.
8. Explain how lists work in Python. How do you add, remove and access elements?
9. What is the difference between a list and a dictionary in Python?
10. How would you calculate mean, variance and standard deviation from a list of numbers?
11. What are string manipulation functions in Python? Name a few with examples.
12. How can you validate user input in Python?
13. What is a regular expression? How is it used in Python?
14. How can you retrieve lines from a file that match a particular pattern?
15. Write a Python regex to convert a date from 'YYYY-MM-DD' to 'DD-MM-YYYY'.
16. What is file handling in Python? Name different file operations.
17. How do you read, write and append to a text file in Python?
18. How can you identify misspelled words in a text file using Python?
19. What is the use of 'with open() as' syntax in file handling?
20. How would you handle exceptions in Python? Give an example.