Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

WEEKLY TEST - 1

CLASS: XI MARKS: 30
SUBJECT: COMPUTER SCIENCE
I. Answer the following (5*1 =5)

1. Which of the following is an invalid variable?


a) my_day_2 b) 2nd_day c) Day_two d) _2
2. Which of the following is not a keyword?
a) eval b) assert c) nonlocal d) pass
3. Which of the following cannot be a variable?
a) _init_ b) in c) it d) on
4. Which of these is not a core data type?
a) Lists b) Dictionary c) Tuples d) Class
5. How would you write xy in Python as an expression ?
a) x^y b) x**y c) x^^y d) none of these
II.Answer the Following (3*2=6)
6. What are tokens in Python? How many types of tokens are allowed in Python? Exemplify
your answer.
7. How are keywords different from identifiers?
8. What are literals in Python? How many types of literals are allowed in Python?

III.Answer the Following (3*3=9)


9. Predict the output of the following code fragments:
count = 0
while count < 10:
print ("Hello")
count += 1
10.Predict the output of the following code fragments:

x = 10
y=5
for i in range(x-y * 2):
print (" % ", i)
11.Predict the output of the following code fragments:

c=0
for x in range(10):
for y in range(5):
c += 1
print (c)
IV. Answer the Following (2*5=10)
12.Write a program to print one of the words negative, zero, or positive, according to
whether variable x is less than zero, zero, or greater than zero, respectively.
13.Write a program that returns True if the input number is an even number, False
otherwise.

You might also like