You are on page 1of 12

Course Name –

PYTHON
FOR
MACHINE LEARNING

Course Code –
INT 215

Continuous Assessment - II

Page 1
IMPORTANT GUIDELINES:

1. All questions in this Academic Task are compulsory.

2. Question nos. 10 - 12 are compulsory to attempt.

3. Minimum 8 questions have to be attempted in any set of questions


assigned to the students.

4. For every question attempted, write the question no. , complete question
and the solution of the question in a jupyter notebook (.ipynb file).

5. After attempting the questions, convert the .ipynb file into a single pdf
format document (can be done with many free online available converters).

6. This PDF file should be uploaded onto the UMS interface on or before the
last date of the submission.

7. Refrain from indulging into plagiarism as copy cases will be marked zero.

8. This Document contains multiple sets of papers. The allocation sheet is


also attached in the CA file. All the students are advised to attempt the Set
allocated to him/her.

9. If any student found indulge in malpractices like plagiarism from internet


or classmates, attempting wrong set of question paper or any other, will be
awarded with zero (0) marks in CA.

Page 2
PYTHON FOR MACHINE LEARNING (INT-215)

CA-1
Set-1

1. You are given a list of numbers. Using NumPy, create an array of these numbers and calculate the
mean, median and standard deviation of the array.

2. You are given a 2D array of numbers. Using slicing and indexing operations, extract the values
from the second row and third column.

3. You have two arrays of equal length. Using NumPy, calculate the dot product of these arrays.

4. You have an array of shape (3, 4). Using NumPy, reshape it into an array of shape (2, 6).

5. You have two arrays of shape (2, 3) and (2, 4). Using NumPy, stack them horizontally and
vertically respectively.

6. You have an array of shape (4, 4). Using NumPy, split it into four equal parts.

7. You are given an array of numbers. Using NumPy, calculate the exponential of each element in
the array.

8. You have two arrays of equal length. Using NumPy, perform element-wise addition, subtraction,
multiplication and division on these arrays.

9. You have two arrays of shape (2, 2). Using NumPy, calculate the determinant of the product of
these two arrays.

10. You are given a list of names and their corresponding ages. Using Pandas, create a series of these
data.

11. You have a data frame containing the names, ages and grades of students. Using indexing and
selection operations, extract the grades of students who are above 18 years old.

12. You have two data frames containing the names and grades of students from two different
classes. Using Pandas, merge these data frames on the basis of the names of the students.

13. You have a data frame containing the names and ages of students from one class. Using Pandas,
append the data frame with the names and ages of students from another class.

Page 3
PYTHON FOR MACHINE LEARNING (INT-215)
CA-1
Set-2

1. You have an array of shape (5, 5). Using NumPy, create a new array that contains the diagonal
elements of the original array.

2. You have two arrays of shape (3, 3) and (3, 1). Using NumPy, perform matrix multiplication of
these arrays.

3. You are given an array of integers. Using NumPy, create a new array that contains only the
unique elements of the original array.

4. You have two arrays of shape (3, 3) and (3, 4). Using NumPy, concatenate these arrays along the
first axis.

5. You have an array of shape (2, 3, 4). Using NumPy, reshape it into an array of shape (2, 4, 3).

6. You have an array of shape (4, 4). Using NumPy, split it into two equal parts horizontally.

7. You are given an array of shape (3, 3). Using NumPy, calculate the inverse of this matrix.

8. You have two arrays of shape (2, 2) and (2, 2). Using NumPy, calculate the Kronecker product of
these arrays.

9. You are given an array of numbers. Using NumPy, calculate the cumulative sum and cumulative
product of this array.

10. You have a data frame containing the names, ages and salaries of employees. Using Pandas,
create a new data frame that contains only the names and salaries of employees who are older
than 30 years.

11. You have two data frames containing the names, ages and genders of students from two
different classes. Using Pandas, merge these data frames on the basis of the names of the
students and add a new column that contains the average age of the students from both classes.

12. You have a data frame containing the names and grades of students. Using Pandas, group the
data frame by grades and calculate the mean, median and standard deviation of the grades for
each group.

Page 4
PYTHON FOR MACHINE LEARNING (INT-215)
CA-1
Set-3

1. You have a 1D array of numbers. Using NumPy, create a new array that contains only the even
numbers from the original array.

2. You have two arrays of shape (2, 3) and (3, 2). Using NumPy, perform matrix multiplication of
these arrays.

3. You are given two arrays of equal length. Using NumPy, create a new array that contains the
maximum value of each pair of corresponding elements in the original arrays.

4. You have an array of shape (2, 3, 4). Using NumPy, split it into two equal parts along the second
axis.

5. You have two arrays of shape (3, 3) and (3, 3). Using NumPy, stack these arrays horizontally and
transpose the result.

6. You have an array of shape (3, 4). Using NumPy, reshape it into an array of shape (4, 3).

7. You are given an array of shape (4, 4). Using NumPy, calculate the eigenvalues and eigenvectors
of this matrix.

8. You have an array of shape (2, 2) and a scalar value. Using NumPy, calculate the exponential of
the product of the array and the scalar value.

9. You are given two arrays of shape (3, 3) and (3, 3). Using NumPy, perform element-wise
comparison of these arrays and create a new array that contains True where the corresponding
elements are equal and False otherwise.

10. You have a data frame containing the names and ages of students. Using Pandas, create a new
data frame that contains only the names and ages of students who are between 20 and 25 years
old.

11. You have a data frame containing the names and salaries of employees. Using Pandas, group the
data frame by department and calculate the total salary for each department.

12. You have a data frame containing the names, ages and grades of students. Using Pandas,
calculate the mean, median and standard deviation of the grades for each age group.

Page 5
PYTHON FOR MACHINE LEARNING (INT-215)
CA-1
Set-4

1. You have an array a of shape (3, 4) and an array b of shape (4, 5). Using NumPy, create a new
array c of shape (3, 5) that contains the dot product of a and b.

2. You have an array a of shape (5, 6) and an array b of shape (5, 6). Using NumPy, calculate the
Frobenius norm of the difference between a and b.

3. You have an array a of shape (4, 5) and a scalar value x. Using NumPy, create a new array b of
shape (4, 5) that contains the element-wise product of a and the sine of x.

4. You have an array a of shape (2, 3, 4). Using NumPy, split it into two arrays of shape (2, 3, 2) and
(2, 3, 2) along the second axis.

5. You have an array a of shape (3, 4) and an array b of shape (4, 5). Using NumPy, stack a and b
horizontally and reshape the result into an array of shape (3, 9).

6. You have an array a of shape (4, 3) and a scalar value x. Using NumPy, create a new array b of
shape (4, 3) that contains the element-wise product of a and the square of x.

7. You are given an array a of shape (3, 3). Using NumPy, calculate the determinant of a and verify
that the trace of a is equal to the sum of its eigenvalues.

8. You have an array a of shape (2, 2) and a scalar value x. Using NumPy, calculate the exponential
of a multiplied by x.

9. You are given two arrays a and b of shape (3, 3). Using NumPy, create a new array c of shape (3,
3) that contains the element-wise product of a and the sine of b.

10. You have a data frame containing the names, ages and grades of students. Using Pandas, create
a new data frame that contains only the names and ages of students who received a grade above
80.

11. You have a data frame containing the names, salaries and departments of employees. Using
Pandas, group the data frame by department and calculate the average salary and standard
deviation for each department.

12. You have a data frame containing the names, ages and genders of students. Using Pandas,
calculate the percentage of male and female students in each age group.

Page 6
PYTHON FOR MACHINE LEARNING (INT-215)
CA-1
Set-5

1. You have an array a of shape (5, 5) containing random values between 0 and 1. Using NumPy,
create a new array b that contains the same values as a, but with all values below 0.5 set to 0
and all values above or equal to 0.5 set to 1.

2. You have an array a of shape (4, 4) containing random integers between 0 and 9. Using NumPy,
create a new array b that contains the product of the even values in each row of a.

3. You have an array a of shape (3, 3) and a vector v of shape (3,). Using NumPy, create a new array
b that contains the product of a and v using broadcasting.

4. You have an array a of shape (3, 3) and an array b of shape (3, 1). Using NumPy, create a new
array c that contains the sum of a and b using broadcasting.

5. You have an array a of shape (2, 2) and an array b of shape (2, 2). Using NumPy, create a new
array c that contains the element-wise maximum of a and b.

6. You have an array a of shape (3, 3) containing random integers between 0 and 9. Using NumPy,
create a new array b that contains the indices of the maximum value in each row of a.

7. You have two arrays a and b of shape (3, 3) containing random integers between 0 and 9. Using
NumPy, create a new array c that contains the element-wise division of a and b, replacing any
division by 0 with NaN.

8. You have an array a of shape (3, 3) containing random integers between 0 and 9. Using NumPy,
create a new array b that contains the cumulative sum of the rows of a.

9. You have an array a of shape (3, 3) and an array b of shape (3, 3). Using NumPy, create a new
array c that contains the outer product of the first row of a and the first column of b.

10. You have a data frame containing the names, ages and occupations of individuals. Using Pandas,
create a new data frame that contains the top 5 most common occupations and their respective
frequencies.

11. You have a data frame containing the names, heights and weights of individuals. Using Pandas,
create a new data frame that contains the correlation between height and weight.

12. You have a data frame containing the names, ages and genders of students. Using Pandas,
calculate the average age and standard deviation for male and female students separately.

Page 7
PYTHON FOR MACHINE LEARNING (INT-215)
CA-1
Set-6

1. You have two arrays a and b of shape (3, 3) containing random integers between 0 and 9. Using
NumPy, create a new array c that contains the element-wise product of a and b, but only for
values where a is greater than 4.

2. You have an array a of shape (3, 3) containing random integers between 0 and 9. Using NumPy,
create a new array b that contains the inverse of a using the linalg module.

3. You have an array a of shape (3, 3) and a vector v of shape (3,). Using NumPy, create a new array
b that contains the dot product of a and v.

4. You have an array a of shape (3, 3) containing random integers between 0 and 9. Using NumPy,
create a new array b that contains the maximum value in each row of a.

5. You have two arrays a and b of shape (3, 3) containing random integers between 0 and 9. Using
NumPy, create a new array c that contains the element-wise difference between a and b.

6. You have an array a of shape (3, 3) containing random integers between 0 and 9. Using NumPy,
create a new array b that contains the sum of the diagonal of a.

7. You have an array a of shape (3, 3) containing random integers between 0 and 9. Using NumPy,
create a new array b that contains the exponential of each element in a.

8. You have an array a of shape (3, 3) and a vector v of shape (3,). Using NumPy, create a new array
b that contains the solution to the linear equation a x = v.

9. You have two arrays a and b of shape (3, 3) containing random integers between 0 and 9. Using
NumPy, create a new array c that contains the matrix product of a and b.

10. You have a data frame containing the names, ages and salaries of employees. Using Pandas,
create a new data frame that contains the mean and median salary for each age group.

11. You have a data frame containing the names, genders and salaries of employees. Using Pandas,
create a new data frame that contains the mean salary for male and female employees
separately, but only for employees whose salary is above the overall mean salary.

12. You have a data frame containing the names, ages and occupations of individuals. Using Pandas,
create a new data frame that contains the percentage of individuals in each age group for each
occupation.

Page 8
ROLL NO. WISE QUESTION SET ALLOCATION

Serial No Registration Number Name RollNumber Set No.

1 12104789 Alla Pavan Venkata Sivaji RK21MDA01 Set-1

2 12104771 Jakkilinki Heshith RK21MDA02 Set-2

3 12113102 Annamdevula Ravi RK21MDA03 Set-3

4 12112489 Nuni V Vijay Sai RK21MDA04 Set-4

5 12112337 Y Sai Preetham RK21MDA05 Set-5

6 12111702 manish choudhury RK21MDA06 Set-6

7 12111532 Susnata Das Mahapatra RK21MDA07 Set-1

8 12111396 Darsi Venkat Charan RK21MDA08 Set-2

9 12111353 Abhijit Gidhade RK21MDA09 Set-3

10 12109812 Javvadi Jaswant Sri Akhilesh RK21MDA10 Set-4

11 12110943 Shristi Sehwag RK21MDA11 Set-5

12 12111001 Kamuju Shyam Satya Manikanta Pavan RK21MDA12 Set-6

13 12111112 Rahul Boddu RK21MDA13 Set-1

14 12110600 Santhosh Kumar S RK21MDA14 Set-2

15 12106564 R Rajasree Singh RK21MDA15 Set-3

16 12106517 Lakshya Choudhary RK21MDA16 Set-4

17 12106640 Seema RK21MDA17 Set-5

18 12107196 Deepanshu RK21MDA18 Set-6

19 12107367 Shivansh Ranjan RK21MDA19 Set-1

20 12107884 Vaspari Murari RK21MDA20 Set-2

21 12107798 Achanta Nikith Chowdary RK21MDA21 Set-3

22 12113391 Tanish Dogra RK21MDA22 Set-4

Page 9
23 12107693 Manjusha Singh Yadav RK21MDA23 Set-5

24 12109817 Pichala Naveen Reddy RK21MDA24 Set-6

25 12111838 Mallekedi Vamshi RK21MDA25 Set-1

26 12112064 Kota Venkat Sandeep Reddy RK21MDA26 Set-2

27 12111005 Koppula Jaya Vardhan Reddy RK21MDA27 Set-3

28 12104879 Jarugu Mukesh Sai RK21MDA28 Set-4

29 12106502 Akula Kowshik Manikanta RK21MDA29 Set-5

30 12111371 Shaik Abdul Rasheed RK21MDA30 Set-6

31 12106470 Lanka Srinivasudu RK21MDA31 Set-1

32 12107767 Amudala Vishnu Koushik Reddy RK21MDA32 Set-2

33 12111860 Chettupalli Rohan Apuroop RK21MDA33 Set-3

34 12112467 Devarapu Akhil Chowdary RK21MDA34 Set-4

35 12110486 Jaggumantri Charan RK21MDA35 Set-5

36 12107709 Sonal Kumari RK21MDB36 Set-6

37 12107331 Chigicherla Thati Reddy RK21MDB37 Set-1

38 12107073 Garadala Mokshith Sai RK21MDB38 Set-2

39 12106729 Kriti Mishra RK21MDB39 Set-3

40 12106386 Pentyala Kumar Govindu RK21MDB40 Set-4

41 12110562 Vaddepally Akhilesh RK21MDB41 Set-5

42 12110656 Mythili Rampuram RK21MDB42 Set-6

43 12110324 Produturu Prathap Reddy RK21MDB43 Set-1

44 12111200 K Ranjith Kumar Reddy RK21MDB44 Set-2

45 12111003 Gorlamari Srujan Kumar Reddy RK21MDB45 Set-3

46 12111051 Shamsulhaq Shirzad RK21MDB46 Set-4

Page 10
47 12110846 Chilla Jagadesh RK21MDB47 Set-5

48 12109458 V Akshay Sai RK21MDB48 Set-6

49 12109308 Simran Rathor RK21MDB49 Set-1

50 12111298 Uppada Satwik RK21MDB50 Set-2

51 12111599 Badugu Naveen Babu RK21MDB51 Set-3

52 12111519 Maddipatla Durga Prasad RK21MDB52 Set-4

53 12111711 Kunal Kumar Pandit RK21MDB53 Set-5

54 12111585 Darsh Saxena RK21MDB54 Set-6

55 12111916 Hanumantha Rao Vadlamudi RK21MDB55 Set-1

56 12112870 Ambati Dileep Kumar Reddy RK21MDB56 Set-2

57 12104754 Achanagari Hanu Tejesh RK21MDB57 Set-3

58 12101827 Nandanavanam Nitya Sri Santoshini RK21MDB58 Set-4

59 12110944 Waseem RK21MDB59 Set-5

60 12109785 Inturi Sukumar RK21MDB60 Set-6

61 12109994 Priyanshu Singh RK21MDB61 Set-1

62 12105351 Sujeet Kumar Behera RK21MDB62 Set-2

63 12107544 Shaik Latheef RK21MDB63 Set-3

64 12107624 Kanigelupula Surya Venkata Phanindra RK21MDB64 Set-4

65 12103382 Acchannagari Saaii RK21MDB65 Set-5

66 12111443 Rajesh Palavalasa RK21MDB66 Set-6

67 12111835 Mallekedi Shrivardhan RK21MDB67 Set-1

68 12112090 Aravind Kontham RK21MDB68 Set-2

69 12110713 Somesh Verma RK21MDB69 Set-3

70 12107570 Saurabh Chandra RK21MDB70 Set-4

Page 11
Page 12

You might also like