XIComp SC H Y 414
XIComp SC H Y 414
XIComp SC H Y 414
Session: 2023-24
General Instructions:
SECTION A
What must be the value of x for which the above diagram is accurate?
a) 1 b) 0 c) both a and b
5. 1 KB of data is equivalent to
a=int(input(„Enter a number‟))
c=a+b
print(b)
a. 13579
b. 2 4 6 8 10
c. 123456789
d. 2468
d. It is a non-volatile memory
b. 4, 8 and 16 respectively.
c. 2, 8 and 16 respectively.
d. 1, 8 and 16 respectively.
16 Ram wanted to make a program which takes in two numbers from the user and print
the two numbers as shown below:
Input: Enter number 1=>23
Enter number 2=>24
Output: 23.0,24.0
He wrote the following code but doesn‟t know what the last line is supposed to be
a=float(input(„Enter number 1=>‟))
b=float(input(„Enter number 2=>‟))
...
What would be the last line of his code which produces his desired output?
a. print(a+b)
b. print(a,b)
c. print('a', ', ', 'b')
d. print(a,b,sep=', ')
The following questions 17 and 18 are Assertion-Reasoning based, answer the questions
by choosing one of the following responses:
SECTION B
19 Rewrite the following operations in a syntax followed by Python:
OR
20. Khaled wrote the following code to input a number and check whether it is a prime
number or not. His code is having errors. Rewrite the correct code and underline the
corrections made.
ch=True
n=int(input("Enter number to check=")
for i in range (2, n//2+1):
if n%i=0:
ch=False
break
else:
ch=True
if ch==True:
print("Number is prime")
else
print("Number is not prime")
21 Explain any two funtions of random module.
OR
Explain any two funtions of math module
22 Write a Python function to count the number of elements within a specified range.
23 Write the output of the following code:
i.
x, y =2, 5
x, y =y, x+2
print(x, y)
24 Define identifiers. Identify the valid and invalid identifiers in the following list.
26 Define operators in python. Explain relational and logical operators with example.
27 Write a program to find and print the grade of a student when the user inputs their
percentage. Grades are allocated as given in the table below:
28 Write a python program to find out the greatest of three user defined numbers.
OR
Write a program in python to enter a number and print whether it is an even number
or an odd number
30. i. What is the need of RAM? How does it differ from ROM?
ii. What is the need for Secondary Memory?
OR
I Write Boolean expression of the given logical gate?
SECTION E
33. Write the output of the following code:
i. (a,b,c)=(10,20,30)
(p,q,r)=(c–5,a+3,b–4)
print(„a,b,c:‟,a,b,c,end=‟‟)
print(“p,q,r:”,p,q,r)
ii. (a,b)=(10,5)
print(a/b)
print(a//b)
print(a%b)
print(a**2)
v. a=20
b=10
a//=b
print(c+2/2)
i=100
while(i>0):
print(i)
i-=3