0% found this document useful (0 votes)
35 views

EndTerm ExMTech Python Course

This document contains 10 questions for a Python end semester examination for an Executive M. Tech. program. The questions cover a range of Python and data structure topics like linked lists, trees, NumPy, Pandas, and neural networks. Students are asked to submit their solutions as Jupyter notebook files with the specified naming format by the given deadline.

Uploaded by

PraveenRI
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

EndTerm ExMTech Python Course

This document contains 10 questions for a Python end semester examination for an Executive M. Tech. program. The questions cover a range of Python and data structure topics like linked lists, trees, NumPy, Pandas, and neural networks. Students are asked to submit their solutions as Jupyter notebook files with the specified naming format by the given deadline.

Uploaded by

PraveenRI
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

14/04/2023, 14:21 EndTerm_ExMTech_Python_Course.

ipynb - Colaboratory

Python End Sem Examination

Executive M. Tech. Program

IIT Jammu
Max. Marks: 70                           Duration: 3 Hrs

NOTE: Please submit only python notebook file. File naming format should be stricktly followed.
The solutions file should be named as rollnumber_name. ipynb e.g.
2022pai0123_Y ourN ame. ipynb .

Do not submit compressed folder or text files. No formatss, other than ‘‘. ipynb " are acceptable
in submission. All other formats will be discarded, hence no evaluation will be done.

Q1: Write a python code to reverse a Linked List from position X to position Y.
Let length of list n = 15,     X = 5    and   Y = 12

--- 3 marks

Q2: Write a python code to remove duplicate elements from a sorted Linked List.
--- 3 marks

#Solution code here

Q3: For a given Linked List, write a code to return the node value where the cycle begins.
Also find the length of cycle in the list.
--- 5 (3+2) marks

Q4: Write a python program to construct a tree from Inorder and PreOrder traversal of
binary tree.
--- 4 marks

Q5: In the give binary tree, write a python code to print all root-to-leaf paths.

https://colab.research.google.com/drive/1U4nvUY3Dp0Pm9Eb5VxSiHQnGv4OLT3OK?authuser=1#scrollTo=h903DuUrYAJa&printMode=true 1/4
14/04/2023, 14:21 EndTerm_ExMTech_Python_Course.ipynb - Colaboratory

--- 8 (2+2+2+2) Marks

Q6: Write a Python program to print (a) Pre-order, (b) In-order, (c) Post-order and (d)
Level-order traversal of given binary search tree.

--- 10 (2.5 + 2.5 + 2.5 + 2.5) Marks

Q7: This question has four parts (2.5 Marks each):


-- 10 Marks

(a): How to find all the local maxima (or peaks) in a 1D array?
Peaks are points surrounded by smaller values on both sides.

E xampleI nput :

>> array([1, 3, 7, 1, 2, 6, 0, 1])

DesiredOutput :

>> array([2, 5]) .

(b): What is the difference between flatten and ravel functions in NumPy?
Consider:

https://colab.research.google.com/drive/1U4nvUY3Dp0Pm9Eb5VxSiHQnGv4OLT3OK?authuser=1#scrollTo=h903DuUrYAJa&printMode=true 2/4
14/04/2023, 14:21 EndTerm_ExMTech_Python_Course.ipynb - Colaboratory

What is the need of two different functions performing same job?

Write Your Answere and explanatino here: (double click to edit)

(c): Given a 2D numpy array (assume any with 8 x 8 dimensions), write a function to compute the
sum of each row and return the resulting 1D array.

(d): Write a function to find the index of the maximum value in a 1D numpy array of size 1x10
(Assume any random values between 10-20).

Q8: This queston has 2 parts. (3.5 Marks each):


-- 7 Marks

(a): Given a 2D numpy array, write a function to compute the dot product of the first row and the
second column.

(b): Consider a dataframe "df" with columns "col1" and "col2". Write a python code to select the first
row that has a unique value in both "col1" and "col2", and then remove that row from the dataframe.

Q9: Given a 3D numpy array, write a function to compute the mean value of each 2D
slice along the third axis and return the resulting 2D numpy array.
-- 10 Marks

Q10: Build a Keras program (model) in python to train a neural network to recognize
handwritten digits in the MNIST dataset ( Available at https://keras.io/api/datasets/),
and use Matplotlib to display the confusion matrix for the model's predictions on a test
set.
--- 10 Marks

https://colab.research.google.com/drive/1U4nvUY3Dp0Pm9Eb5VxSiHQnGv4OLT3OK?authuser=1#scrollTo=h903DuUrYAJa&printMode=true 3/4
14/04/2023, 14:21 EndTerm_ExMTech_Python_Course.ipynb - Colaboratory

https://colab.research.google.com/drive/1U4nvUY3Dp0Pm9Eb5VxSiHQnGv4OLT3OK?authuser=1#scrollTo=h903DuUrYAJa&printMode=true 4/4

You might also like