0% found this document useful (0 votes)
15 views2 pages

Python QA

Uploaded by

Ashok
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views2 pages

Python QA

Uploaded by

Ashok
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Python Beginner Questions

Section A – Basics of Python


1. What is Python and why is it called an interpreted language?
2. List three features that make Python popular among developers.
3. Explain the difference between a variable and a constant in Python.
4. Write a Python program to print 'Hello, World!'.
5. What are Python keywords? Give five examples.
6. How is indentation used in Python and why is it important?
7. What are comments in Python? Write examples using single-line and multi-line
comments.
8. Explain the difference between print() and input() functions with examples.
9. What is the difference between '=' and '==' operators in Python?
10. What is dynamic typing in Python? Provide an example.

Section B – Data Types and Operators


11. What are the main built-in data types in Python?
12. Differentiate between list, tuple, and set with examples.
13. Write a small Python code to swap two numbers using a temporary variable.
14. What are arithmetic operators in Python? Give examples of each.
15. Show with code how to concatenate two strings.
16. Explain type casting with the help of an example (int to float).
17. What is the difference between mutable and immutable data types with examples?
18. Write a code to find the square and cube of a number entered by the user.
19. What is the difference between integer division (//) and floating division (/)?
20. Show an example of using logical operators and, or, not.

Section C – Flow Control


21. Write a Python program to check whether a number is even or odd.
22. Explain the difference between if, elif, and else statements.
23. Write a program to find the greatest of three numbers.
24. Show how the for loop works in Python with an example.
25. Write a Python code to print numbers from 1 to 10 using a while loop.
26. How does the break statement work inside loops? Give an example.
27. What is the purpose of the continue statement? Write one simple code example.
28. Write a program to print the multiplication table of a given number.
29. Explain the use of range() function in loops with examples.
30. Write a Python program to calculate the sum of numbers from 1 to 100.
Section D – Functions and Input Handling
31. What is a function in Python?
32. Write a simple function to add two numbers.
33. Explain the difference between built-in and user-defined functions.
34. Write a function that takes a string and prints it in reverse order.
35. What is the difference between parameters and arguments in functions?
36. What are default arguments in Python functions? Show with code.
37. Write a program to check if a given number is prime using a function.
38. What does the return statement do in Python?
39. Can a function return multiple values in Python? Show with code.
40. Write a program that asks the user’s name and prints a welcome message.

Section E – Miscellaneous
41. What is the difference between a compiler and an interpreter?
42. What is the purpose of the import statement in Python?
43. Explain the use of Python’s math module with an example.
44. What is type conversion? Differentiate between implicit and explicit conversion.
45. What are Python identifiers? Give the rules for naming them.
46. Write a simple Python program to calculate the area of a circle given the radius.
47. Explain the difference between errors and exceptions in Python.
48. Write code to handle a divide-by-zero exception in Python.
49. Differentiate between len(), max(), and min() functions.
50. What are Python lists? Write a program to find the sum of all elements of a list.

You might also like