Page 169 - Code_GPT_Class_8
P. 169
8. Which function is used to add an element in a list?
a. extend() b. count()
c. append() d. add()
B. Fill in the blanks with the correct words.
1. AI-assisted has built an autonomous weapon system.
2. Else statement can be used with loop too.
3. The inputs given to the functions are referred to as .
4. A string is enclosed or surrounded by or quotes.
5. List is used to store the sequential order of of data.
6. Barr and Feigenbaum in defined AI.
C. Tick ( ) the correct statements and cross ( ) the wrong ones.
1. The range(5) generates a set of whole numbers starting from 0 to 5.
2. An infinite loop in Python is a loop that never stops executing because its condition is always true.
3. Lists are mutable, which means the elements of a list can be changed
without allocating new storage location.
4. L1={‘Hyundai’, ‘Toyota’, ‘Maruti’} is a valid list.
5. Computer vision is used for security & surveillance.
6. Alexa is a Google product.
D. Answer the following questions:
1. Write a program to check whether a given number is even or odd. If the number is even, then print “Even
number”. If the number is odd, then print “Odd number”.
2. If only one condition needs to be true irrespective of other one, which operator is to be used? Explain
with example.
3. Explain the difference between a for loop and a while loop in Python.
4. How can you exit a loop before the condition becomes false in Python?
5. How do you pass arguments to a Python function? Explain with an example.
6. What is the difference between string concatenation operator and string replication operator? Explain
with example.
7. How do you create an empty list?
8. What is a list in Python?
Test Sheet 2 167

