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

Class 8 Computer CH 9 Worksheet

Uploaded by

Soumen Pradhan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views2 pages

Class 8 Computer CH 9 Worksheet

Uploaded by

Soumen Pradhan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

DELHI PUBLIC SCHOOL RAMPURHAT

CLASS: VIII
CHAPTER 9

Worksheet
1. Fill in the blanks. 1
a. command is used to display a statement in Python.
b. command can be used to take in a value from the user.
c. The keyword is used to display the data type of the variable.
d. The variables upon which an operator performs an operation are known as .
e. statements are used to perform an action based on a given condition.

2. State whether the following statements true (T) or false (F).

a. The type of data contained in a variable that tells the computer what operations can be
performed on it is known as an operator.

b. The range function is used in Python for applying the for loop.

c. The if-else keywords are used for conditional statements in Python.

d. Functions are reusable, can be called many times.

e. The len() function can be used on strings, int and float.

3. Answer the following questions.

a. What is concatenation?
b. What is the need to use function?
c. Explain any four built-in functions.

d. Write down the output of the following program code:


list1 = ["pen", "pencil", "eraser", "ruler"]

for x in list1:

print(x)

e. Write down the output of the following program code:


def f1():

n1 = 45

n2 = 30

if n1>n2:

return n1

else:

return n2

print(f1())

f. Write a function in Python that accepts a traffic signal colour and returns relevant message.
g. Create a list that contains 3 numbers and returns the maximum out of three entered numbers.
Worksheet
2
1. Fill in the blanks.

a. To display both text and variables in a line, they have to be separated by a in the print command.
b. To display the variable, the command is used.
c. is a symbol that tells the computer what operations are to be performed on the variable.
d. are actions that repeat themselves.
e. The function written by the user is called a function.

2. State whether the following statements true (T) or false (F).

a. + is an arithmetic operator.

b. There are two types of loops in Python—for and if.

c. The While loop is a loop that repeats until the specified condition is true.

d. Once a function is defined, it can be called, that is, used in other parts of the program.

e. The type() function is used to convert a string value to int.

3. Answer the following questions.

a. Explain the role of comments in programming.


b. Write short note on data structures in Python.
c. What is List in Python? How to declare it?

d. Write down the output of the following program code:


list1 = [35, 89,56,78,90,45]

print (max(list1))

print (min(list1))

print (len(list1))

print (list1[len(list1)-1])

e. Write down the output of the following program code:


def f1(n1,n2):

if n1==n2:

return True

else:

return False

n1 = 40

n2 = 30

print(f1(n1, n2))

f. Write a function in Python that accepts a number and print its multiplication table up to 10 terms.
g. Create a list that has names of your five friends. Ask user to enter a name and check whether that name exists in the list or not.

You might also like