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

ASSIGNMENT QUESTIONS (Module 1)

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 2

ASSIGNMENT QUESTIONS

1. What is an arithmetic expression? What is the output of this statement : ‘hello world’ +
100 + ‘how are you’? Explain the reason if the statement produces an error.
2. Explain the Boolean Operators(AND, OR, NOT) with example.
3. Write a python program to add n numbers accepted from the user.
4. What is the difference between an integer and a floating-point number in Python?
Provide an example to illustrate how these data types are handled.
5. What is string concatenation in Python? Explain with an example how strings can be
combined and why it is different from numerical addition.
6. What is string replication in Python? How is it different from string concatenation?
Provide an example to explain both.
7. What is the purpose of the print() function in Python? Write a simple program that
outputs "Hello, Python!" to the console and explain how it works.
8. What happens when you try to concatenate a string and an integer in Python? Explain
with an example and describe how to avoid errors.
9. What do you mean by Importing a module? What is a flow control statement?. Discuss if
and if else statements with flow chart.
10. Explain for loop with an example? Explain continue statement and write a program and
flow chart to explain the same(continue)
11. Explain while loop with an example? Explain break statement and write a program and
flow
12. What do the following expressions evaluate to?
• (5 > 4) and (3 == 5)
• not(5 > 4)
• (5 > 4) or (3 ==5)
• not((5 > 4) or (3 ==5))
• (True and True) and (True == False)
• (not False) or (not True)
13. Discuss various methods of importing modules in Python programs with suitable
examples. Which method is best? Explain.
14. What is the difference between range(10), range(0, 10), and range(0, 10, 1) in a for loop?
15. Develop a program to generate Fibonacci sequence of length (N). Read N from the
console.
16. Develop a program to read the name and year of birth of a person. Display whether the
person is a senior citizen or not.
17. Write a python program to add n numbers accepted from the user.
18. With Python programming examples to each, explain the syntax and control flow
diagrams of break and continue statements
• Also explain sys.exit() with an example.
• Explain looping control statement in python with a syntax and example to each
19. Write a function to calculate factorial of a number. Develop a program to compute
binomial coefficient (Given N and R)
20. Write a function named DivExp which takes two parameters a,b and returns a value c
(c=a/b). Write suitable assertion for a>0 in function DivExp and raise an exception for
b=0. Develop a python program which reads two values from the console and calls a
function DivExp.
21. Explain Four scope rules of variables in Python.
22. Explain with examples, local and global scope of variables in Python.
23. Explain how functions are defined in Python. Write a program to find factorial of a given
number using functions.
24. What are functions? Explain python function with parameters and return statements.
25. Define exception handling. How exceptions are handled in python? Write a program to
solve divide by zero exception.

You might also like