Professional Documents
Culture Documents
CLASS-XI
COMPUTER SCIENCE
HALF YEARLY EXAMINATION-2020
MM:70 TIME: 03 HRS
GENERAL INSTRUCTIONS:
Q1(a). Write and explain break and continue statements with the help of suitable examples. [2]
import random
import math
print(math.ceil(random.random()))
(c) Write different loop constructs used in python. Also compare their usage. [2]
x=1237896
s=0
while x:
s=s+x%10
x=int(x/10)
print( s)
Y=A%B//A
word="green vegetables"
print(word.find('g',2))
print(word.find('g',2))
print(word.find('g',2))
(h) Write the output of the following python code: [2]
text="yahooMail."
l=len(text)
ntext=""
for i in range(0,l):
if text[i].isupper():
ntet=ntext+text[i].lower()
elif text[i].isalpha():
ntext=ntext+text[i].upper()
else:
ntext=ntext+'#'
print(ntext)
Q3. (a) WAP that accepts a string as a parameter and counts total vowels and consonants in the given
string. [3]
(b) WAP that takes a string as a function parameter and removes every vowel character from the
given string. [3]
If Original string is:” We are learning python”
New string is: “W r lrnng pythn”
(c) Write a Program that takes a string from the user and counts total words in the string beginning
with vowels.
X=”My umbrella is lost today in the school. All students offered me for the for their umbrella
sharing” [3]
Total Words are:6
(d) Write a python function that takes a string and searches for the existence of any given word in the
string. [3]
X=”Army Public School Ranikhet”
If Given Word is = “Public” the program should print Found……message.
(e) Write a program to input a password and checks whether the given password is Strong or Weak.
The Strong Password must be at least 8 Char long and must be the combination of a Upper Case,
Lower Case, Digit and a Special Character. [3]
Q4(a). What is a comment in programming? Explain different types of comments in python. [2]
(b) Define Keywords with the help of suitable example. [2]
(c) What is type casting? Write an Expression to explain the use of type casting. [2]
(d) What is the meaning of Data Type? Write the Difference between Mutable and Immutable Data
Types in python with the help of their examples. [2]
(e) What is Identifier? Explain with the help of example. [2]
(c) Write a python Program to print a Fibonacci Series upto N terms. [2]
(d) Write a Program to check for a leap year. [2]
(e) Write a program to find the sum of given series: [2]
1+1/22 – 1/33 + 1/44- …………………….1/nn