CS_8_OQB8_2425_TA python
CS_8_OQB8_2425_TA python
2. In Python “+” operator is used to replicate a given string specified times. ________
3. Python allows only 2 types of operator on the string data type. ________
5. In Python, data types represent the type of data stored in a variable. _______
6. The print() function is used to accept the value of a variable from the user. _______
8. An if-else statement checks only the true part of the statement. ________
9. While loop keeps on executing the blocks of a statement as long as the specified test condition
10. The value of the counter variable on for loop cannot be decremented to n number of steps. _____
11. The // operator in Python performs integer division and returns a quotient in float. _____
14. The logical ‘or’ operator evaluates to True if at least one of the conditions is True. _____
15. The relational operators compare the values of variables and determine the result in a Boolean
expression. _______
3. Which escape character will insert a Tab for extra spacing? ______________
8. The ____________ is the name of the location that stores the data.
10. a=8, b=7, c=9 what will be the output of a<b __________.
11. The __________ operator is used to compare two values for equality.
12. The ‘+’ operator is termed as the _________________ operator when used with strings.
13. In Python, the __________ operator is used to find the remainder of the division.
14. The ________________ function generates a sequence of numbers in Python, commonly used with
loops.
15. The ____________ operator is used to combine two or more conditional statements and return
a= “AB”
1 b= “CD”
print(a+b)
s=0
for i in range (1,10):
2 if i%2 != 0:
s=s+i
print (i)
k=1
i=2
while (i<6):
4
k=k*i
i=i+1
print(k)
p=100
for i in range (1,5):
5
p=p-1
print(p)
p= -30
while (p<0):
6
p=p+9
print(p)
a=100
7 print(a/10)
print(a//10)
a=25
8 b=5
print(a%b)
a=100
b=20
s=0
while a>=b:
9
if a % 5 = = 0:
s+=a
a - = 20
print (s)
n=1
while n<5:
10
print(n*n)
n += 1
n=10
while n<50:
11
print (n+n)
n += 10
1. a = integer(input(“First number”))
b=10
for i in range (a : b) :
PRINT (a*b)
if (a>b) then
print(a)
2. i=10
while (i=> 5):
print (I)
i = I +1:
3. a , b =0
if (a = b)
a+b=c
print (z)
5. fee = 250
0=i
while fee =< 2000:
if fee <= 750:
print (fee)
fee = + 250
else:
print (“fee” * i)
i = i+1
fee = Fee + 250
Q5. The relational operators predict the output in terms of True or False.
1. a<b 5. a == b
2. b>c 6. c<=b
3. c!=a 7. a>=c
4. b<=c 8. b!=a
99
98
1 ABCD 5 9 300
97
96
-21 1
-12 4
2 9 6 10
-3 9
6 16
20
6 10.0 40
3 7 11
11 10 60
80
4 120 8 0
2. i=10
while (i >= 5):
print(i)
i=i – 1
Q5. The relational operators predict the output in terms of True or False.
1. False 5. False
2. False 6. False
3. True 7. False
4. True 8. True