MCQ Practice Questions AI-ML-Python
MCQ Practice Questions AI-ML-Python
Question 10: What is the primary function of a radar sensor in self-driving cars?
A. Measuring distances
B. Detecting objects in low visibility
C. Providing a 3D map
D. Recording traffic signs
Correct Answer: B
Explanation: Radar is used to detect objects even in adverse weather conditions.
Question 16: Which process involves discovering patterns, associations, clusters, and outliers
from large data?
A. View synthesis
B. Machine Learning
C. Data Mining
D. Precision agriculture
Correct Answer: C
Explanation: Data Mining involves analyzing large datasets to uncover useful patterns.
Question 17: Which type of Machine Learning uses historical data to make predictions?
A. Reinforcement Learning
B. Unsupervised Learning
C. Supervised Learning
D. Generative Learning
Correct Answer: C
Explanation: Supervised learning utilizes labeled historical data to train models for predictions.
Question 18: What is the primary role of Natural Language Processing (NLP) in systems like
Alexa and Siri?
A. Text-to-speech conversion
B. Recommending items
C. Understanding and processing human language
D. Speech recognition
Correct Answer: C
Explanation: NLP allows these systems to comprehend and generate human language.
Question 19: Which learning paradigm involves clustering or identifying patterns in data without
predefined labels?
A. Supervised Learning
B. Unsupervised Learning
C. Reinforcement Learning
D. Generative Learning
Correct Answer: B
Explanation: Unsupervised learning finds hidden structures in unlabeled datasets.
Question 22: Which Machine Learning application is used to recommend movies on streaming
platforms?
A. Text-to-speech systems
B. Recommender systems
C. Automatic speech recognition
D. Data mining
Correct Answer: B
Explanation: Recommender systems use Machine Learning to predict user preferences.
Question 24: In which type of learning does a system generate its own labels from data?
A. Supervised Learning
B. Self-Supervised Learning
C. Unsupervised Learning
D. Reinforcement Learning
Correct Answer: B
Explanation: Self-supervised learning generates labels internally by leveraging patterns in the
data.
Question 29: Which of the following ML types does NOT require labels?
A. Supervised Learning
B. Unsupervised Learning
C. Reinforcement Learning
D. Text-to-Speech Systems
Correct Answer: B
Explanation: Unsupervised Learning analyzes data without predefined labels.
Question 31: Which Machine Learning technique is best for discovering customer behavior
patterns without labeled data?
A. Supervised Learning
B. Unsupervised Learning
C. Reinforcement Learning
D. Data Mining
Correct Answer: B
Explanation: Unsupervised Learning identifies patterns and clusters in datasets without
predefined labels.
Question 32: Alexa uses which Machine Learning application to convert spoken language into
text?
A. Recommender systems
B. Text-to-speech
C. Automatic speech recognition
D. Natural language processing
Correct Answer: C
Explanation: Automatic Speech Recognition (ASR) processes and converts spoken language
into textual data.
Question 34: Which type of learning adjusts strategies by evaluating actions and rewards?
A. Supervised Learning
B. Reinforcement Learning
C. Self-Supervised Learning
D. Unsupervised Learning
Correct Answer: B
Explanation: Reinforcement Learning uses feedback in the form of rewards or penalties to
refine strategies.
Question 36: What Machine Learning application generates synthesized speech from text?
A. Automatic speech recognition
B. Text-to-speech systems
C. Recommender systems
D. View synthesis
Correct Answer: B
Explanation: Text-to-speech systems convert text into spoken words for applications like virtual
assistants.
Python-Programming
Question 1: How do you write a single-line comment in Python?
A. Using //
B. Using #
C. Using <!-- -->
D. Using /* */
Correct Answer: B
Explanation: Python uses the # symbol to create single-line comments.
Question 20: What is the output of input("Enter your name: ") if the user types "Alice"?
A. Alice
B. "Alice"
C. Enter your name: Alice
D. None
Correct Answer: A
Explanation: The input() function returns the user's input as a string.
Question 21: What does an if statement do in Python?
A. Loops through a range of values
B. Executes code based on a condition
C. Takes user input
D. Repeats code until a condition is met
Correct Answer: B
Explanation: The if statement runs code when a condition evaluates to True.
x = 10
if x > 5:
print("x is greater than 5")
else:
print("x is 5 or less")
A. x is greater than 5
B. x is 5 or less
C. Error
D. None
Correct Answer: A
Explanation: Since x = 10 is greater than 5, the first block executes.
for i in range(3):
print(i)
A. 1, 2, 3
B. 0, 1, 2
C. 0, 1, 2, 3
D. Error
Correct Answer: B
Explanation: The range(3) function generates numbers from 0 to 2.
Question 24: Which statement can be used to skip the current iteration in a for loop?
A. break
B. continue
C. pass
D. return
Correct Answer: B
Explanation: The continue statement skips the rest of the code for the current loop iteration.
lst = [1, 2, 3]
lst.pop()
print(lst)
A. [1, 2]
B. [1, 2, 3]
C. []
D. Error
Correct Answer: A
Explanation: The pop() method removes the last element from the list.
Question 28: Which of the following is a valid way to iterate through a list?
A. for i in list
B. while list
C. if i in list
D. list.for()
Correct Answer: A
Explanation: A for loop can iterate over elements of a list directly.
for i in range(len(lst)):
print(lst[i])
A. 2, 3, 4, 5, 6, 7,
B. 2, 3, 4, 5, 6, 7, 8,
C. 0, 1, 2, 3, 4, 5, 6, 7,
D. Error
Correct Answer: A
Explanation: range(2, 8) generates numbers from 2 to 7.
for i in range(3):
print("Python")
x = 10
if x > 5:
if x % 2 == 0:
else:
else:
print("5 or less")
x = 15
if x < 10:
else:
print("20 or more")
A. Less than 10
B. Between 10 and 20
C. 20 or more
D. None
Correct Answer: B
Explanation: x = 15 satisfies the condition in the elif block.
x = 7
if x > 10:
else:
if x == 7:
print("Equal to 7")
else:
print("Other")
A. Greater than 10
B. Equal to 7
C. Other
D. None
Correct Answer: B
Explanation: Since x == 7, the nested else block executes.
Question 40: What is the output of this code?
for i in range(5):
if i == 3:
break
A. 0 1 2
B. 0 1 2 3
C. 0 1 2 3 4
D. Error
Correct Answer: A
Explanation: The loop breaks when i == 3.
for i in range(5):
if i == 2:
continue
A. 0 1 2 3 4
B. 0 1 3 4
C. 0 1 2 4
D. Error
Correct Answer: B
Explanation: The continue statement skips printing i when it equals 2.
for i in range(3):
for j in range(3):
if i == j:
break
A. 0, 1; 0, 2; 1, 2;
B. 1, 0; 2, 0; 2, 1;
C. 0, 1; 1, 0; 2, 0; 2, 1;
D. Error
Correct Answer: B
Explanation: The inner loop breaks when i == j.
Question 44: What happens when break is used inside a while loop?
A. Restarts the loop
B. Stops the loop
C. Skips the current iteration
D. Raises an error
Correct Answer: B
Explanation: The break statement terminates the loop immediately.
result = 10 // 3
print(result)
A. 3.33
B. 3
C. 4
D. Error
Correct Answer: B
Explanation: The // operator performs floor division. The result of 10 / 3 is 3.33, and the
floor value is 3.
result = 2 ** 3
print(result)
A. 6
B. 8
C. 9
D. Error
Correct Answer: B
Explanation: 2 ** 3 means 2 raised to the power of 3, which equals 8.
x = 10
y = 20
print(x > y)
A. True
B. False
C. 10
D. Error
Correct Answer: B
Explanation: The > operator checks if x is greater than y. Since 10 > 20 is false, the output is
False.
a = 15
b = 15
print(a == b, a != b)
A. True False
B. False True
C. True True
D. False False
Correct Answer: A
Explanation: The first condition a == b is True because both are 15, and a != b is False
because they are not different.
Question 55: What will the code output if the user enters n = 6?
sum = 0
avg = sum / n
A. Average: 15
B. Average: 3.0
C. Average: 3
D. Average: 2.5
Correct Answer: B
Explanation: The sum of numbers from 1 to 5 is 1 + 2 + 3 + 4 + 5 = 15. The average is
15 / 5 = 3.0.