Xi CS - MS - 083 Hye 2022-23
Xi CS - MS - 083 Hye 2022-23
Xi CS - MS - 083 Hye 2022-23
v. A+AB = A (1)
x. b) 1 (1)
Section B (Short Answer I type questions)
ii A+ B = A . B (2)
A.B = A + B
A B A+B A+ B A B A.B A.B A + B A.B
0 0 0 1 1 1 0 1 1 1
0 1 1 0 1 0 0 1 1 0
1 0 1 0 0 1 0 1 1 0
1 1 1 0 0 0 1 0 0 0
pg. 1
Q. 3 i. Indentation refers to the spaces at the beginning of a code line. Python uses indentation to (2)
indicate a block of code.
ii Find error in the following code (if any) and correct code by rewriting code and underline (2)
the correction; -
iii Find error in the following code (if any) and correct code by rewriting code and underline (2)
the correction; -
To=30
for K in range(0, To):
if K%4==0:
print(K*4)
else:
print(K+3)
Output 12
pg. 2
Section C (Short Answer II type questions)
Q. 4 i. Following are some of important functions of an operating System (Any 3). (3)
Memory Management: OS allocates and de allocates memory to a process as and when
required.
Process Management: OS allocates and de allocates processor to a process as and when
required.
Device Management: OS manages device communication via their respective drivers and
decides which process gets the device when and for how much time.
File Management: OS manages files of computer system. It helps in creating, modifying,
storing and accessing the files.
pg. 3
Q 5. i. Write a program to enter two integers and perform all arithmetic operations (+, -, *, / ) on (3)
them.
num1=int(input("enter number1: "))
num2=int(input("enter number2: "))
sum=num1+num2
print("the sum is ",sum)
diff=num1-num2
print("the difference is ",diff)
prod=num1*num2
print("the product is ",prod)
quot=num1/num2
print("the quotient is ",quot)
ii. Write a program to input the value of x and n and print the sum of the following series: (3)
1+ x + x2 + x3 + x4 + x5 +………..+ xn
x=int(input("enter the number"))
n=int(input("enter the limit"))
sum=0
for i in range(0,n+1):
sum=sum+x**i
print("sum of series is: ", sum)
iii. Write a python program to input a number and check if the number is a prime or composite (3)
number.
n=int(input("enter the number: "))#10
for i in range(2,n):#[1,2,3,4,5,6,7,8,9]10
if(n%i==0):
print(n," is not prime")
break
else:
print(n," is prime")
iv. An error, also known as a bug, is a programming code that prevents a program from its (3)
successful interpretation or execution.
Syntax Error: Violation of formal rules of a programming language results in syntax error.
Run time Error: A runtime error in a program is an error that occurs while the program is
running after being successfully compiled/interpreted. For e.g. Divide by zero error
pg. 4
Section D (Long Answer type questions)
Q. 6 i.
a. Number of digits used in a number system is known as its base. (1)
b. (250)10 = (11111010)2 = (372)8 = (FA)16 (3)
Q. 7 i. An algorithm is a finite set of instructions that, if followed, accomplishes a particular task. (4)
All algorithms must satisfy the following criteria:
1. Input: Zero or more quantities are externally supplied.
2. Output: At least one quantity is produced.
3. Definiteness: Each instruction is clear and unambiguous.
4. Finiteness: If we trace out the instructions of an algorithm, then for all cases, the
algorithm terminates after a finite number of steps.
5. Effectiveness: Every instruction must be very basic so that it can be carried out
ii. Python was created by Guido van Rossum during 1985- 1990, and consequently released in (4)
1991.
Features of python language:
Easy to learn, Easy to read
Easy to maintain, Broad standard library
Platform independent, Portable
Extendable, Scalable
Supports functional as well as OOP
pg. 5
iii. IDLE is Python's Integrated Development and Learning Environment. It comes with the (4)
default installation of python and gives the ability to write and execute Python programs.
Any 3 Valid differences between script mode and interactive mode.
iv. Python token: token is the smallest individual unit in a python program. All statements and (4)
instructions in a program are built with tokens. The various tokens in python are :
Keywords: Predefined words with special meaning to the language interpreter or compiler
Identifiers: A Python identifier is a name used to identify a variable, function, class,
module or other object
Literals: Data items that have fixed values. String/ Numeric/ Boolean literals and Special
literal “None”
Operators: Arithmetic (+,-,*,/,%,**,//), Relational (<,>,<=,>=,==,!=), Logical (and, or),
Bitwise(&,^,|), assignment (=) Arithmetic assignment(+=,-=,*=,/=,%=,**=,//=), Shift
operators(<<,>>), Identity operators(is, is not), membership operators (in, not in)
Punctuators: Symbols used to organize program structure, and emphasis on expressions
and scentences such as ‘ “ # \ ( ) [ ] { } @ , : . `
v. (4)
marks1= int(input("enter the marks in subject 1 "))
marks2= int(input("enter the marks in subject 2 "))
marks3= int(input("enter the marks in subject 3 "))
marks4= int(input("enter the marks in subject 4 "))
marks5= int(input("enter the marks in subject 5 "))
totalMarks=marks1+marks2+marks3+marks4+marks5
percentage=totalMarks*100/500
if (percentage>=85):
grade='A'
elif(percentage<85 and percentage>=75):
grade='B'
elif(percentage<75 and percentage>=50):
grade='C'
elif(percentage<50 and percentage>= 30):
grade='D'
elif(percentage>30):
grade='Reappear'
pg. 6