PROGRAMMING IN PYTHON - EXAM CUTTINGS
PART A (2 Marks)
1. Sum of two numbers:
a=int(input()); b=int(input()); print("Sum=",a+b)
2. Escape: \n, \t, \\, \', \", \r, \b
3. Module: Single .py file. Package: Collection of modules.
4. math module for calculations.
5. num=int(input()); print(num)
6. if num>0:Positive elif num<0:Negative else:Zero
7. array() stores same datatype values.
8. Strings store & process text.
9. Function: outside class. Method: inside class.
10. _var(protected), __var(private).
11. super() calls parent method.
12. Method overloading via default arguments.
PART B (5 Marks)
13. Python: interpreted, easy, OOP. C: compiled, fast, procedural.
14. << multiply by 2, >> divide by 2.
15. print("Hello"); print("Sum=",10+20)
16. Nested loop: loop inside loop.
17. NumPy: numerical & array library.
18. Formal arguments: parameters in function definition.
19. Local: inside function. Global: outside function.
20. Constructor: __init__() initializes object.
21. Use super().__init__() in inheritance.
PART C (15 Marks)
22. Execution: Source Code → Bytecode → PVM → Output.
23. Operators: Arithmetic, Relational, Logical, Assignment, Bitwise, Membership, Identity.
24. Array ops: access, insert, delete, traverse, slice.
25. String case: upper(), lower(), title(), capitalize(), swapcase().