O Level Practical Paper with Solution – Free PDF

इस पोस्ट में हम आपके साथ O Level old practical paper, O Level Previous Year Practical Paper, O Level Solved Practical Question Paper शेयर करने वाले है, चलिए बात करते है O Level Practical Paper PDF के बारे में |

NIELIT O Level Practical Question Paper

O Level Practical Question Paper – Python Programming

Question1– Write a Python program to implement a calculator to do basic operations Like(+, -, *, /).

n1=int(input("Enter first numbers"))
n2=int(input("Enter second numbers"))
op=input("Enter the operation +,-,*,/ : ")
if op=='+':
    print(n1+n2)
elif op=='-':
    print(n1-n2)
elif op=='*':
    print(n1*n2)
elif op=='/':
    print(n1/n2)
else:
    print("Invalid entry!!")

Output:

Enter first numbers25
Enter second numbers41
Enter the operation +,-,*,/ : *
1025

Question 2: Write a Python program to implement matrix multiplication using numpy array.

X = [[8,5,1],[9,3,2],[4 ,6,3]]
Y = [[8,5,3],[9,5,7],[9,4,1]]

result = [[0,0,0],[0,0,0],[0,0,0]]

for i in range(len(X)):
    for j in range(len(Y[0])):

        for k in range(len(Y)):
            result[i][j] += X[i][k] * Y[k][j]
print(result)

Output: [[118, 69, 60], [117, 68, 50], [113, 62, 57]]

Question 3: Write a Python program to print the numbers from a given number n to till 0 using recursion.

def newideas(n):
  if (n>=0):
    print(n, end=” ”)
    newideas(n-1)
num=int(input("Enter any Number"))    
newideas(num)

Output:
Enter any Number6
6 5 4 3 2 1 0

Question 4: Python program to generate the prime numbers from 1 to N.

lval = int(input ("Enter the Lowest Range Value: "))  
uval = int(input ("Enter the Upper Range Value: "))  
  
print ("The Prime Numbers in the range are: ")  
for number in range (lval, uval+1):  
    if number > 1:  
        for i in range (2, number):  
            if (number % i) == 0:  
                break  
        else:  
            print (number, end=" ")  

Output:

Enter the Lowest Range Value: 5
Enter the Upper Range Value: 20
The Prime Numbers in the range are:
5 7 11 13 17 19

  

                                                                                           

Leave a Comment