11computer Science-Python Fundamentals-Assignment

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

CLASS-XI

COMPUTER SCIENCE

PYTHON FUNDAMENTALS

ASSIGNMENT

Q1. What is the difference between identifier and keyword ?

Q2.What are literals in Python ? How many types of literals are allowed in Python?

Q3.Define Tokens. Name the different types of Tokens of Python.

Q4.How many ways are there in Python to represent an integer literal ?

Q5.Identify the type of following literals :

12.45 2345 True ‘True’ “True”

0X34 034 ‘‘‘False’’’ 34561 None

Q6.What is the difference between an expression and a statement in Python?

Q7.Write the following real constants in exponent form :

17.251 151.02 0.00031

0.452

Q8.Predict the output of following:

x,y = 7,2

x,y,x=x+1,y+3, x+10

print(x,y)

Q9.Write a Python program to calculate area of a square.

Q10.Write a Python program to enter marks in five subjects and calculate


percentage.

Q11.List the different operators in Python.


Q12.Differentiate between int( ) and float( ) function of Python.

Q13.Which of the following identifier names are invalid and why?

i) Serial_no. v) Total_Marks

ii) 1st_Room vi) total-Marks

iii) Hundred$ vii) _Percentage

iv) Total Marks viii) True

Q14. Write the corresponding Python assignment statements:

a) Assign 10 to variable length and 20 to variable breadth.

b) Assign the sum of values of variables length and breadth to a variable sum.

c)Assign 20 to variables x, y and z in a single statement.

Q15. Write the output of the following code:

a) num1 = 4

num2 = num1 + 1

print(num1,num2)

num1 = 2

print (num1, num2)

b) x,y = 7, 2

x,y,x = x+1, y+3, x+10

print(x,y)

c) x,y = 2,6

x,y = y, x+2

print(x,y)

You might also like