Page 324 - AI Ver 1.0 Class 9
P. 324
Ans. Correct code is:
a=5
b=int(input("ENTER value for b"))
if a<b:
print("a is bigger")
else:
print("b is bigger")
D. Solve the given expressions based on operator precedence:
1. 2 ** 5 – 35 // 3 2. not 15 < 2 or 2 ** 3 > 12/3
Ans. 32 – 11 Ans. not False or 8 > 12 / 3
21 not False or True
True or True
Tru
3. 6 * 5 – 14 // 7 + 2 ** 3 4. 50 // 9 - 2 * 5
Ans. 30 – 2 + 8 Ans. 5 - 2 * 5
36 5 - 10
-5
5. 3 ** 3 + 10 – 22 // 2
Ans. 27 + 10 – 11
37 – 11
26
E. State whether these statements are true or false.
1. Understanding the problem is the last step in computer problem solving. ……….……
2. Algorithm follows strict rules of writing the instructions. ……….……
3. Flow-charts are difficult to maintain for complex programs. ……….……
4. There are no specific tools for branching and looping in algorithms. ……….……
5. Algorithms are just a waste of time before writing a code. ……….……
6. Step value is compulsory in while loop. ……….……
7. Indentation is not important in conditional programming. ……….……
8. While loop repeats a set of instructions indefinite number of times. ……….……
9. For loop is used to give conditions and executes only once. ……….……
10. If condition is True then the block of statement written for True will be executed. ……….……
11. The count( ) returns the index number of the value given in the function. ……….……
12. Slicing a list means accessing a specific portion of a list. ……….……
13. Operands on either side of the + operator have to be a list. ……….……
14. We cannot create an empty list. ……….……
15. A list can be created within another list. ……….……
322 Touchpad Artificial Intelligence-IX

