New Microsoft Word Document
New Microsoft Word Document
o (a) + (Correct)
4. What is the type of data it is going to be A data which has been taken
with the help of an input function?
o (c) 8 (Correct)
o (c) 3 (Correct)
11. What is the correct way to access the second element of a list?
5. What are modules and packages in Python and how are they imported?
o Comments are used to explain code and are ignored by the interpreter.
9. How can you handle errors using try and except blocks?
11. Explain slicing of a string and how slicing can be used to reverse a
string give examples.
o (b) 14 (Correct)
14. Which of these is a valid operator for dividing two numbers without
remainder?
o (a) / (Correct)
o (c) 16 (Correct)
o (c) 3 (Correct)
19. What is the correct way to access the third element of a list?
o **
o "John" (Correct)
o break exits the loop, while continue skips to the next iteration.
o The else block is executed if the try block does not raise an exception.
o (a) It predicts the value of a new data point based on the most
similar data points in the training data (Correct)
35. What happens if two or more neighbors have the same closest
distance?
40. What are the biggest strengths of KNN compared to other machine
learning algorithms in your opinion? How would you explain them to
someone new to the field?
41. Do you think KNN's sensitivity to noisy data is a major limitation? Would
you consider it a dealbreaker for using KNN in a specific project? Why
or why not?
48. With examples, explain the difference between supervised learning and
unsupervised learning.
o Support vectors are data points that define the decision boundary in
SVM (Support Vector Machine), a supervised learning model used for
classification and regression.
4. 52
2. Explain accuracy, error, false alarm, precision, recall, and miss with
examples.
7
For k=1k = 1k=1, the training error is typically low because the
model is likely to overfit.
For kkk approaching the size of the training dataset, the model
will predict the majority class for all inputs, resulting in higher
training error.
5. Explain how the generalization error (e.g., holding out some data for
testing) would change when k varies?
For very large kkk, the model may underfit, leading to high
generalization error due to high bias.
6. Why may K-NN be undesirable when the input dimension is high? Cost,
curse.
o Advantages:
o Disadvantages:
o Techniques include:
o Yes, SVMs can be used for regression tasks using Support Vector
Regression (SVR), which aims to find a function within a specified
margin that fits the training data.