0% found this document useful (0 votes)
25 views5 pages

Chapter 1

Uploaded by

dbmsjava8056
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views5 pages

Chapter 1

Uploaded by

dbmsjava8056
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

OXALISS INTERNATIONAL SCHOOL (CBSE)

COMPUTER SCIENCE (083)


WORKSHEET – 1
GRADE : XII CHAPTER : PYTHON REVISION TOUR - I

PART – A (Multiple Choice)

1. Which of the following is a valid identifier:


i. 9type ii. _type iii. Same-type iv. True
2. Which of the following is a relational operator:
i. > ii. // iii. or iv. **
3. Which of the following is a logical operator:
i. + ii. /= iii. and iv. In
4. Identify the membership operator from the following:
i. in ii. not in iii. both i & ii iv. Only i
5. Which one is a arithmetic operator:
i. not ii. ** iii. both i & ii iv. Only ii
6. What will be the correct output of the statement : >>>4//3.0
i. 1 ii. 1.0 iii 1.3333 iv. None of the above
7. What will be the correct output of the statement:>>> 4+2**2*10
i. 18 ii. 80 iii. 44 iv. None of the above
8. Give the output of the following code:>>> a,b=4,2>>> a+b**2*10
i. 44 ii. 48 iii. 40 iv. 88
9. Give the output of the following code:>>> a,b = 4,2.5>>> a-b//2**2
i. 4.0 ii. 4 iii. 0 iv. None of the above
10. Give the output of the following code:>>>a,b,c=1,2,3>>> a//b**c+a-c*a
i. -2 ii. -2.0 iii. 2.0 iv. None of the above
11. If a=1,b=2 and c= 3 then which statement will give the outputas: 2.0 from the following:
i. >>>a%b%c+1 ii. >>>a%b%c+1.0 iii. >>>a%b%c iv. a%b%c-1
12. Which statement will give the output as : True from thefollowing :
i. >>>not -5 ii. >>>not 5 iii. >>>not 0 iv. >>>not(5-1)
13. Give the output of the following code:>>>7*(8/(5//2))
i. 28 ii. 28.0 iii. 20 iv. 60
14. Give the output of the following code:>>>import math>>> math.ceil(1.03)+math.floor(1.03)
i. 3 ii. -3.0 iii. 3.0 iv. None of the above
15. What will be the output of the following code:>>>import math>>>math.fabs(-5.03)
i. 5.0 ii. 5.03 iii. -5.03 iv . None of the above
16. Single line comments in python begin with………………..symbol.
i. # ii. “ iii. % iv. _
17. Which of the following are the fundamental building block of a python program.
i. Identifier ii. Constant iii. Punctuators iv. Tokens
18. The input() function always returns a value of ………..type.
i. Integer ii. float iii. string iv. Complex
19. ………. function is used to determine the data type of a variable.
i. type( ) ii. id( ) iii. print( ) iv. str( )
20. The smallest individual unit in a program is known as a………
i. Token ii. keyword iii. punctuator iv. Identifier

1
21. Which of the following is not a decision making statement
i. if..else statement ii. for statement iii. if-elif statement iv. if statement
22. …………loop is the best choice when the number of iterationsare known.
i. while ii. do-while iii. for iv. None of these
23. How many times will the following code be executed.a=5while a>0: print(a) print(“Bye”)
i. 5 times ii. Once iii. Infinite iv. None of these
24. What abandons the current iteration of the loop
i. continue ii. stop iii. infinite iv. Break
25. Find the output of the following python program for i in range(1,15,4): print(i, end=’,’)
i. 1,20,3 ii. 2,3,4 iii. 1,5,10,14 iv. 1,5,9,13
26. …………loop is the best when the number of iterations are notknown.
i. while ii. do-while iii. for iv. None of these
27. In the nested loop ……………..loop must be terminated before the outer loop.
i. Outer ii. enclosing iii. inner iv. None of these
28. …………..statement is an empty statement in python.
i. pass ii. break iii. continue iv. If
29. How many times will the following code be executedfor i in range(1,15,5): print(i,end=’,’)
i. 3 ii. 4 iii. 1 iv. Infinite
30. Symbol used to end the if statement:
i. Semicolon(;) ii. Hyphen(-) iii. Underscore( _ ) iv. colon(:)

PART – B
ERROR FINDING QUESTIONS
Q1. Find error in the following code(if any) and correct code by rewriting code and
underline the correction;‐
x= int(“Enter value of x:”) for in
range [0,10]:
if x=y print( x + y)
else: print( x‐y)
Q2. Rewrite the following program after finding and correcting syntactical errors and
underlining it.
a, b = 0
if (a = b)
a +b =c print( z)
Q3. Rewrite the following code in python after removing all syntax error(s). Underline each
correction done in the code.
250 = Number
WHILE Number<=1000:
if Number=>750 print
(Number)
Number=Number+100
else
print( Number*2)
Number=Number+50

2
Q4. Rewrite the following code in python after removing all syntax error(s). Underline each
correction done in the code.
25=Val
for I in the range(0,Val) if I
%2==0:
print( I+1)
Else:
print (I-1)
Q5. Rewrite the following code in python after removing all syntax error(s). Underline each
correction done in the code.
STRING=""WELCOME NOTE""
for S in range[0,8]:
print (STRING(S))

Q6. Rewrite the following code in python after removing all syntax error(s). Underline each
correction done in the code.
a=int{input("ENTER FIRST NUMBER")}
b=int(input("ENTER SECOND NUMBER"))
c=int(input("ENTER THIRD NUMBER"))
if a>b and a>c
print("A IS GREATER")
if b>a and b>c:
Print(" B IS GREATER")
if c>a and c>b:
print(C IS GREATER)

Q7. Rewrite the following code in python after removing all syntax error(s). Underline each
correction done in the code.
i==1
a=int(input("ENTER FIRST NUMBER"))
FOR i in range[1, 11];
print(a,"*=", i ,"=",a * i)

Q8. Rewrite the following code in python after removing all syntax error(s). Underline each
correction done in the code.
a=”1”
while a>=10:
print("Value of a=",a) a=+1

Q9. Rewrite the following code in python after removing all syntax error(s). Underline each
correction done in the code.

Num=int(rawinput("Number:")) sum=0
for i in range(10,Num,3)
Sum+=1 if i
%2=0:
print(i*2) Else:
print(i*3 print Sum)

3
Q10. Rewrite the following code in python after removing all syntax error(s). Underline each
correction done in the code.

weather='raining' if
weather='sunny':
print("wear sunblock") elif
weather='snow':
print("going skiing")
else:
print(weather)

Q11. Write the modules that will be required to be imported to execute the following code in
Python.

def main( ):
for i in range (len(string)) ):
if string [i] = = ‘’ “
print
else:
c=string[i].upper()
print( “string is:”,c)
print (“String length=”,len(math.floor()))

Q12. Observe the following Python code very carefully and rewrite it after removing all
syntactical errors with each correction underlined.

DEF execmain():
x = input("Enter a number:") if
(abs(x)=x):
print ("You entered a positive number") else:
x=*‐1
print "Number made positive:"x execmain()

Q13. Rewrite the following code in python after removing all syntax error(s). Underline each
correction done in the code.

30=To
for K in range(0,To)
IF k%4==0:
print (K*4)
else
print (K+3)

4
OUTPUT FINDING QUESTIONS

Q1. Find output generated by the following code:


p=10
q=20
p*=q//3
q+=p=q**2
print(p, q)
Q2. Find output generated by the following code:
a=(2 + 3) ** 3 – 6 / 2
b=(2 + 3) * 5// 4 + (4 + 6) / 2
c=12 + ( 3 * 4 – 6 ) / 3
d=12 % 5 * 3 + (2 * 6) // 4
print(a, b, c, d)

Q3. Find out the output of the Following –


x=20
x=x+5
x=x‐10
print (x)
x, y=x-1,50
print(x,y)

Q4. Find out the output of the Following –


for a in range(3,10,3):
for b in range(1,a,2):
print(b, end=’’ )
print( )

Q5. Find Output of Following


x=10
y=5
for i in range(x‐y*2):
print("%",i)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy