1- Out of the following, find those identifiers, which cannot be used for naming Variable or Functions in a
Python program:
Total*Tax, While, class, switch, 3rdRow, finally, Column31, _Total
2- Identify invalid variable names out of the following. State reason if invalid.
(i) for (ii) –salary (iii) salary12 (iv) product
3- Identify invalid variable name(s) out of the following. State reason if invalid
(i) While (ii) 123salary (iii) Big (iv) Product
4- Help Manish in identifying the incorrect variable name with justification from the following:
(i) unit@price (ii) fee (iii) userid (iv) avg marks
5- Identify the invalid variable names. State the reason if invalid.
(i) Marks Unit (ii) Product_1 (iii) Sales123 (iv) 2Marks
6- Which of the following can be used as valid variable identifier(s) in Python?
(i) elif (ii) BREAK (iii) in (iv) _Total
7- Find the correct identifiers out of the following, which can be used for naming variable, constants or
functions in a python program:
While, for, Float, new, 2ndName, A%B, Amount2, _Counter
8- Which of the following is valid arithmetic operator in Python:
(i) // (ii) ? (iii) < (iv) and
9- Identify the valid arithmetic operator in Python from the following. (i) ? (ii) < (iii) ** (iv) and
10- Write the names of any four data types available in Python.
Consider the statement:
first_name = “Ayana”
(i) What is the datatype of first_name ?
(ii) (ii) Is 325 the same as “325” ? Give reason
11- Consider the statement : fname = “Rishabh”; (i) What is the datatype of fname ? (ii) Is 456 the same as “456”
? Give reason
12- Is 123 the same as 123.0 ? Give reason (ii) Is “234” the same as “234.0” ? Give reason
13- Write the data type of variables that should be used to store: 1[2018] (i) Marks of students (ii) Grades of
students(Grade can be ‘A’ or ‘B’ or ‘C’)
14- Write the value that will be assigned to variable x after executing the following statement:
x = 3 + 36/12 + 2*5
15- Write the value that will be assigned to variable c after executing the following statement:
C = 25-5*4/2-10+4
16- Write the value that will be assigned to variable x after executing the following statement:
X=20-5+3*20/5
17- Write the output of the following Python code:
i=5
j=7
x=0
i=i+(j-1)
x=j+1
print(x,”:”,i)
j=j**2
x=j+i
i=i+1
print (i,”:”,j)
18- Give the output if a=10 and b=20
a=input(“enter no”)
b=input(“enter 2nd no”)
print(a+b)
19- Write a program to take two nos and swap two number for example if a=10, b=20 after swapping it should
be a=20 b=10
20- Give the output
a=20 b=30
a,b=b+20,a+30
print(a,b)
21- Give the output
Num = 6
Num = Num + 1
if Num > 5:
print(Num)
else:
print(Num+5)