21-22 Cs Xi Assignments
21-22 Cs Xi Assignments
21-22 Cs Xi Assignments
COMPUTER SCIENCE
(Python)
ASSIGNMENT
CLASS XI
2021-22
. CONTENTS .
I. MACRO PLANNER 3
CYCLE TEST 1
Unit 1: Computer Systems and Organisation 10
Unit1: Number System 20
TOTAL 30
CYCLE TEST 2
30
TOTAL 30
TERMINAL 1
Unit 1: Computer Systems and Organisation 10
Unit 2: Programming and Computational Thinking 25
TOTAL 35
CYCLE TEST 3
TOTAL 30
ANNUAL : THEORY
Unit 1: Computer Systems and Organisation 20
Unit 3: Society, Laws & Ethics 15
TOTAL 35
ANNUAL : PRACTICAL
PYTHON PROGRAM 1 (WRITE:5 & EXECUTE: 5) 10
PYTHON PROGRAM 2 (WRITE: 5 & EXECUTE: 5) 10
VIVA 05
PRACTICAL FILE 05
TOTAL 30
Computer Fundamentals
Q-6. Give one difference between compiler and interpreter. Name two
softwares based on compiler.
Q-11. How is utility software different from system software? Give a name of
each type of software.
a. ASCII
b. USB
d. DVD
e. UNICODE
f. RAM
g. EPIC
h. GUI
i. HDD
j. ISCII
c. System software
Boolean Algebra
Q-1. State DeMorgan's Law. Verify one of the Demorgan’s Laws using truth
tables.
Q-2. Do as directed:
a. Write the equivalent Boolean expression for the following Logic Circuit:
c. Write the equivalent Boolean Expression for the following Logic circuit :
d. Write the equivalent Boolean Expression for the following Logic Circuit.
e. Write the equivalent Boolean Expression for the following Logic Circuit.
g. Write the equivalent Boolean Expression for the following Logic Circuit.
h. Write the equivalent Boolean Expression for the following Logic Circuit.
M. Represent the Boolean expression Y.Z+X.Z with a truth table and logic circuit.
Number System
3. (402.8)10 = ( ? )2 = ( ? )8 = ( ? )16
5. (9C.B)16 = ( ? )2 = ( ? )8 = ( ? )10
6. (197.75)10 = ( ? )2 = ( ? )8 = ( ? )16
Q-1. Reema confused between 3*2 and 3**2. Help her know the difference between
the two expressions.
Q-2. If a, b, c = 3, 2, 5 and you write an expression like F=a + bc + a*c, then what
error will it produce? Write the correct expression.
Q-11. What are the differences between single quotes, double quotes and triple
quotes?
Q-16. Differentiate between division operator (/) and floor division operator (//).
Q-21. Give a point of difference between the following with an example for each:
(i) integer and string
(ii) L-value and R-value
Q-22. Give a point of difference between logical operators and relational operators.
Give a statement each for both the categories.
Q-23. What does the modulus operator % do? What will be the result of 7.2% 2.1?
Q-26. Name any 2 operators in the arithmetic operator category. Give an example
for each.
Q-28. Explain the different types of errors that might occur while programming.
Q-30. Which symbol is used to tell the interpreter that the statement is continued
on the next line at the end of a line of code?
Q-36. Classify the category of operators to which the following operator belong to:
(i) >
(ii) %
Q-38. Classify the following words amongst Identifier, Keyword and Constant:
(i) break
(ii) “int”
(iii) Float
(iv) test
Q-47. Write the C++ statements for the following mathematical expressions:
(i) E = ½ mv2
(ii) S = (L + B)/2
(iii) V = 4/3π3
(iv) T = s(s-a)(s-b)(s-c)
(v) c = a2+b2
(vi) A=πr2
(vii) M = A2+ B2 + 2.A.B
(viii) V = 2∏rl
ii).print(ans+4==8+2)
ii). print(ans>10)
Q-61. If you enter 1 2 3 in three separate lines, when you run this program, what
will be displayed?
print("Enter three numbers: ")
number1 = eval(input())
number2 = eval(input())
number3 = eval(input())
average = (number1 + number2 + number3) / 3
print(average)
b)
x, y = 1, 2
x, y = y, x
print(x, y)
b)
j=i=1
i += j + j * 5
print("What is i?", i)
c)
x=1
x *= x + 1
print(x)
d)
x=2
y=1
x *= y + 1
print(x,y)
b)
a=input("Enter a number")
b=a+10
print b
b=int(input(“Enter a number”))
print (b+” is the entered number”)
Q-73. Determine the syntax errors from the following Python code and correct them
by rewriting the entire code:
a=”Hello”
Print (a)
b=7
print (a+b)
TYPE E: Programs
Q-77. Write a python program to input the principal amount and time. If the time is
more than 10 years, calculate the simple interest rate 8%. Otherwise
calculate it at a rate 12% per annum.
Q-78. Write a program to input a number. If the number is even, print its square
otherwise print its cube.
Q-79. Write a program to input a number. If the number is odd and positive, print
its Square root otherwise print double of the number.
Q-80. Write a program to input choice(1 or 2). If the choice is 1, print the area of a
circle otherwise print the perimeter of the circle. Accept the radius of the
circle from the user.
Q-81. Write a program to input a student type (‘A’ or ‘B’). If the student type is
‘A’initialize the college account with Rs. 200/- otherwise initialize the hostel
account with Rs. 200/-.
Q-82. Write a program to find and print the area of a triangle by asking the user to
input the base and altitude of the triangle.
Q-83. Write a program to input the name of the student, marks of 3 subjects,
calculate and print the total and percentage secured by the student, along
with his/her name.
Q-3. Find the output for the following code if user inputs the following values for
year:
a) 2000
b) 1971
year=int (input(“enter 4 digit year”))
if year % 100 == 0:
if year % 400 == 0:
print(“leap year”)
elif year % 4 ==0 :
print(“leap year”)
c=a%3+b%2
if c>a:
print(a+c)
print(b+c)
else:
print(a+b)
print(a+c)
TYPE E: Programs
Q-8. Write a program to find the largest number among the three input numbers.
Q-9. Write a program that reads two numbers and an arithmetic operator and
displays the results.
Q-11. Write a program to take values of length and breadth of a rectangle from the
user and check if it is square or not.
Q-12. A shop will give a discount of 10% if the cost of the quantity purchased is
more than 1000. Write a program to formulate the given situation.
Q-14. Write a program to input 3 numbers, find the smallest number and print it.
Q-15. Write a program to input the values of a, b & c and arrange them in
ascending order.
Q-16. Write a program to determine whether a given year is a leap year or not.
Q-17. Write a program to ask for the user’s choice to calculate the area of a triangle
according to (a) Base-Altitude formula or (b) Heron’s Formula. Have the
following printed to communicate the options available and take input from
the user accordingly:
AREA OF TRIANGLE
● Base-Altitude Formula
● Heron’s Formula
Q-18. Write a program to input the consumer’s name, consumer’s age and calls
made, and calculate the amount of telephone bill applicable as per the
following table:
Calls made Rate per unit
0-100 Free
101-500 5
501-1000 8
>1000 10
An additional monthly rental of INR 150, is charged for every consumer
irrespective of the number of calls made. Print the total amount of telephone
bill payable.
Q-19. Write a program to determine and print whether a given number is even or
odd.
Q-20. Write a program to determine and print whether a given number is a perfect
square or not.
Q-21. Write a program to determine and print whether a given is positive, negative
or zero.
Q-22. Write a program to input electricity unit charges and calculate total
electricity bill according to the given condition:
For first 50 units Rs. 0.50/unit
For next 100 units Rs. 0.75/unit
For next 100 units Rs. 1.20/unit
For unit above 250 Rs. 1.50/unit
An additional surcharge of 20% is added to the bill
Q-24. Write a program to input any alphabet and check whether it is a vowel or
consonant.
Q-25. Write a program to input any character and check whether it is an alphabet,
a digit or a special character.
Q-27. Write a program to input week numbers and print week day.
Q-28. Write a program to input month number and print number of days in that
month.
Q-29. Write a program to count the total number of 2000, 500, 100, 50, 20, 10,
5 ,2, 1 notes in a given amount.
Q-30. Write a program to input angles of a triangle and check whether triangle is
valid or not.
Q-31. Write a program to input all sides of a triangle and check whether the
triangle is valid or not.
Q-33. Write a program to find the roots and nature of a linear equation of 2
variables.
Q-34. Write a program to input marks of five subjects Physics, Chemistry, Biology,
Mathematics and Computer. Calculate percentage and grade according to the
following:
Percentage >= 90% : Grade A
Percentage >= 80% : Grade B
Percentage >= 70% : Grade C
Percentage >= 60% : Grade D
Percentage >= 40% : Grade E
Percentage < 40% : Grade F
Q-35. Write a program to input basic salary of an employee and calculate its Gross
salary according to the following:
Basic Salary <= 10000 : HRA = 20%, DA = 80%
Basic Salary <= 20000 : HRA = 25%, DA = 90%
Basic Salary >20000 : HRA = 30%, DA = 95%
Q-1. What is a loop? How many different kinds of looping statements does python
support?
Q-3. Give the differences between for loop and while loop.
Q-6. What is the purpose of range in for loop? Give an example in python.
Q-8. A for loop that starts at 29 and ends at 11 with a decrement of 2 after each
iteration
Q-9. Convert the following code that uses while statement, into for statement:
a)
m=4
while m<=40:
print(m)
m=m+3
b)
i=1
while i<10:
print(i)
i+=2
Q-10. Convert the following code that uses for statement, into while statement:
for i in range(5,15,3):
print(i*i)
Q-13. What will be the output after executing the following code?
a)
a=0
for i in range(10):
a=a+1
print(a)
b)
for i in range(4):
print(“CBSE”)
c)
x=2
for y in range(20,10,5):
y=y*2
print(x+y)
x=x+2
print(x+y)
iii) m=2
for n in range(3,8,2):
Q-15. Rewrite the following program after removing syntax errors (do underline the
corrections):
x=4
while y>10:
if y>x
print x+y
break
Q-17. Rewrite the following Python code correcting all the syntax errors that appear
in the code (do underline all the corrections):
x=20
while (x>10)
print(x)
x=x-1
else
print(“Bye”)
Q-18. Rewrite the following Python code correcting all the syntax errors that appear
in the code (do underline all the corrections):
while i in range(10,20):
Print(i)
x=x-1
print x
TYPE E: Programs
Q-20. Write a program to print the factorial of a given number using while loop.
Q-31. Write a Python program to print the sum of the digits of a given number.
Q-34. Write a Python program to display the sum of odd numbers from 1 to n.
Flowcharts , Algorithms
Q-1. What is flowchart? Explain the various symbols used to design a flowchart.
Q-2. What is an algorithm?
Flowchart
Q -1. Draw the flowchart for finding value and nature of the roots of a quadratic
equation.
Q-2. Draw the flowchart for finding the biggest of 3 numbers.
Q-3. Draw the flowchart for calculating the sum of any given 2 numbers.
Q-4. Draw the flowchart for evaluating and printing the factorial of a number.
Q-5. Draw the flowchart for printing the Fibonacci series till n.
Q-6. Draw the flowchart for evaluating and printing the area of a circle.
Algorithm
Q-7. Write the algorithm to print all natural numbers from 1 to n.
Q-8. Write the algorithm to check whether a number is Prime number or not.
Q-9. Write the algorithm to determine whether a set of 3 numbers can be
considered as Pythagorean triplets or not.
Q-10. Write the algorithm for finding and print the area of a triangle using Heron's
formula
Q-11. Write the algorithm to check whether a number is negative, positive or zero.
Q-12. Write the algorithm to calculate the sum of digits of a number.
STRINGS IN PYTHON
str="hello"
str[:2]
res=''
for i in range(len(str)):
print(res)
s1='Hello'
s2=s[:2]+s1[len(s1)-2:]
print(s2)
'ba'+'na'*2
s='Welcome to python4csip.com'
print(s.find('come'))
s.count('o')
s='Hello'
for i in s:
print(i,end='#')
for i in 'hardik':
print(i.upper())
s='Hello'
for i in s:
print('Welcome')
str='virat'
for i in str:
print(str.upper())
b='virat'
for i in range(len(a)):
print(a[i],b[i])
a='hello'
b='virat'
for i in range(len(a)):
print(a[i].upper(),b[i])
print("xyyzxyzxzxyy".count('xyy', 2, 11))
print(“hello”+1+2+3)
str1 = "PYTHON4CSIP.COM"
print (str.capitalize())
str1 = 'Hello'
str2 ='World!'
count = 0
if(letter == 'l'):
print(count,'letters found')
Python Lists
Q-4. Given a list of numbers, find and print all its elements with even indices (i.e.
A[0], A[2], A[4], ...).
Q-5. Given a list of numbers, print all its even elements. Use a for-loop that
iterates over the list itself and not over its indices. That is, don't use range()
Q-6. Given a list of numbers, find and print all its elements that are greater than
their left neighbour.
Q-7. Given a list of non-zero integers, find and print the first adjacent pair of
elements that have the same sign. If there is no such pair, print 0.
Q-8. Given a list of numbers with all elements sorted in ascending order,
determine and print the number of distinct elements in it.
Q-9. Given a list of integers, find the first maximum element in it. Print its value
and its index (counting with 0).
Q-10. Given a list of numbers, find and print the elements that appear in it only
once. Such elements should be printed in the order in which they occur in
the original list.
On the main diagonal put 0. On the diagonals adjacent to the main put 1.
Example output: 0 1 2 3 4
10123
21012
43210
(A) L1=list( )
(B) L1=[1,2,3,4]
list(“welcome”)
(C) [‘welcome’]
>>> L=[‘w’,’e’,’l’,’c’,’o’,’m’,’e’]
>>> print(len(L))
(A) 7
(B) 8
(C) 9
(D) None
>>> print(max(L))
(A) Zee
(C) Error
>>>L=[1,2,3,4,5,[6,7,8]]
>>>print(L[5])
a. [6, 7, 8]
b. 6, 7, 8
c. Error
d. 6
L=list(“www.csiplearninghub.com”)
print(L[20 : -1])
a. [‘c’ , ‘o’]
c. (com)
d. Error
>>>L=list(“www.csiplearninghub.com”)
>>>print(L[20 : 0])
a. Error
b. No Value
c. None
d. [ ]
L=[“Amit”,”Sumit”,”Naina”]
print(L*2)
c. Error
L=[“Amit”,”Sumit”,”Naina”]
print(L**2)
a. Error
b. [“Amit”,”Sumit”,”Naina”][“Amit”,”Sumit”,”Naina”]
c. [“Amit”,”Sumit”,”Naina”]
d. [“Amit”,”Sumit”,”Naina”,”Amit”,”Sumit”,”Naina”]
print(L)
b. (0,.5, 1, 1.5)
d. Error
L=[1,2,3,4,5]
for i in L:
print(i,end=” “)
i=i+1
a. 1, 2, 3, 4, 5
b. 1, 3, 5
c. Error
a. L1.add(4)
b. L1.append(4)
c. L1.new(4)
a. True
b. False
a. Single Element
b. Multiple Elements
T = [1,2,3,4]
print(T.index(9))
a. IndexError
b. TypeError
c. ValueError
a. *
b. **
c. +
d. //
a. Indexing
b. Slicing
c. Dividing
d. Concatenation
b. List is mutable
a. Same
b. Different
a. +
b. in
c. **
a. True
b. False
a. sort( )
b. sorted( )
c. reverse( )
a. print(L[1 : 8 : 2])
b. print(L[1 : : 2])
L.extend([51,62,73,84])
a. 8
b. 4
c. 5
d. Error
print(L[-1])
print(L[-1][-1])
a. True
b. False
Python Tuples
a. Mutable
b. Immutable
a. True
b. False
a. Square brackets
b. Curly brackets
c. Parenthesis
A = tuple(“Python”)
print(A)
a. (python)
b. (“Python”)
a. True
b. False
A = list(tuple(“Python”))
print(A)
d. Error
a. update( )
b. min( )
c. max( )
d. count( )
a. Tuple is immutable
c. R = (1, 2, 3, 4)
a. P = ( )
b. Q = tuple( )
a. t = (1,)
b. t = 1,
>>>t = (1)
>>>type(t)
a. <class ‘int’>
b. <class ‘float’>
c. <class ‘tuple’>
d. <class ‘list’>
a. 1
b. 2
c. 3
d. 4
a. T1 + (23)
a. Addition
b. Multiplication
c. Exponent
d. Modulus
a. index( )
b. max( )
c. count( )
>>> t1=(1,2,3,4,5,6,7)
a. 8
b. 9
c. 6
d. 7
a. max( )
b. min( )
c. sum( )
a=(“Amit”, “Sumit”,”Ashish”,”Sumanta”)
print(a.index(“Suman”))
b. ValueError
c. TypeError
d. NameError
a=(23,34,65,20,5)
print(a[0]+a.index(5))
a. 28
b. 29
c. 27
d. 26
Q-11. Create a tuple containing just a single element which in turn contains the
four elements 'a', 'b',’c’ and 'd'. Verify that the length is actually 1 by using
the len() function.
tuple_a = 1, 2
tuple_a = 1, 2
tuple_b = (3, 4)
print(r)
tuple = ('Python') * 4
print(type(tuple))
t=(11,121,14,13)
print(t[1:3])
print(r)
t1 = (1, 2, 3, 3)
t2 = (1, 2, 3, 4)
tup2=(100,200)
(i) print(tup1.index(45))
(ii) print(len(tup2))
(iii) print(sum(tup2))
(iv) print(sorted(tup1)
print(tup1)
TYPE D: Programs
Q-22. Write a Python program to create a tuple with numbers from 1 to 10 and
print all the items one at a time in a separate line.
Q23. Write a python program to print the second largest element in tuple.
Python Dictionaries
1 In order to store values in terms of key and value we use what core data type
(A) list
(B) tuple
(C) class
(D) dictionary
a={1:"A",2:"B",3:"C"}
print(a.setdefault(3))
(B) C
(C) {1: 3, 2: 3, 3: 3}
4 Read the code shown below carefully and pick out the keys?
d = {"john":40, "peter":45}
(C) 40 and 45
5 d = {"john":40, "peter":45}
"john" in d
(A) True
(B) False
(C) None
(D) Error
d1 = {"john":40, "peter":45}
d2 = {"john":466, "peter":45}
d1 == d2
(A) True
(B) False
(C) None
(D) Error
d1 = {"john":40, "peter":45}
d2 = {"john":466, "peter":45}
d1 > d2
(B) False
(C) Error
(D) None
d["john"]
(A) 40
(B) 45
(C) “john”
(D) “peter”
9 Suppose d = {“john”:40, “peter”:45}, to delete the entry for “john” what command
do we use:
(A) d.delete(“john”:40)
(B) d.delete(“john”)
(A) d.size()
(B) len
(C) size
(D) d.len()
d = {"john":40, "peter":45}
print(list(d.keys()))
d = {"a”:3 ,”b”: 7}
print(list(d.keys()))
A. In python, a dictionary can have two same keys with different values.
B. In python, a dictionary can have two same values with different keys
C. In python, a dictionary can have two same keys or same values but cannot have
two same key-value pair
D. In python, a dictionary can neither have two same keys nor two same values.
d1={"abc":5,"def":6,"ghi":7}
print(d1[0])
A. abc
B. 5
C. {"abc":5}
D. Error
dict={"Phy":94,"Che":70,"Bio":82,"Eng":95}
dict.update({"Che":72,"Bio":80})
D. It will not throw any error but it will not do any changes in dict
print(d1[0])
A. abc
B. 5
C. {"abc":5}
D. Error
17 Which of the following will delete key_value pair for key="tiger" in dictionary?
dic={"lion":"wild","tiger":"wild","cat":"domestic","dog":"domestic"}
A. del dic["tiger"]
B. dic["tiger"].delete()
C. delete(dic.["tiger"])
D. del(dic.["tiger"])
Suppose dict1={"a":1,"b":2,"c":3}
A. print(len(dict1))
B. print(dict1.get("b"))
C. dict1["a"]=5
D. None of these.
(i) dict.pop("book")
(iii) dict.update({"diary":1,"novel":5})
dict={"diary":1,"book":3,"novel":5}
A. i, ii, iii
B. i, ii
C. i, iii
D. ii, iii
B. Unique
D. All of these
B. dict([[1,”A”],[2,”B”]])
C. {1,”A”,2”B”}
D. { }
a={1:"A",2:"B",3:"C"}
print(a.get(1,4))
A. 1
B. A
C. 4
a={1:"A",2:"B",3:"C"}
print(a.get(5,4))
A. 1
B. A
C. 4
a={1:"A",2:"B",3:"C"}
a.setdefault(4,"D")
print(a)
B. None
C. Error
D. [1,3,6,10]
a={1:"A",2:"B",3:"C"}
b=a.copy()
b[2]="D"
print(a)
D. “None” is printed
a={1:"A",2:"B",3:"C"}
a.clear()
print(a)
A. None
D. { }
a={1:5,2:3,3:4}
a.pop(3)
A. {1: 5}
B. {1: 5, 2: 3}
D. {1: 5, 3: 4}
a={1:"A",2:"B",3:"C"}
for i in a:
print(i,end=" ")
A. 1 2 3
>>> a={1:"A",2:"B",3:"C"}
>>> a.items()
A. Syntax error
C. dict_items([(1,2,3)])
1. In the question given below, there are two statements marked as Assertion (A) and
Reason (R). Mark your answer as per the options provided.
Reason(R): Each key-value pair maps the key to its associated value.
Q-5. How many ways are there to create dictionaries? Name them?
print(Dic.items())
print(Dic.keys())
print(Dic.values()
a = {(1,2):1,(2,3):2}
print(a[1,2])
aDict={“a”:1,”b”:5,”c”:10,”d”:20}
temp=0
for v in aDict.values():
temp=temp+v
print(temp)
fruit = { }
L=[“Apple”,”Banana”,”apple”]
for index in L:
if index in fruit:
fruit[index] += 1
else:
fruit[index] = 1
print (len(fruit))
print(fruit)
for I in sorted(dict):
print (dict[I])
id1 = id(rec)
del rec
id2 = id(rec)
print(id1 == id2)
Q-14. Write a Python script to generate and print a dictionary that contains a
number (between 1 and n) in the form {x: x*x} .
18. What is the full form of: HTTP, HTTPS, SSL, TSL?
30. What are the names of a few websites where you can lodge your complaint
related to cybercrime?
38. What are the disability issues faced in teaching / using computers?
39. What are the possible solutions to overcome disability issues faced in teaching
/ using computers?
40. Write two net etiquettes, communication etiquettes and social media étiquettes