Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

SAMPLE PAPER-V Class XI (Computer Science) Periodic Test-I

Computer Science
Periodic Test - 1
Topics covered: getting started with python, python fundamentals, data handling
Max marks: 50 Time: 90 mins

1) What are the limitations of python programming language? Or what are the
minus points of python programming language? 2m
2) What is the difference between interactive mode and script mode in Python? 2m
3) Which of the following is not valid strings in Python? 2m
(a) “Hello” (b) 'Hello' (c) “Hello' (d) 'Hello” (e){Hello}
4) What is the difference between a keyword and an identifier? 2m
5) What is None literal in Python? 2m
6) What are literal in Python? How many literals are allowed in Python? 2m
7) Identify the errors and rewrite the corrected code 2m

Name =”Rehman’

Print (“Greetings!!!’)

print(“Hello”, name)

print (“How do you do?”

8) What is the difference between an expression And a statement in Python? 4m


9) WAP to read temperature in Celsius and convert it into Fahrenheit °C x 9 / 5 + 32
=F 4m
10) Explain following mathematical function with example 4m
(A) Floor
(B) Pow
11) Write corresponding Python expression 4m

(1) √a2+b2+c2
(2) P+ q/(r+s)4
(3) |e2-x|
(4) 2-ye2y+4y
12) What will be the output produced by these? 2m
(A) 14//14
(B) 14%4
(C) 14.0/4
(D) 14.0//4
13) What will be the output of the following? 2m
print(Len(str(17//4)))
print(Len(str(17/4)))
14) What will be the output of the following code? Explain the reason behind output
of every line. 4m
A) 5 < 10 or 5
B) 5 < (10 or 5)
C) 5 < (5 or 10)
D) 5 < 5 or 10
15) WAP to read base, width and height of a parallelogram and calculate it’s area and
perimeter. 4m
16) What are immutable and an mutable typed? List immutable and mutable types of
python. 4m
17) Identify the types of following literals? 2m
(1) 23.789
(2) 23789
(3) True
(4) ‘True’
18) What do you understand by block/ code block/ suite in Python? 2m

Periodic test – 1
Answer Key/ Marking scheme

1) What are the limitations of python programming language? Or what are the
minus points of python programming language? 2m
Ans: following are the limitations of python programming language
a) It is not fastest Programming Language
b) It has lesser libraries than C, Java, Perl
c) It is not strong on type-binding
d) Not easily convertible
2) What is the difference between interactive mode and script mode in Python? 2m
Ans: In Interactive mode, instructions are given in front of Python prompt
(e.g. >>> or IN[ ]: Prompts) in python shell. Python carries out the given instruction
and shows the result there itself.
In script mode, instructions are stored in a file generally with .py extension and are
executed together in one go as a unit. The saved instructions are known as Python
Script or python program.
3) Which of the following is not valid strings in Python? 2m
(a) “Hello” (b) 'Hello' (c) “Hello' (d) 'Hello” (e){Hello}

Ans: String c, d and e are not valid strings in python.

4) What is the difference between a keyword and an identifier? 2m


Ans: Keyword: it is a special word that has special meaning and purpose. Keywords
are reserved and are few. Ex: for, if, else, while etc.
Identifier: is a user defined name given to a part of the program. Variable, object,
function, etc. they are not reserved. They are defined by the user but they can have
letters, digits and a symbol underscore. They must either begin with letter or
underscore. Ex: _chk, chess, etc.
5) What is None literal in Python? 2m
Ans: it is special literal in python. It is used to indicate something that has not yet
been created in simple words, or absence of value. It is also used to indicate the
end of lists in python.
6) What are literal in Python? How many literals are allowed in Python? 2m
Ans: literals means constants i.e. the data items that never change their value
during a program run. Python allows five types of literals.
a. String literals
b. Numeric literals
c. Boolean literals
d. Special literals None
e. Literals collections like tuples, lists, etc.
7) Identify the errors and rewrite the corrected code 2m
Name =”Rehman’
Print (“Greetings!!!’)
print(“Hello”, name)
print (“How do you do?”
ans: Name =”Rehman”
print (“Greetings!!!”)
print(“Hello”, name) #indentation
print (“How do you do?”) #indentation
8) What is the difference between an expression and a statement in Python? 4m
Expression Statement
Legal combination of symbols Programming instruction as per
python syntax
Represents something Does something
Python evaluates it Python executes it
End result is a value Need not result in a value
Ex; 2.3 Ex: print(“hello”)
(3+5)/4 If a > 0:

9) WAP to read temperature in Celsius and convert it into Fahrenheit °C x 9 / 5 + 32 =


F 4m
# Celsius to Fahrenheit
C = float(input(“Enter temp. in Celsius”))
print(“Temp. in Celsius is:” ,C)
F = C * 9/5 + 32
Print(“Temp. is Fahrenheit is:”, F)
10) Explain following mathematical function with example 4m
(A) Floor – It returns the largest integer not greater than num.
Syntax: math.floor(num)
Ex: math.floor(1.03) will give 1.0
math.floor( - 1.03) gives – 2. 0
(B) Pow – return base raised to exp power,i.e. base exp. A domain
error occurs if base = 0 and exp <= ; also if base < 0 and exp is not
integer.
Syntax: math.pow(base, exp)
Ex: math.pow(3.0,0) f=gives value of 30
11) Write corresponding Python expression 4m
(1) √a2+b2+c2 = math.sqrt(a*a+b*b+c*c)
(2) p+ q/(r+s)4 = p + q/math.pow((r+s),4)
(3) |e2-x| = math.fabs(math.exp(2)-x)
(4) 2-ye2y+4y = 2 – y * math.exp(2*y)+4*y
12) What will be the output produced by these? 2m
(A) 14//14 = 1
(B) 14%4 = 2
(C) 14.0/4 = 3.5
(D) 14.0//4 = 3.0
13) What will be the output of the following? 2m
print(len(str(17//4)))
= len(str(4)
=len(‘4’)
=1
print(len(str(17/4)))
= len(str(4.0))
=len(‘4.0’)
=3
14) What will be the output of the following code? Explain the reason behind output
of every line. 4m
A) 5 < 5 or 10  False or 10 = 10
B) 5 < 10 or 5  True or 5 = True
C) 5 < (10 or 5)  5 < 10 = True
D) 5 < (5 or 10)  5 < 5 = False
15) WAP to read base, width and height of a parallelogram and calculate it’s area and
perimeter. 4m
Ans:
B = float(input(“Enter Base”))
W = float(input(“Enter width”))
H = float(input(“Enter height”))
Area = B * H
Perimeter = 2 * B + 2 * W
print(“area of parallelogram”, Area)
print(“Perimeter of parallelogram”, Perimeter)
16) What are immutable and an mutable typed? List immutable and mutable types of
python. 4m
Ans: Immutable types are those that can never change their values in place.
Ex: int, float, bool, strings, tuples
mutable types whose values can be changed in place.
qEx: Lists, dictionaries and sets.
17) Identify the types of following literals? 2m
(1) 23.789  floating point
(2) 23789  integer
(3) True  Boolean
(4) ‘True’  String
18) What do you understand by block/ code block/ suite in Python? 2m
Ans: Sometimes a group of statements is part of another statement or function.
Such a group of one or more statements is called block or code-block or suite.
Ex: if a< 5:
print(“A is smaller than”)
print(Thank you”) block
made by : Mrs. Mrudula Shishir Kandalkar
PGT Comp Sci.
AECS Kakrapar

You might also like