Py_midend_ans (1)
Py_midend_ans (1)
Py_midend_ans (1)
SECTION-A (K1-Knowledge/Remembering)
7×1-7
1. What is python?
2. Define lists,
Output
[1, 'apple', 3.14, [5, 6]]
Code:
Output
Type a number :2
Type another number :5
The sum is : 7
5. Define NumPy.
Arrays: NumPy arrays have a fixed size and all elements must be of the same data type.
7. Describe arrays.
Eg:
Index: 0. 1. 2. 3
my Arr = [ 20, 35, 55, 65]
SECTION-B (K2-Comprehension/Understanding)
5x3-15
8. Interpret a python program given integer number is odd or even using not operator.
def check_even_odd(number):
if not number % 2:
return f"{number} is even."
else:
return f"{number} is odd."
# Example usage
num = int(input("Enter an integer: "))
result = check_even_odd(num)
print(result)
9. Infer a python program to print the years 1000 to 2000 and mention it is a leap year or
not using while loop.
Code:
year = 1000
Output:
Output:
1
2
3
4
5
6
7
8
9
10
11. Interpret a python program to find given operator is arithmetic or not using if.
if operator in arithmetic_operators:
return True
else:
return False
12. Infer a python program to find the biggest of three numbers using nested-if.
3x6-18
13.a) Sketch a python program to determine the student marks grade using nested-if
Code:
if marks >= 0 and marks <= 100: # Check if marks are within a valid range
if marks >= 90:
grade = 'A'
else:
if marks >= 80:
grade = 'B'
else:
if marks >= 70:
grade = 'C'
else:
if marks >= 60:
grade = 'D'
else:
grade = 'F'
return grade
else:
return "Invalid marks. Please enter marks between 0 and 100."
Explanation:
1. Function Definition: The determine_grade function checks the marks and assigns
a grade based on nested if statements.
2. Input Validation: It ensures the marks are within a valid range (0-100).
3. Grade Calculation: The program uses nested if statements to determine the grade.
4. User Input: It prompts the user to enter the student's marks and handles any
invalid input.
(OR)
b) Sketch a python program to find if the given integer number is single, double, triple,
four- digit number or not using nested-if.
return category
return result
# Main program
try:
# Input dimensions for the matrices
rows = int(input("Enter number of rows: "))
cols = int(input("Enter number of columns: "))
print("Matrix 2:")
matrix2 = input_matrix(rows, cols)
three_d_array = [
[ # Layer 1
[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12]
],
[ # Layer 2
[13, 14, 15, 16],
[17, 18, 19, 20],
[21, 22, 23, 24]
]
]
# Accessing elements
print("Element at (0, 1, 2):", three_d_array[0][1][2])
Output: 7
Output: 24
Modifying an element
three_d_array[0][0][0] = 100
# Change the element at (0, 0, 0)
print("Modified Element at (0, 0, 0):", three_d_array[0][0][0])
Output: 100
Output
Layer 2:
13 14 15 16
17 18 19 20
21 22 23 24
SECTION-D
https://trainings.internshala.com/blog/python-string-functions/
18. Devise any 10 Python program using NumPy with necessary examples. (K5-LEVEL)
https://www.geeksforgeeks.org/python-numpy/
Chatgpt la podu chlo adhula neriya ans varudhu endha ques ku
SECTION-D
2x10-20
16. Reframe Create, Read, Update and Delete Operations using MongoDB with examples.
(KS-LEVEL)
https://www.geeksforgeeks.org/mongodb-crud-operations/
17. Evaluate the Four types of NOSQL Databases with examples. (K5-LEVEL)
https://www.geeksforgeeks.org/types-of-nosql-databases/
18. Design any five Aggregate Functions using Advanced MongoDB with examples
(K6-LEVEL)
https://www.mongodb.com/docs/manual/aggregation/
Answer all the questions:
SECTION-A (KI-Knowledge/Remembering)
7×1-7
1. Define Pandas.
2 Describe 3D Toolkit.
3D Toolkit is a software library that provides tools for creating, manipulating, and
rendering 3D graphics and models.
Databases are structured collections of data that are stored, managed, and accessed
electronically for efficient retrieval and manipulation.
5. Identify Data Types.
Data types define the kind of values a variable can hold, such as integers, floats, strings,
and booleans.
6. Tell MapReduce.
MapReduce is a programming model for processing and generating large datasets in
parallel across distributed clusters.
7. Recite Replication.
SECTION-B (K2-Comprehension/Understanding)
SECTION-C (K3-Application/Applying)
https://www.geeksforgeeks.org/python-list-index/
(OR)
b) Relate Line Charts, Bar Charts and Pie Charts using Matplotlib with examples.
(OR)
15.
https://hevodata.com/learn/mongodb-replica-set-config/