Question Bank On Module 1 Modifed
Question Bank On Module 1 Modifed
Question bank
1. Explain the concept of type conversion functions and math conversions in python with
suitable examples
2. Explain the working of while loop with suitable example
3. Briefly explain the working of range() function
4. Demonstrate the usage of break and continue statements in looping structures using
5. What is a variable? List the rules to declare a variable in python? Demonstrate the same
6. List the features of Python Programming Language
7. Briefly explain the working of definite loop in python
8. Which of the following are operators, and which are values?
*
'hello'
-98.8
-
/
+
5
9. Name three data types. Explain each in details.
10. What should the following two expressions evaluate to?
'abc' + 'abcabc'
'raju' * 3
11. What three functions can be used to get the integer, floating-point number, or string
version of a value?
12. What are the two values of the Boolean data type? How do you write them?
13. write the difference between formal language and natural language.
14. What are the three Boolean operators? Write out the truth tables of each Boolean
operator (that is, every possible combination of Boolean values for the operator and what
they evaluate to).
15. 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)
16. What are the six comparison operators?
17. What is the difference between the equal to operator and the assignment operator?
18. Explain what a condition is and where you would use one.
19. Identify the three blocks in this code:
spam = 0
if spam == 10:
print('eggs')
if spam > 5:
print('bacon')
else:
print('ham')
print('spam')
print('spam')
20. Write code that prints Hello if 1 is stored in spam, prints Howdy if 2 is stored in spam,
and prints Greetings! if anything else is stored in spam.
21. What is the difference between break and continue?
22. What is the difference between range(10), range(0, 10), and range(0, 10, 1) in a for
loop?
23. Write a short program that prints the numbers 1 to 10 using a for loop. Then write an
equivalent program that prints the numbers 1 to 10 using a while loop.
24. If you had a function named bacon() inside a module named spam, how would you call
it after importing spam?
25. Give the output of the following :
1.
range(10)
range(1,11)
range(0,30,5)
range(0,-9,-1)
2. spam = 0
if spam < 5:
print('Hello, world.')
spam = spam + 1
3. spam = 0
while spam < 5:
print('Hello, world.')
spam = spam + 1
26. Mention the advantage of continue statement. Write a program to compute only even
numbers sum within the given natural number using continue statement.
27.Identify errors.
1. >>> true
2. >>> 42 + 5 + * 2
3. >>> 'Alice' + 42
30. Write a Flow chart and Python program for the following:
2.Write a program to declare the result of a student whose marks in a course is given. Passing
marks is 40.
Mark=input()
32. Identify the function to be used from the given basket, for each of the below cases.
Percentage=marks /100