0% found this document useful (0 votes)
5 views13 pages

NumPy Fileh Practical Questions Made

The document contains a series of programming questions and solutions focused on Python and NumPy for Grade XI AI students. It includes tasks such as printing patterns, reversing integers, manipulating lists, and handling files. The solutions provided demonstrate basic programming concepts and operations with arrays and file handling in Python.

Uploaded by

du.naveen.sharma
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views13 pages

NumPy Fileh Practical Questions Made

The document contains a series of programming questions and solutions focused on Python and NumPy for Grade XI AI students. It includes tasks such as printing patterns, reversing integers, manipulating lists, and handling files. The solutions provided demonstrate basic programming concepts and operations with arrays and file handling in Python.

Uploaded by

du.naveen.sharma
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

TERM-II (2025-26)

GRADE XI subject-AI

Ques1) Print the following pattern-:

5 4 3 2 1

4 3 2 1

3 2 1

2 1

Ques 2) Write a program to reverse the integer number.

Ques 3) Print elements from a given list present at odd index positions.

Ques 4) Create a 1D NumPy array of numbers from 0 to 9.

Ques 5) Convert 1D array to 2D.

Ques 6) Create a 1D array filled with zeros and another filled with ones

Ques 7 ) Create a 1D array of 10 evenly spaced values between 5 and 50

Ques 8)Convert a Python list into a NumPy array

Ques9) Find the memory size of a NumPy array of numbers from 0 to 9.

Ques 10) To calculate the total number of line in a file (File Handling)

Ques 11) To search a word in a file and find the line number .

Ques 12) Write a Python program to read each row from a given csv file and print a list of strings.
Q1-

for i in range(5, 0, -1):

for j in range(i, 0, -1):

print(j, end=" ")

print()
Q2. num = int(input("Enter a number: "))
rev = 0

while num > 0:


digit = num % 10
rev = rev * 10 + digit
num = num // 10

print("Reversed number:", rev)


Q3.
lst = [10, 20, 30, 40, 50, 60]

print("Elements at odd index positions:")


for i in range(1, len(lst), 2):
print(lst[i])
Q4. import numpy as np

arr = [Link](10)
print(arr)
Q5. import numpy as np

arr1d = [Link](6)
arr2d = [Link](2, 3)

print(arr2d)
Q6.

import numpy as np

zeros_array = [Link](5)
ones_array = [Link](5)

print("Zeros array:", zeros_array)


print("Ones array:", ones_array)
Q7. import numpy as np

arr = [Link](5, 50, 10)


print(arr)
Q8. import numpy as np

arr = [Link](5, 50, 10)


print(arr)
Q9.

import numpy as np

arr = [Link](10)
print("Memory size in bytes:", [Link])
Q10. file = open("[Link]", "r")
count = 0

for line in file:


count += 1

[Link]()
print("Total number of lines:", count)
Q11. word = input("Enter word to search: ")
file = open("[Link]", "r")

line_no = 1
found = False

for line in file:


if word in line:
print("Word found at line:", line_no)
found = True
line_no += 1

if not found:
print("Word not found")

[Link]()
Q12. import csv

file = open("[Link]", "r")


reader = [Link](file)

for row in reader:


print(row)

[Link]()

You might also like