CA3 Question
CA3 Question
3. What will be the output of the following Python expression if x=56.236, >> print("%.2f"%x)
a) 56.236 b) 56.23 c) 56.0000 d) 56.24
5. What will be the output of the following Python code? print("abc. DEF".capitalize())
a) Abc. Def b) abc. Def c) Abc. Def d) ABC. DEF
7. Compare and contrast the difference between List and strings with suitable examples. 5
8. What is shallow copy in python? Discuss with an example. How can it be avoided? 3+2
9. How to create an integer from a binary number in python. Also write how to get binary equivalent of an
integer? Discuss string.format() in details. 1+1+3
10. Sow how a decimal number is created in python. Why is it used in python? What are their limitations
in comparison to floating point numbers? 2+1+2
11. Write a program in Python to print number of occurrence of a substring within a string in both ways
using slicing and string methods. 3+2
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
QN CO QN CO QN CO QN CO QN CO QN CO QN CO
1 CO1 2 CO1 3 CO3 4 CO3 5 CO3 6 CO3 7 CO3
8 CO3 9 CO3 10 CO3 11 CO4