Computer Science Question Class 11 PDF
Computer Science Question Class 11 PDF
1
Modify only one line of the above code to print “Kendriya Vidyalaya” in same line.
24 Identify the types of following literals: 3
i. 23.789
ii. False
iii. “True”
iv. 34.71E-4
v. None
vi. 4+3j
25 Identify valid or invalid identifiers: 3
i. True
ii. Student-Name
iii. IF
iv. PRINT
v. 1stAge
vi. Number1
26 Find out the error in following code: 1
Salary= input(“Salary :”)
Bonus=10/100 * Salary
Print (“Bonus”, Bonus)
27 Find out the error in following code: 1
Name=input (“What is your Name”)
print(“Hi”,Name)
28 What will be the output of following code : 2
a, b = 10, 2
a, b, a= a +5, b+2, a+4
print(a, b)
29 What will be the output of following code:
2
print("Hi", "Manoj!","Good Morning", sep="#", end="$$>")
print("its", "a pleasant day.")
print("Do something good for society")
30 Find the error in the following code: 1
print(“Current GDP of India is =”, GDP)
31 State with justification whether following code contains any error (if Hindi text is in Unicode): 1
print(“ये हमारा केन्द्रीय विद्यालय है ”)
Data Handling
1 What are the core data types in Python?
2 Explain Boolean and complex data types with example. 2
3 Write the output of following code 2
DValue= 3.59 + 4j
DValue += 2 + 4j
print(DValue.real)
print(DValue.imag)
4 Following code has one error, identify the error and explain the reason: 1
Word= “Nagpur”
Word[3]=’K’
5 “Strings are not mutable”. Explain. 1
6 Do you agree that “Individual characters of a string can be accessed by using negative index”? 2
If yes than explain how?
7 Compare strings, lists and tuples. 3
2
8 How does dictionary different than strings, lists, and tuples? 2
10 What are mutable and immutable data types? Classify the data type available in python in 3
mutable and immutable categories.
11 How will you identify the type of a variable in a Python program? Explain with an example. 2
12 What is the id of an object in Python? How can you identify the id of an object explain with 3
an example.
13 “If the IDs of two objects are same than they must have same value, but if any two objects 3
have same value they may not have same ID”. Explain with an example.
14 Write an example program where two string having same values have different IDs. 2
15 What will be value of x after evaluation of each of following separately: 2
i. x = 29 / 5
ii. x = 39 // 4 * 2
iii. x = 3 ** 2 ** 2
iv. x = 2 ** 5 % 3 -5
16 How will you identify that two objects have same ids without using == operator. Explain with 2
example.
17 Differentiate equality (==) and identity (is) operators with example. 2
18 What do you mean by chained comparison operators? Explain with example. 3
19 What do you mean by precedence of operators? Explain with example. 2
20 What do you mean by associativity of operators? Explain with example. 2
21 List operators which have right to left associativity in Python. 1
22 Which operators are used make decisions after combining multiple conditions? What do you 2
call such operators? Give names of these operators.
23 What will be the type of final evaluated value of following expressions: 2
i. print (type (5*2))
ii. print (type (3 * 32 // 16))
iii. print (type (14 * 5.0 *2))
iv. print (type (50/2 + 5))
24 What will be the final output of following logical expression : 2
i. ceil()
ii. sqrt()
3
iii. floor()
iv. log()
v. pow()
33 Explain the use of following math library constants with syntax and example: 2
i. pi
ii. e
34 What will be the output of following code: 2
A= 3 + int (5/2)
B= A/2
print( A, B)
4
bonus will be 20 % of salary where salary is less than 50000 otherwise
bonus will be 25 %
15 Write a program to calculate and print the roots of quadratic equation ax2+bx+c=0. The 4
program should display suitable message whether roots are real, equal, different or imaginary.
16 Write a program to accept an integer and display the corresponding day of week i.e. 1 for 3
Monday, 2 for Tuesday and so on. If the number is not in 1 to 7 it should display a message
“Invalid Day Number”.
17 Write a program to find out the grade of student based on his obtained percent as per following 4
conditions:
Percent Grade
<33 F
33 to 44 E
45 to 59 D
60 to 74 C
75 to 89 B
90 and above A
18 Write a program to calculate electricity charges based on number of consumed electricity units 4
as per following conditions:
Units Charges
Upto 100 Rs. 2 per unit
101 - 200 Rs. 200 + Rs. 3.5 per unit for units exceeding 100
201 - 300 Rs. 550 + Rs. 7.5 per unit for units exceeding 200
301 & above Rs. 1300 + Rs. 9 per unit for units exceeding 300
19 Write a program to print whether a given character is an uppercase or a lowercase letter or a 3
digit or any other character.
20 Write a program to input three angles and determine if they form a triangle or not. (Hint : sum 2
a triangles all three angle is 180)
21 Write a program to calculate BMI of a person after inputting its weight in kgs and height in 3
meters and then print the nutritional status as per following table :
Nutritional Status WHO criteria BMI cut-off
Underweight less than 18.5
Normal 18.5 to 24.9
Overweight 25 – 29.9
Obese 30 or above
Formula to calculate BMI = weight in Kgms./ (height in meter)2
22 Explain with example one advantage of using if…elif statement over using if statement multiple 2
times.
23 Write a program to arrange three numbers in ascending order. 3
24 Rewrite the following code after removing errors. Underline each correction. 2
25 Rewrite the following code after removing errors. Underline each correction. 2
If n==0
print(“Zero”)
5
elif : n==1
print(“One”)
elif
n==2
print(“Two”)
else n == 3
print(“Three”)
26 What is a loop? 1
27 What is range() function? Explain with syntax and example. 2
28 Explain operators in and not in with example. 2
29 Differentiate counting and conditional loops. Give the names of one conditional loop and one 3
counting loop available in Python.
30 Explain for loop with syntax and example. 3
31 Write a program to print table of a given number. 2
32 Explain while loop with syntax and example. 3
33 Explain break statement with syntax and example. 2
34 Explain continue statement with syntax and example. 2
35 Explain loop’s else statement used with syntax and example. 2
36 What do you mean by named conditions or stored conditions explain with example. 3
37 Write a program to find out the value of Xy . 3
38 Write a program to find the value of X!.(Factorial of X) 3
39 Write a program to find out the largest number out of given n numbers. 3
40 Write a program to find out the sum of first n terms of following series: 4
1 + X + X2 + X3 + X4 + ………………..+ Xn-1
41 Write a program to find out the sum of first n terms of following series: 4
1-X+ X2 - X3 + X4 - ………………..(+|-) Xn-1
43 Write a program to find out the sum of first n terms of following series: 4
1 + X + X2 / 2! + X3 / 3! + X4 / 4! + ………………..+ Xn-1 / (n-1)!
44 Write a program to find out the sum of first n terms of following series: 4
1 - X + X2 / 2! - X3 / 3! + X4 / 4! - ………………..(+|-) Xn-1 / (n-1)!
45 Write a program to print the n terms of Fibonacci series: 3
0 1 1 2 3 5 8 13 21 …..
46 Write a program to print the following pattern (using only one * in a print statement) 3
*
**
***
****
*****
47 Write a program to print the following pattern (using only one * in a print statement) 3
*****
****
***
**
*
48 Write a program to print the following pattern (print only one value at a time) 3
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
6
49 Write a program to find out whether it is a prime number or not. 4
50 Write a program to find out the reverse of a given number. 4
51 Write a program to find whether a number is palindrome. (A palindrome is a number that is 4
same of its reverse)
52 Write a program to count the number of digits in a given number. 4
53 Write a program to find the sum of all digits of a given number. 4
54 Write a program to find the sum of all even digits and odd digits separately. 4
55 Write a program to print first 10 Mersenne numbers. (Mersenne number are in the form of 3
(2n-1) )
56 Write a program to find the LCM of three integers. 3
57 Write a program to find the HCF of three integers. 3
58 Rewrite the following code fragment that saves on the number of comparisons: 3
if(a==0):
print(“Zero”)
if (a==1):
print(“One”)
if(a==2):
print(“Two”)
if(a==”Three”):
print(“Three”)
57 Rewrite the following code fragment remove and operator and use chaining of comparison 3
operators. Logic of program should not change.
if(score <33 ):
grade= “F”
if(score >=33 and score < 45 ):
grade= “E”
if(score >=45 and score < 60 ):
grade= “D”
if(score >=60 and score <75 ):
grade= “C”
if(score >=75 and score <90 ):
grade= “B”
if(score >= 90 ):
grade= “A”
print (grade)
58 What will be the output of the following code if the input is 3 2
num = 10
while num> 0:
sum += num
num -= 2
print( sum)
7
60 Predict the output of the following code if value of a is entered as 5: 3
min = 0
max= num
if num < 0 :
min = num
max = 0
for i in range(min, max +1):
sum +=i