0% found this document useful (0 votes)
2 views

CS_8_OQB8_2425_TA python

This document is a Computer Science Objective Question Bank for Class VIII at Delhi Public School Surat, focusing on Python programming. It includes true/false questions, fill-in-the-blank exercises, program output predictions, and error correction tasks. The document also provides answers to the questions and outputs for the programming exercises.

Uploaded by

kiaan0705
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)
2 views

CS_8_OQB8_2425_TA python

This document is a Computer Science Objective Question Bank for Class VIII at Delhi Public School Surat, focusing on Python programming. It includes true/false questions, fill-in-the-blank exercises, program output predictions, and error correction tasks. The document also provides answers to the questions and outputs for the programming exercises.

Uploaded by

kiaan0705
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/ 6

Series: DPSS/CS/OQB8/24-25

DELHI PUBLIC SCHOOL SURAT


COMPUTER SCIENCE OBJECTIVE QUESTION BANK-8
Chapter: Python Class: VIII-___
Name: _________________________________ Roll Number: ____

Q1. True or false

1. The print() function only prints numbers. ________

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. ________

4. A variable name can consist of letters, digits and underscore. __________

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. _______

7. The string value cannot be multiplied. _______

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

evaluates to true. _____

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. _____

12. The ‘in’ operator checks if a value is present in a sequence. _________

13. The ‘%’ operator is used to concatenate two strings. _________

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. _______

DELHI PUBLIC SCHOOL SURAT Page 1 of 6


Q2. Fill in the blanks

1. The ______________ operator is used to assign a value to a variable.

2. ____________ are special output characters marked with a \.

3. Which escape character will insert a Tab for extra spacing? ______________

4. The ________ key is pressed to execute a Python program.

5. Python _______________ cannot be used as a variable name.

6. The data type of 12.4 is ___________.

7. print(10+20) will give the output _________.

8. The ____________ is the name of the location that stores the data.

9. What will be the output of 100%3? __________.

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

True only if all conditions are true.

Q3. Find output for the following programs.

Sr.no. PROGRAM OUTPUT

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)

DELHI PUBLIC SCHOOL SURAT Page 2 of 6


m= 2
n=15
for i in range (1,5):
3 m=m+1
n=n-1
print(m)
print(n)

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

DELHI PUBLIC SCHOOL SURAT Page 3 of 6


Q4. Rewrite the following code after correcting the errors:

Sr.no. ERROR CODE CORRECT CODE

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)

4. x = int(“Enter value of x”)


for in range [0,10]:
if x = y
print(“They are equal”)
else
print(“They are not
equal”)

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.

Predict the result when the following expressions will be executed:

a=8; b=7; c=9

Sr.no. Expression Result Sr.no. Expression Result

1. a<b 5. a == b

2. b>c 6. c<=b

3. c!=a 7. a>=c

4. b<=c 8. b!=a

DELHI PUBLIC SCHOOL SURAT Page 4 of 6


ANSWERS:

Q1. True or false Q2. Fill in the blanks

1. False 8. False 1. = 8. variable


2. False 9. True 2. Escape 9. 1
3. True 10. False character 10. false
4. True 11. False 3. \t 11. ==
5. True 12. True 4. F5 12. concatenate
6. False 13. False 5. keyword 13. % (modulus)
7. True 14. True 6. float 14. range
15. True 7. 30 15. and

Q3. Find output for the following programs.

Sr.no. OUTPUT Sr.no. OUTPUT Sr.no. OUTPUT

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

DELHI PUBLIC SCHOOL SURAT Page 5 of 6


Q4. Rewrite the following code after correcting the errors:

Sr.no. CORRECT CODE Sr.no. CORRECT CODE

1. a = int(input(“First 4. x = int(input(“Enter value of x”))


number”)) for i in range (0,10):
b=10 if x == y :
for i in range(a,b): print(“They are equal”)
print(a*b) else:
if (a>b): print(“They are not equal”)
print(a)

2. i=10
while (i >= 5):
print(i)
i=i – 1

3. a=0 5. fee = 250


b =0 i=0
if (a == b): while fee <= 2000:
c=a+b if fee <= 750:
print (c) 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.

Sr.no. Result Sr.no. Result

1. False 5. False

2. False 6. False

3. True 7. False

4. True 8. True

DELHI PUBLIC SCHOOL SURAT Page 6 of 6

You might also like