Practice
Questions
Part – 1
(Theory)
1. Who is the developer of
Python Programming Language?
2. Python is free and open
source language. here, what is free and open source?
3. What are the advantages of
Python Programming Language?
4. In how many different ways
we can work of Python?
5. Differentiate interactive
and script mode of Python programming language?
6. What are literals in Python?
How many types of literals are there in Python?
7. How string literal is
represented in Python?
8. What is a statement and
expression?
9. What is the role of
indention in Python?
10. What are variables?
11. Differentiate keyword and
identifier.
12. What are tokens in Python?
13.
How comments are given in Python program?
14.
How many parts are there for any complex number?
15. What is data type in python?
Is there any importance of data type?
16. Differentiate implicit type
conversion and explicit type conversion.
Part -2 (
Output and Errors)
1.
What will be the output of following? a=20
b=a+1
a=33
print(a+b)
2.
What is wrong with following code fragment? a=20
print(a)
b=33
print(b)
3.
What is wrong with following code fragment?
name="freya"
classs=4
print(name+classs)
4.
What will be the output of following python code?
a,b=3,4
a,b,c=b,a+3,b-1
print(a,b,c)
5.
What will be the output of following python code?
a,b=3,4
c,a=b*4,a+4
print(a,b,c)
6.
What will be the output of following python code/code
fragment? a. print(print("vishal"))
b. print("vishal")
print("indian")
c.
print("vishal",end=" ")
print("indian")
d. a=int(input("enter
first no"))
b=int(input("enter
second no"))
a,b=b,a
print("a=",a)
print("b=",b)
#if user is entering 5 and
then 10
7. Which of the following is an
invalid statement?
a) abc = 1,000,000
b) a b c = 1000 2000 3000
c) a,b,c = 1000, 2000, 3000
d) a_b_c = 1,000,000
8. What is the error of
following code : a,b=100?
9.
What is the output of the following code : print(9//2)
10.
Can you identify the data types of following values,if yes write their
data tpe.
4, 5.2, 8j , ’1’ , ”1” ,
4+0j
11. What will be the output of
the following code
print(5/2)
print(5//2)
12.
What will the output of following codes print (8*2 -
2*4)
print (3 +
18/9 - 3**2+1) print ((4 + 24)/8 - (2**3+3))
13. What will the output of
following code snippet
x = 5
y = -1
print ((x+y)*1./x)
print (3*x )
print (x )
14.
Write the equivalent Boolean value a. 7+3*4 < 3 *3 +
4
15. What is the problem with
following code fragments
a. x="marks"+100
print(x)
b. a=5
b=a+500
a="marks"
c=a/2 print(c)
16.
What will be the output of following code fragments
a,b=5,6
a,b,c=10,b,a
a,b,c=c/2,a+4,b*6+2
print(a)
print(b)
print(c)
17.
What will be the output of following python statements
print(type(100))
print(type(100/2))
print(type('0'))
print(type(5.2))
18. Classify each of the
following as either a legal or illegal Python identifier:
1. fred
|
#Keywords
|
||
2.
|
#if
|
# Invalid
|
|
3.
|
#2x
|
#Invalid
|
|
4.
|
-4
|
#Constant
|
|
5. sum_total
|
#identifier
|
||
6. sumTotal
|
#identifier
|
||
7. sum-total
|
#Expression
|
||
8.
|
#sum total
|
#Invalid
|
|
9.
|
Sumtotal
|
#identifier
|
|
10.
|
While
|
#identifier
|
|
11. x2
|
#identifier
|
||
12. Private
|
#Keywords
|
||
13. public
|
#Keywords
|
||
14.
|
#$16
|
#Invalid
|
|
15. xTwo
|
#identifier
|
||
16.
|
_static
|
#identifier
|
|
17.
|
_4
|
#identifier
|
|
18.
|
___
|
#identifier
|
|
19.
|
#10%
|
#Invalid
|
|
20. a27834
|
#identifier
|
||
21.
|
#wilma’s
|
#Invalid
|
19.
If x = 2 Indicate what each of the following Python
statements would print. print(’x’)
print(‘x’)
print(x)
print(‘x+1’)
print(’x’ + 1) print(x + 1)
Part – 3
(Programs)
1. WAP to add 2 numbers.[R=a+b]
2. WAP to add 4
numbers.[R=a+b+c+d]
3. WAP to multiply 3
numbers.[R=a*b*c]
4. WAP to find average 5
numbers[R=(a+b+c+d+e)/5]
5. WAP to display age after 15
years.[nage =age+15]
6. WAP to display a 3 numbers
[R=a*a*a]
7. WAP to find the area of
square. [A=a*a]
8. WAP to find the area of
rectangle [A=a*b]
9. WAP to find the result X N
pow()
10. WAP to find the perimeter of
rectangle[A=2*(l+ b) ]
11. WAP to find the area of
circle [A=3.14*r*r]
12. WAP to find the
circumference of circle [C=2*3.14*r]
13. WAP to swap the values of
two variables.[a= a + b; b=a – b; a= a – b;]
14. WAP to input Hours, Minutes
and Seconds and display in seconds. [TS=H*60*60+M*60+S]
15. WAP to input cost and
display cost after increasing 25% [cost+(cost*25)/100]
16. WAP to display squire of a
numbers [a*a]
17. WAP to find the volume of
sphere.[v=4/3*3.14*r 3 ]
18. WAP to find the area of
triangle using HEROS formula[s= (a + b + c)/2, R=] math.sqrt()
19. WAP to take principal, rate
and time and display C.I. (Compound Interest) CI=p*(1+R/100) T pow()
20. WAP to calculate sum of 5
subjects & find percentage[TOT=s1+s2+s3+s4+s5,Per=TOT/5]
21. WAP which accept temperature
in Fahrenheit and print it in centigrade[c=5/9*(T-32)]
22. WAP which accept temperature
in centigrade and print it in Fahrenheit[F=(1.8*T)+32]
23. WAP to calculate simple
interest. [SI=(PRT)/100]
24. WAP to find gross salary [GS=BASIC+DA-PF+HRA]
25. Write a python program to
solve quadratic equation
26. Python Program to Convert
Kilometers to Miles.
![](file:///C:/Users/SWI/AppData/Local/Temp/msohtmlclip1/01/clip_image002.jpg)
![](file:///C:/Users/SWI/AppData/Local/Temp/msohtmlclip1/01/clip_image004.jpg)