Final-Half Yearly XI CS (4 Sets)
Final-Half Yearly XI CS (4 Sets)
E
N
D
R
I
Y
A
V
I
D
Y
A
L
A
Y
A
S
A
N
G
A
T
H
A
N
H
A
L
F
Y
E
A
R
L
Y
E
X
A
M
I
N
A
T
I
O
N
2
0
2
4
-
2
5
CLASS:XI
TIME: 03HOURS
SUBJECT: COMPUTERSCIENCE(083)
[BLUEPRINT] (Q=QUESTIONS, M= MARKS)
21 Marks (UNIT I chapters a,b,c) + 49 marks(UNIT II chapters
a,b,c,d,e,f,g)
UNIT TOPIC (18 (7 (5 (2
NO. QUESTIONS) QUESTIONS) QUESTIONS) QUESTIO
1 Mark 2 Marks 3 Marks 4 Mar
SEC A SEC B SEC C SEC D
Section A
1. Which of the following is not a valid python operator?
a. % b. in c. # d. **
a.integer
b.Floating point
c.String
d.None of These
8. Which of the following is not a core data type in Python?
a. Boolean
b. integers
c. strings
d. Class
i=5
while(i<=5):
i=i-2
a. Infinite
b. 1
c. 5
d. 0
10. Flowchart is the pictorial representation of ________
a. Flowgraph
b. Algorithm
c. Data Flow Diagram
d. None of These
11. Name the function to remove the last element from a list
a. add()
b. delete()
c. pop()
d. None of These
12. The I/O devices are connected to the CPU via __________.
a. SDRAM's
b. Control circuits
c. Signals
d. BUS
c. 10
d. 12
16. Amongst which of the following is / are the Numeric Types of Data Types?
a. int
b. float
c. complex
a. Exponentiation
b. Modulus
c. Floor division
Section B
19. Draw the equivalent logic circuit for the following expression:
Y=(A .B)’.B.C’
20. What is CPU?Write down different components of CPU ?
a = True
b = False
c = False
if not a or b:
print(1)
elif not a or not b and c:
print(2)
elif not a or b or not b and a:
print(3)
else:
print(4) (4)
25. What is the difference between = and == operator?
SECTION C
26. Convert 110 0110 0001(2) to hexadecimal and octal and decimal.
num=12345678
while(num>0):
r=num%10
if(r==5):
continue
elif(r==2):
break
else:
print(r)
num=num//10
28. Following is a piece of code for finding sum of digits of a number. Fill the missing statement
i=123
sum=0
while(____________): #statement1
r=i%10
sum=______________#Statement2
i=_________________#Statement3 to update i
print(sum)
29. Explain the use of indentation in Python with an example.
30. What are De Morgan's laws in Boolean algebra? What is the result of applying NOT to the output
of an OR gate with inputs 0 and 1?
SECTION D
31. Ujjaini got a python program to check whether a given year is leap year or not but with some
missing statements. Help her to complete the code to accomplish the task.
year=int(input("Enter the year"))
if(____________):#statement1
if(___________):#statement2
if(__________):#statement3
print("Leap year")
else:
print("Not a Leap Year")
else:
print(________________)#statement4
else:
print(“Not a leap year”)
OR
Mar
Q No Question
ks
SECTION A
1 Which of the following is not a valid python operator? 1
a) % b) in c) # d) **
ANS: c. #
2 Which of the following is not a secondary storage device 1
a. Hard Disk b. Floppy Disk
c. RAM d. None Of These
ANS: c. RAM
3 Which of the following Boolean expression always evaluates to False? 1
a.A+A’ b. A.A
c.A+0 d.None of These
ANS: d. None of These
4 Which of the following is an invalid identifier 1
a.Data#base
b.var_new
c._abcd9
d.None of These
ANS a.Data#base
5 Which of the following is not an arithmetic operator 1
a.**
b.//
c.#
d.None of These
ANS c.#
6 Select the correct output of the following python code: 1
str=”My program is program for you”
t = str.split(“program”)
print(t)
a) [‘My ‘, ‘ is ‘, ‘ for you’]
b) [‘My ‘, ‘ for you’]
c) [‘My’,’ is’]
d) [‘My’]
ANS a) [‘My ‘, ‘ is ‘, ‘ for you’]
16 Amongst which of the following is / are the Numeric Types of Data Types? 1
a. int
b. float
c. complex
d. All of the mentioned above
ANS d. All of the mentioned above
24 a = True 2
b = False
c = False
if not a or b:
print(1)
elif not a or not b and c:
print(2)
elif not a or b or not b and a:
print(3)
else:
print(4) (4)
Predict the output of above code?
ANS 3
25 What is the difference between = and == operator? 2
ANS 2 marks for 2 difference
SECTION C
26 Convert 110 0110 0001(2) to hexadecimal and octal and decimal 3
ANS hex 661[1 mark]
Oct 3141[1 mark]
Dec 1633[1 mark]
27 Find the output of the following code 3
num=12345678
while(num>0):
r=num%10
if(r==5):
continue
elif(r==2):
break
else:
print(r)
num=num//10
Ans:
8
7
6
28 Following is a piece of code for finding sum of digits of a number.Fill the missing 3
statements
i=123
sum=0
while(____________):#statement1
r=i%10
sum=______________#Statement2
i=_________________#Statement3 to update i
print(sum)
ANS:
Statement 1 i > 0 [1mark]
Statement1 sum+r [1 mark]
Statement2 i//10 [1 mark]
29 Explain the use of indentation in Python with an example. 3
ANS [1.5 Mark for correct definition of indentation,1.5 mark for example]
30 What are De Morgan's laws in Boolean algebra? What is the result of applying NOT 3
to the output of an OR gate with inputs 0 and 1?
ANS .[2 mark for correct definition with the expression of De Morgan’s law]
The output of the OR gate is 1, and applying NOT to this output gives 0.
[1 mark]
SECTION D
31 Ujjaini got a python program to check whether a given year is leap year or not but 4
with some missing statements.Help her to complete the code to accomplish the task.
year=int(input("Enter the year"))
if(____________):#statement1
if(___________):#statement2
if(__________):#statement3
print("Leap year")
else:
print("Not a Leap Year")
else:
print(________________)#statement4
else:
print(“Not a leap year”)
OR
Raju wants to accomplish following tasks in python
i)To print first 100 even natural numbers
ii)To print first 10 multiples of number 5
As a python expert help him to write the code
ANS Statement1:year%4==0 [1 mark]
Statement2:year%100==0 [1 mark]
Statement3:year%400==0 [1 mark]
Statement4:”Leap year” [1 mark]
OR
Ans:
i)for i in range(2,101,2): [ 2 marks ]
print(i)
ii)for i in range(5,55,5): [2 marks]
print(i)
32 Write a program to check whether a number is amstrong number or not. 4
n =int(input()) -> taking input from user[1/2 mark]
s = n # assigning input value to the s variable[1/2 mark]
b = len(str(n))[1/2 mark]
sum1 = 0
while n != 0: [2 Marks]
r = n % 10
sum1 = sum1+(r**b)
n = n//10
if s == sum1:
print("The given number", s, "is armstrong number")[1/2 mark]
else:
print("The given number", s, "is not armstrong number")
SECTION E
33 Write a program to check whether a given number is prime or not? 5
Ans:
num = int(input("Enter a number: "))
# defining a flag variable
flag = 1
# Checking for factors
for i in range(2, (num//2)):
if num % i == 0:
flag = 0
break
# Display output
if flag == 1 and num >= 2:
print(num, "is a prime number.")
else:
print(num, "is not a prime number.")
[1/2 mark for reading the number 2 marks for correct loop
formation and 2 ½ marks for correct program logic]
Introduction to (1M)
problem solving (1Q)
Getting started (1M)
with python (1Q)
Python (2M)
fundamentals (2Q)
Data Handling (1Q) (1Q) (1Q) (9M)
SECTION–A
1 d) RAM 1
2 c) 44 1
3 d) ESCII 1
4 c) 1010 1
5 a) A.B’+C’. D 1
6 a) Keywords 1
7 b) name = 'Jiya', c) name = "Jiya" 1
8 b) string 1
9 b) 14.75 1
10 b) and c) 1
11 c) [6, 4, 2] 1
12 c) len() 1
13 a) False True 1
14 C) [20, 30, 40] 1
15 a) and d) 1
SECTION–B
16 (23D) = (1000111101) 1+1=2
16 2, (BC9)16 = (101111001001)2
b) print("tuple") ⇒ tuple
It will simply print the item inside the print statement as it is of string type.
It will simply print the item inside the print statement as it is of string type.
a, b = 5.0, 10.0
x = float(a/b)
print(x)
26 n = int(input("Enter number of items: ")) 3
cost = 0
if n >= 100:
cost = n * 70
elif n >= 10:
cost = n * 100
else:
cost = n * 120
print("Total Cost =", cost)
27 dict_keys([5, 'a'])
dict_values([[6, 7, 8], (1, 2, 3)])
keys() function returns all the keys defined in the dictionary in the form of a list.
values() function returns all the values defined in the dictionary in the form of a
list.
28 n=int(input("Enter a number : ")) 3
f=1
for i in range (1,n+1):
f=f*i
print("The factorial is : ",f)
or
n=int(input("Enter number : "))
for i in range(1,11):
print(n," X " ,i," = " ,n*i)
(1 mark for correct input, 1 mark for correct process and 1 mark for correct output)
29 a) Number=int(input(“Enter Number”)) # int function 4(1+3)
DoubleTheNumber = Number*2
print(DoubleTheNumber) # p of Print should be in lowercase
1⁄2 + 1⁄2 marks for identification and correction.
b) k=4
for i in range(1,6):
for j in range(0,k):
print('_', end=" ")
for j in range(k+1,6):
print(j, end=" ")
k=k-1
print()
1+1 mark for each correct loop
1 mark for correct print statement
30 hr = int(input("Enter hour between 1-12: ")) 4
n = int(input("How many hours ahead: "))
s = hr + n
if s > 12:
s -= 12
print("Time at that time would be: ", s, "O'clock")
1+1 mark for correct selective statement and indentation
1+1 mark for correct input and print statement
32 (a) L.insert(4,100) 5
(b) L.append(100)
(c) L.pop(1)
(d) L.remove(100)
(e) L.extend(L2)
For each
1⁄2 mark for use of correct list methods, 1⁄2 mark for correct statement.
33 str = input("Enter a string: ") 5
words = str.split()
newStr = ""
for w in words:
rw = ""
for ch in w:
rw = ch + rw
newStr += rw + " "
print(newStr)
1+1 mark for each correct loop
1 mark for correct print statement and function
KENDRIYA VIDYALAYA SANGATHAN
A. 30 B. ‘1000’ C. 4 D.200
12. What is the output of the following
L=[None] *10
print(len(L))
A. 10 B. 0 C. Syntax Error D. None
SECTION B 7X2=14
19. Write the name of two input and two output devices.
20. What is the binary representation of the decimal number 25? Show the detailed steps.
21. Give examples of two commonly used logic gates and their truth tables.
23. Identify error in the following code. Rewrite the corrected code after removing errors and
a,b=input(“Enter value:”)
result=a/*b
print result
24. Consider the statements given below and then choose the correct output from the given options:
str=”MISSISSIPPI”
print(str[:4]+”#”+str[-5:])
25. Ashi has written the following code in python but did not get the expected result. Help her to
rectify the errors. Underline the corrected statements having errors
a=4
b=’5’
print(a*b)
print(a+b)
SECTION C 5X3=15
26. What is De Morgan's law in Boolean algebra? Provide both forms of the law and illustrate with an
example.
27. Differentiate between RAM and ROM in terms of functionality and volatility.
28. Describe the process of converting a binary number into its hexadecimal equivalent. Provide step-
text="LearningCS"
L=len(text)
ntext=""
for i in range (0,L):
if text[i].islower():
ntext=ntext+text[i].upper()
elif text [i].isalnum():
ntext=ntext+text[i:1]
else:
ntext=ntext+'&&'
print(ntext)
30. Write a Python program that takes an integer as input and returns "Positive" if the number is
greater than zero, "Negative" if it is less than zero, and "Zero" if it is zero.
SECTION D 2X4=8
31. Given the list marks = [45, 67, 89, 34, 56, 78, 90, 55], perform the following operations:
32. Write a for loop that prints all the numbers from 1 to 10 except the ones divisible by 3.
SECTION E 3X5=15
33. Write a Python program using a while loop to find the sum of all odd numbers between 1 and 15.
If the number is 13, skip it using continue.
34. Write a Python script to count and print the number of vowels (a, e, i, o, u) in a given string.
Example:
B. Hertz
C. RAM
3. What is the maximum decimal value that can be represented with 8 bits?
B. 255
4. Which data representation system uses 16 symbols (0-9 and A-F) to represent values?
C. Hexadecimal
A. A'
B. 2nd_var
C. Decision
10. The term which divides a large task into smaller parts is known as ___________
C. Decomposition
lst1[3] = '1000'
lst1[2] = '200'
lst1.insert(3, 4)
lst1.insert(2, 3)
print(lst1[-4])
C. 4
L = [None] * 10
print(len(L))
A. 10
A. 4+'3'
n = input("enter a word")
print(type(n))
D. [8,6,4,2]
B. Netbeans
17. Rudra is working in Python where he is getting instant results for his single line statement, identify the
mode of Python from the following:
B. Interactive Mode
18.Which method would you use to figure out the position of an item in a list?
D. index()
19. Write the name of two input and two output devices.
20. What is the binary representation of the decimal number 25? Show the detailed steps.
25 ÷ 2 = 12 remainder 1
12 ÷ 2 = 6 remainder 0
6 ÷ 2 = 3 remainder 0
3 ÷ 2 = 1 remainder 1
1 ÷ 2 = 0 remainder 1
AND Gate:
| A | B | Output |
|---|---|--------|
|0|0|0 |
|0|1|0 |
|1|0|0 |
|1|1|1 |
OR Gate:
| A | B | Output |
|---|---|--------|
|0|0|0 |
|0|1|1 |
|1|0|1 |
|1|1|1 |
Algorithm:
1. Start
4. Display `product`
5. End
23. Identify error in the following code. Rewrite the corrected code after removing errors and underline the
corrections:
print(result)
24. Consider the statement given below and then choose the correct output from the given options:
str = "MISSISSIPPI"
B. MISS#SIPPI
25. Ashi has written the following code in Python but did not get the expected result. Help her to rectify the
errors. Underline the corrected statements having errors:
a=4
b = '5'
26. What is De Morgan's law in Boolean algebra? Provide both forms of the law and illustrate with an example.
De Morgan's Laws:
1. The complement of the conjunction of two terms is the disjunction of their complements: `¬(A ∧ B) = ¬A
∨ ¬B`
2. The complement of the disjunction of two terms is the conjunction of their complements: `¬(A ∨ B) = ¬A
∧ ¬B`
Example:
27. Differentiate between RAM and ROM in terms of functionality and volatility.
Storage Type:
Volatility:
Modification:
28. Describe the process of converting a binary number into its hexadecimal equivalent. Provide step-by-step
instructions and an example conversion to demonstrate your answer.
Steps:
1. Group the binary number into sets of four bits starting from the right. Add leading zeros if necessary.
Conversion: `1101` (13 in decimal) is `D` in hex, `0110` (6 in decimal) is `6` in hex.
Hexadecimal: `D6`
text = "LearningCS"
L = len(text)
ntext = ""
if text[i].islower():
elif text[i].isalnum():
else:
print(ntext)
OUTPUT: LEARNING
30. Write a Python program that takes an integer as input and returns "Positive" if the number is
greater than zero, "Negative" if it is less than zero, and "Zero" if it is zero.
num = int(input("Enter an integer number: "))
if num > 0:
print("Positive")
print("Negative")
else:
print("Zero")
marks.extend([60, 70])
2. Remove the mark 34 from the list.
marks.remove(34)
marks.insert(2, 50)
marks.sort(reverse=True)
Output:
Modified list: [90, 89, 78, 70, 67, 60, 55, 50, 45]
32. Write a for loop that prints all the numbers from 1 to 10 except the ones divisible by 3.
if num % 3 != 0:
print(num)
Output:
1
2
4
5
7
8
10
Section E: Long Answer questions
33. Python program using a while loop to find the sum of all odd numbers between 1 and 15, skipping 13.
num = 1
sum_odd = 0
if num == 13:
num += 1
continue
if num % 2 != 0:
sum_odd += num
num += 1
Output:
vowels = "aeiouAEIOU"
count = 0
if char in vowels:
count += 1
Output:
initial_list = [10, 5, 8, 2]
initial_list.extend([15, 3, 7])
Remove duplicates
unique_list = list(set(initial_list))
unique_list.sort(reverse=True)
Output:
if(str[i].isalpha()):
print(str[i-1],end='')
if(str[i].isdigit()):
print(str[i],end='')
(b)
s='mahender, singh, dhoni'
s1=s.split()
for i in s1:
if(i>'n'):
print(i.upper()) else:
print(i)
OR
Write a Python Program to check First Occurrence of a Character in a String.
33 Find Output: 5
list1 =["python","list",1952,2323,432] list2 =
["this", "is", "another","list"]
print(list1[1:4])
print(list1[1:])
print(list1[0])
print(list1 * 2)
print(list1+list2)
COMPETENCY BASED QUESTIONS
SECTION E (02QUESTIONS)
34 Find Output: 4
a,b,c=1,1,2
d=a+be=1.0
f=1.0g=2.0
h=e+f
print(c==d)
print(c is d)
print(g==h)
print(g is h)
O
R
Find the errors
(a) a=bool(0) b=bool(1)
print(a==false)print(b==true)
(b) name=”Ramesh”print(name)
name[2]=’v’
print(name)
35 Write a python program to input a sentence and count the number of vowels used in 4
the sentence
KENDRIYA VIDYALAYA SANGATHAN
HALF YEARLY EXAM
SUBJECT : COMPUTER SCIENCE
CLASS : XI
MARKING SCHEME
M.M.70 TIME:03HRS
OBJECTIVE TYPE
QUESTIONS
SECTION A (18 QUESTIONS)
1 (b) System Software 1
2 Internal / Main/ Primary 1
3 1010 1
4 (d) ESCII 1
5 XOR 1
6 Associative Law 1
7 Flow chart & Pseudo code 1
8 GuidoVan Rossum 1
9 String 1
10 Case 1
11 False 1
12 10 1
13 Break/continue 1
14 [0,1,2] 1
15 partition() 1
16 0 1
17 Del 1
18 All of these 1
VERY SHORT TYPE QUESTIONS
SECTION B (07 QUESTIONS )
19 A compiler translates the entire source code in a single run. An interpreter 2
translates the entire source code line by line. It consumes less time i.e., it is faster
than an interpreter. It consumes much more time than the compiler i.e., it is slower
than the compiler.
20 Unicode is a universal character encoding standard. This standard includes 2
roughly 100000 character store present characters of different languages.While
ASCII uses only 1byte the Unicode uses 4 bytes to represent characters. Hence, it
provides a very wide variety of encoding.
21 A’B+AB’ 2
22 2
23 3 2
6
9
12
15
24 OneTwoTwo 2
OneTwoTwo
25 A list that occurs as an element of another list (which may of course itself be an 2
element of another list etc) is known as nested list. E.g. [1,2,3,[4,5],6]
SHORT TYPE QUESTIONS
SECTION C (05 QUESTIONS )
26 Mainly computer system consists of three parts, that are central processing unit (CPU), 3
Input Devices, and Output Devices.The Central Processing Unit(CPU) is divided into
two parts again:arithmetic logic unit(ALU) and the control unit (CU). The set of
instruction is in the form of raw data.
32 (a) mPytho123.co 5
(b) mahender,SINGH,
dhoni
OR
string=input("PleaseenteryourownStri
ng:")
char=input("PleaseenteryourownCharacter:")
flag=0
for i in range(len(string)):
if(string[i]==char):
flag=1break
if(flag==0):
print("Sorry! We haven't found the Search Character
in this string")
else:
print("The first Occurrenceof",char," is Foundat Position",i+1)
33 ['list',1952, 2323]
['list',1952, 2323, 432]
python
['python','list',1952, 2323,432,'python','list',1952, 2323,432]
['python','list',1952,2323,432,'this', 'is','another','list']
COMPETENCY BASED QUESTIONS
SECTION E (02 QUESTIONS )
34 TrueTrueTrueFalse 4
35 sen=input('Enter any sentence ') 4
vow ='AEIOU'
count=0
for ch in sen:
if ch.upper() in vow:
count=count+1
print('Number of vowels in sentence ', count)