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

Unit1 - Revision Paper PDF

The document contains a revision paper for Class XII Computer Science students. It includes 25 questions on topics like tokens, data types, operators, loops, functions, errors, dictionaries and sorting algorithms. Students are asked to identify tokens, predict output, find errors, define concepts, solve problems and write programs related to Python programming.

Uploaded by

Pavithra Pavi
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)
59 views5 pages

Unit1 - Revision Paper PDF

The document contains a revision paper for Class XII Computer Science students. It includes 25 questions on topics like tokens, data types, operators, loops, functions, errors, dictionaries and sorting algorithms. Students are asked to identify tokens, predict output, find errors, define concepts, solve problems and write programs related to Python programming.

Uploaded by

Pavithra Pavi
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/ 5

Jai Gurudev

Maharishi School of Excellence Senior Secondary


Class: XII ​ ​ ​ Computer Science – Revision Paper unit-1
Dear students,
​ ​Please refer class XI text book chapters 6 to 13 to solve this exercises

1. Token : The smallest individual unit in a program is known as Token. It consists of Keyword,
Identifiers(Names), Literals(constants), Operators, Punctuators.
See the example and do the same for the following
Tokens Names
Var1 Valid identifier
123abc Invalid identifier
: Punctuators
True Keyword
true Valid identifier
% operators

Name the following


Tokens Names Tokens Names
Var1 else
_name123 def
123abc \\
: %
123 “
123.45 “abc”
if False
Else True
elif []
while Xyz
for ACE
+ _n1%
= break
== My.file
>= ZZ123
< Data-rec
and Data_rec
in Date_9_7_1997
! @square
var@123 <=

2. Predict the output for the following


a. Count = 0
while count<10:
​print(“Hello”)
​count+=1

b. X= “one”
Y= “two”
Count = 0
while count < len(x):

https://dl-mail.ymail.com/ws/download/mailboxes/@.id==VjN…38ckxQ8Le36_udQhdkSO5ASqs1iqbILarnrkRBv1D8ItLCBJ58D 12/04/20, 12:00 PM


Page 1 of 5
​print(x[count],y[count])
​count+=1

3. Find the errors and write the corrected codes


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

1. What is python?
2. What is a variable?
3. How can we declare variable in python?
4. What is a keyword?
5. When we write a statement like a,b,c,d =1,2,3,4 what does you call it
?- Multiple Assignment
6. How the ‘/’ operator is different from ‘%’ operator and ‘//’ operator?
7. Define unary, binary, ternary operators with example
8. What is data type?
9. Name the basic and sequence data type in python
10. Differentiate between floor() and ceil() function
11. Differentiate between sqrt () and pow() function
12. Define Looping statement with example
13. Find the output of the following codes:
a. ​
b. i=1
While i<5:
​Print( i )
​I=i*2

c. total = 0
sum1 = 0
​ for i range (0,10):
​ ​sum1 = sum1 + i
​ print(total)

d. a = 0
for i range (10):
a=a+1
​ print(a)

https://dl-mail.ymail.com/ws/download/mailboxes/@.id==VjN…38ckxQ8Le36_udQhdkSO5ASqs1iqbILarnrkRBv1D8ItLCBJ58D 12/04/20, 12:00 PM


Page 2 of 5
e. a=0
for i in range(10):
​a = a+1
for j in range(10):
​a = a+1
print(a)

f. a=0
for i in range(10):
​a=a+1
​for j in range(10):
​ ​a = a+1
print(a)

14. Find syntax error(s), if any, in the following program:


Max = ‘4’
a = int(input(“Enter the value of a:”))
b=int(input(“Enter the value of b:”))
if(a>b)
max = 5
for x in range(0, My_Message):
​ ​print(x)

Ans: ​the errors are:


​Max = ‘4’ ​ ​#Error 1
​a= int(input(“Enter the value of a:”))
​b= int(input(“Enter the value of b:”))
​if(a>b): ​ ​ ​#Error 2
​ for x in range(0,Max): #Error 3
​ ​ ​print(x)

The correct program is:


​Max = 4 ​ ​ ​# correction 1
​a = int(input(“Enter the value of a:”))
​b = int(input(“Enter the value of b:”))
​if (a>b): ​ ​ ​# correction 2
​ for x in range(0,Max): # correction 3
​ ​ ​print(x)

15. Find the output


S1 = s2 =0

https://dl-mail.ymail.com/ws/download/mailboxes/@.id==VjN…38ckxQ8Le36_udQhdkSO5ASqs1iqbILarnrkRBv1D8ItLCBJ58D 12/04/20, 12:00 PM


Page 3 of 5
for x in range(0,5):
​num = int((“Enter the value of numbers:”))
​if (num>0):
​ s1 = s1+num
​else:
​ s2/=num
print(s1,s2)

16. Will the following code produce any result? Justify your answer?
X=”MyPython”
Y=2
print(X+Y)
17. What is dynamic data types? Give an example?
In python, the values that a variable has always hold a data type but
the variable itself has no strict type in its definition. You can reuse
the same variable to point to an object of a different type. This is
called dynamic type.
Eg:
>>>val = 10
>>> val
10
>>>val=’ten’
>>>val
‘ten’ ​-> here variable val is dynamic data type.

18. What is meant by type casting/Explicit conversion? Give example?


Type casting is a way to convert a variable from one data type to
another data type.
Example: x=10
​ Y=6
​ print(int(x/y))
19. Find the output of the following:
Var1=10.542345667
format(var1,’.5f’)
format(var1,’.2f’)
20. Find the output
a. X=0
for I in range(5):
​x+=1
​print(x)
b. X=0
for i in range(5):

https://dl-mail.ymail.com/ws/download/mailboxes/@.id==VjN…38ckxQ8Le36_udQhdkSO5ASqs1iqbILarnrkRBv1D8ItLCBJ58D 12/04/20, 12:00 PM


Page 4 of 5
​for j in range(5):
​ ​x+=1
print(x)

21. What type of objects can be used as keys in dictionaries?


22. What is the difference between (3),(3,)
23. Why is the dictionary termed as an unordered collections of
objects?
24. What’s a[1:1] if a is a string of at least 2 characters?
25. What is Mapping, Nesting, Packing, UnPacking with example?
26. Write a program to sort the given list by use of (1. Bubble sort,
​2. Insertion sort)

https://dl-mail.ymail.com/ws/download/mailboxes/@.id==VjN…38ckxQ8Le36_udQhdkSO5ASqs1iqbILarnrkRBv1D8ItLCBJ58D 12/04/20, 12:00 PM


Page 5 of 5

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