Questions in Python that could be suitable for a final exam: Basic Syntax and Concepts: a. Write a Python function to calculate the factorial of a given number using recursion. b. Explain the difference between Python 2 and Python 3 regarding the “print” statement. c. What is the purpose of the “if name== ‘main’:” statement in a Python script? Data Structures: a. Create a Python class representing a stack and implement the push and pop methods. b. Write Python code to sort a list of integers in ascending order without using built-in sorting functions. c. Explain the difference between a list and a tuple in Python. File Handling: a. Write Python code to read data from a CSV file and store it in a list of dictionaries. b. Explain the difference between reading a file in “text” mode and “binary” mode. c. How do you handle exceptions when opening a file in Python? Provide an example. Functions and Modules: a. Define a Python function that takes a list of numbers as input and returns the sum of all even numbers in the list. b. Explain the concept of a Python module and how you can import functions from a module. c. Write a Python program that demonstrates the use of a lambda function. Object-Oriented Programming: a. Create a Python class called “Rectangle” with methods to calculate its area and perimeter. b. Explain the difference between an instance variable and a class variable in Python. c. Demonstrate inheritance in Python with an example. Error Handling: a. Write Python code that raises a custom exception when a user attempts to divide by zero. b. Explain the purpose of the “try,” “except,” and “finally” blocks in exception handling. c. What is the difference between a “SyntaxError” and a “RuntimeError” in Python? Please note that these questions cover various aspects of Python programming, and you can adjust them based on the specific topics covered in your course. It’s essential to review your course materials and lecture notes to ensure the questions align with what you’ve been taught.
Tags: Assignment Help for Students, Assignment Help Free, Assignment Help Online Free, Assignment Help Websites, assignmenthelp, AssignmentHelpOnline, BestAssignmentHelp, myassignmenthelp, OnlineAssignmentHelp, Student Assignment Help, University Assignment Help