0% found this document useful (0 votes)
16 views26 pages

MCQ Practice Questions AI-ML-Python

The document covers key concepts in Artificial Intelligence (AI) and Machine Learning (ML), including definitions, applications, and types of learning. It includes multiple-choice questions with correct answers and explanations, focusing on topics such as conversational AI, reinforcement learning, supervised learning, and Python programming basics. Additionally, it addresses the purpose of comments, typecasting, and functions in Python.

Uploaded by

bubblesparkle45
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views26 pages

MCQ Practice Questions AI-ML-Python

The document covers key concepts in Artificial Intelligence (AI) and Machine Learning (ML), including definitions, applications, and types of learning. It includes multiple-choice questions with correct answers and explanations, focusing on topics such as conversational AI, reinforcement learning, supervised learning, and Python programming basics. Additionally, it addresses the purpose of comments, typecasting, and functions in Python.

Uploaded by

bubblesparkle45
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

Lecture 5+6: AI and ML

Question 1: What is the main focus of Artificial Intelligence (AI)?


A. Automating manual tasks
B. Simulating human thinking and decision-making processes
C. Replacing human workers
D. Building faster computers
Correct Answer: B
Explanation: AI aims to simulate human-like cognitive abilities, including thinking, reasoning,
and problem-solving.

Question 2: Which of the following is an example of conversational AI?


A. Google Search
B. ChatGPT
C. DALL-E
D. Tesla's Autopilot
Correct Answer: B
Explanation: ChatGPT is a conversational AI designed for human-like interactions.

Question 3: What test measures a machine's ability to exhibit intelligent behaviour?


A. Turing Test
B. Voight-Kampff Test
C. Alan Test
D. Rationality Test
Correct Answer: A
Explanation: The Turing Test evaluates whether a machine's behaviour is indistinguishable
from that of a human.

Question 4: What term describes AI systems mimicking human reasoning?


A. Acting Rationally
B. Thinking Humanly
C. Thinking Rationally
D. Acting Humanly
Correct Answer: C
Explanation: Thinking Rationally involves making decisions based on logic and reasoning.
Question 5: Which AI system helps diagnose medical conditions?
A. ChatGPT
B. Self-driving cars
C. AI diagnostic tools
D. DALL-E
Correct Answer: C
Explanation: AI diagnostic tools analyze symptoms and medical records to assist doctors.

Question 6: What sensor technology do self-driving cars use to measure distances?


A. Cameras
B. Lidar
C. Sonar
D. GPS
Correct Answer: B
Explanation: Lidar uses laser pulses to create accurate 3D maps of the environment.

Question 7: What does the "Acting Humanly" approach to AI emphasise?


A. Mimicking rational thought
B. Imitating human behaviour
C. Learning from data
D. Acting autonomously
Correct Answer: B
Explanation: Acting Humanly focuses on behaviour that is indistinguishable from human
actions.

Question 8: Which of the following is NOT a characteristic of intelligent agents?


A. Perceiving the environment
B. Acting through actuators
C. Ignoring external data
D. Maximizing performance measures
Correct Answer: C
Explanation: Intelligent agents are defined by their ability to perceive and act based on their
environment.
Question 9: Which AI system is an example of Weak AI?
A. General AI systems
B. ChatGPT
C. Human-like robots
D. All of the above
Correct Answer: B
Explanation: Weak AI systems perform specific tasks, like generating human-like text.

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 11: What is an example of an AI acting rationally?


A. Passing a Turing Test
B. Maximizing expected utility
C. Imitating a human response
D. Learning through exploration
Correct Answer: B
Explanation: Acting Rationally focuses on maximizing expected utility based on available data.

Question 12: What is supervised learning?


A. Learning without data labels
B. Learning with labeled data
C. Learning through exploration
D. Learning by mimicry
Correct Answer: B
Explanation: Supervised learning involves training models using datasets with predefined
labels.

Question 13: Which of the following is NOT a type of machine learning?


A. Supervised learning
B. Unsupervised learning
C. Self-supervised learning
D. Recursive learning
Correct Answer: D
Explanation: Recursive learning is not a standard category in machine learning.

Question 14: What is the role of reinforcement learning?


A. Classifying images
B. Predicting outcomes
C. Learning through trial and error
D. Clustering data
Correct Answer: C
Explanation: Reinforcement learning optimizes actions based on rewards and penalties.

Question 15: What application of ML is common in fraud detection?


A. Reinforcement learning
B. Image recognition
C. Pattern recognition
D. Supervised learning
Correct Answer: C
Explanation: Fraud detection often uses pattern recognition to identify anomalies in
transactions.

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 20: What is Precision Agriculture an application of?


A. Machine Learning
B. Data Mining
C. View synthesis
D. Natural Language Processing
Correct Answer: A
Explanation: Precision Agriculture uses Machine Learning to optimize farming processes.

Question 21: Text-to-speech technology in Alexa is an example of:


A. Recommender systems
B. Natural Language Processing
C. Speech synthesis
D. Reinforcement Learning
Correct Answer: C
Explanation: Text-to-speech systems convert textual data into spoken words, which is part of
speech synthesis.

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 23: Alexa uses Automatic Speech Recognition to:


A. Recommend books
B. Convert voice commands into text
C. Predict user actions
D. Process and understand human language
Correct Answer: B
Explanation: Automatic Speech Recognition (ASR) translates spoken words into text.

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 25: What is the goal of View Synthesis in Machine Learning?


A. Recognizing objects in images
B. Generating novel perspectives of scenes
C. Recommending viewpoints
D. Mining data clusters
Correct Answer: B
Explanation: View Synthesis generates new viewpoints of a scene based on existing images.

Question 26: Which Machine Learning application predicts protein structures?


A. Data Mining
B. Precision Agriculture
C. Supervised Learning
D. Protein 3D structure prediction
Correct Answer: D
Explanation: Protein 3D structure prediction applies ML to understand protein folding.
Question 27: Which ML approach focuses on decision-making through reward systems?
A. Reinforcement Learning
B. Supervised Learning
C. Unsupervised Learning
D. Natural Language Processing
Correct Answer: A
Explanation: Reinforcement Learning maximizes rewards through trial-and-error learning.

Question 28: Which application is not related to Machine Learning?


A. Predicting movie recommendations
B. Clustering user behavior data
C. Finding anomalies in transactions
D. Simple mathematical calculations
Correct Answer: D
Explanation: Simple calculations do not require Machine Learning.

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 30: Which ML application generates captions for images?


A. View synthesis
B. Automatic speech recognition
C. Image captioning
D. Precision agriculture
Correct Answer: C
Explanation: Image captioning uses ML to understand image content and generate descriptive
text.

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 33: Fill in the blank:


Machine Learning systems such as Netflix recommendations are examples of
______________________.
Correct Answer: Recommender systems
Explanation: Recommender systems predict user preferences based on past behavior to
provide personalized suggestions.

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 35: What is an example of a supervised learning application?


A. Predicting house prices based on historical data
B. Clustering customer data
C. Finding associations in shopping trends
D. Learning game strategies from rewards
Correct Answer: A
Explanation: Supervised Learning uses labeled historical data to make predictions, such as
house prices.

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 2: What is the purpose of comments in Python?


A. To execute code faster
B. To improve code readability and explain logic
C. To store variables temporarily
D. To avoid syntax errors
Correct Answer: B
Explanation: Comments are used to make code more understandable by providing context or
explanations.

Question 3: Which of the following is a multi-line comment in Python?


A. # This is a comment
B. """ This is a multi-line comment """
C. /* This is a comment */
D. // This is a comment
Correct Answer: B
Explanation: Multi-line comments are written inside triple quotes """.

Question 4: What is typecasting in Python?


A. Changing a variable's data type temporarily or permanently
B. Removing a variable from memory
C. Writing comments in code
D. Reassigning a variable
Correct Answer: A
Explanation: Typecasting converts one data type to another.

Question 5: What does int("5") do in Python?


A. Converts "5" to a string
B. Converts "5" to an integer
C. Adds 5 to the integer value of the string
D. Generates an error
Correct Answer: B
Explanation: int("5") converts the string "5" into the integer 5.

Question 6: Which of the following converts a float to an integer?


A. int()
B. str()
C. float()
D. bool()
Correct Answer: A
Explanation: The int() function converts a float to an integer by truncating the decimal part.

Question 7: What does the type() function do?


A. Changes the data type of a variable
B. Returns the data type of a variable
C. Prints the data type of a variable
D. Compares two variables
Correct Answer: B
Explanation: The type() function returns the type of the specified object.
Question 8: What is the output of type(‘Hello’)?
A. <class 'string'>
B. <class 'str'>
C. string
D. str
Correct Answer: B
Explanation: Strings in Python are represented as <class 'str'>.

Question 9: What will type(3.14) return?


A. <class 'float'>
B. <class 'int'>
C. <class 'double'>
D. <class 'number'>
Correct Answer: A
Explanation: The value 3.14 is a float, and its type is <class 'float'>.

Question 10: What does the len() function do?


A. Finds the length of a variable
B. Finds the length of a data structure
C. Finds the length of a string, list, or tuple
D. All of the above
Correct Answer: D
Explanation: The len() function returns the number of items in an object like a string, list, or
tuple.

Question 11: What is the output of len("Python")?


A. 5
B. 6
C. 7
D. Error
Correct Answer: B
Explanation: The string "Python" has 6 characters.
Question 12: What will len([]) return?
A. 0
B. 1
C. None
D. Error
Correct Answer: A
Explanation: An empty list has a length of 0.

Question 13: What does the sum() function do?


A. Adds all elements in a numeric list or tuple
B. Finds the maximum value in a list
C. Calculates the average of a list
D. Multiplies all elements in a list
Correct Answer: A
Explanation: The sum() function returns the sum of all numeric elements in a list or tuple.

Question 14: What will sum([1, 2, 3]) return?


A. 5
B. 6
C. [1, 2, 3]
D. Error
Correct Answer: B
Explanation: The sum of 1 + 2 + 3 is 6.

Question 15: What happens when sum(["a", "b", "c"]) is executed?


A. Returns "abc"
B. Returns the ASCII sum of the letters
C. Raises an error
D. None of the above
Correct Answer: C
Explanation: The sum() function only works with numeric data types.

Question 16: What is the purpose of the print() function?


A. Assigns values to variables
B. Displays output on the screen
C. Takes user input
D. Runs Python scripts
Correct Answer: B
Explanation: The print() function is used to display output.

Question 17: What is the output of print("Hello, World!")?


A. Hello, World!
B. "Hello, World!"
C. Error
D. None
Correct Answer: A
Explanation: The print() function displays the given text without quotes.

Question 18: Which separator does print() use by default?


A. Comma (,)
B. Space ( )
C. Newline (\n)
D. Tab (\t)
Correct Answer: B
Explanation: By default, the print() function separates items with a space.

Question 19: What does the input() function do?


A. Takes user input as a string
B. Executes system commands
C. Initializes variables
D. None of the above
Correct Answer: A
Explanation: The input() function reads user input from keyboard as a string.

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.

Question 22: What will the following code print?

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.

Question 23: What is the output of the following code?

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.

Question 25: What does list.append(x) do?


A. Removes x from the list
B. Adds x to the list
C. Inserts x at the beginning of the list
D. Returns the length of the list
Correct Answer: B
Explanation: The append() method adds an element to the end of the list.

Question 26: What will the following code print?

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 27: What will the following code output?

lst = [10, 20, 30, 40]

for num in lst:

print(num, end=" ")


A. 10 20 30 40
B. 10\n20\n30\n40\n
C. 40 30 20 10
D. Error
Correct Answer: A
Explanation: The end=" " parameter ensures elements are printed on the same line
separated by spaces.

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.

Question 29: What does the following code output?

lst = ["apple", "banana", "cherry"]

for i in range(len(lst)):

print(lst[i])

A. apple banana cherry


B. 0 apple\n1 banana\n2 cherry
C. apple\nbanana\ncherry
D. Error
Correct Answer: C
Explanation: The range(len(lst)) generates indices, and the loop accesses list elements
using these indices.
Question 30: What does range(5) generate?
A. Numbers from 1 to 5
B. Numbers from 0 to 5
C. Numbers from 0 to 4
D. Error
Correct Answer: C
Explanation: range(5) generates numbers starting from 0 up to (but not including) 5.

Question 31: What will the following code output?

for i in range(2, 8):

print(i, end=", ")

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.

Question 32: What does the step parameter in range() do?


A. Determines the number of iterations
B. Specifies how much to increment or decrement in each step
C. Sets the starting value
D. Specifies the total range size
Correct Answer: B
Explanation: The step parameter determines how much the sequence increments or
decrements with each iteration.

Question 33: What will the following code output?

for i in range(10, 4, -2):

print(i, end=" ")


A. 10 8 6
B. 10 8 6 4
C. 10 9 8 7 6 5 4
D. Error
Correct Answer: A
Explanation: The range starts at 10 and decreases by 2, stopping before 4.

Question 34: What is the result of range(5, 10, 0)?


A. 5, 6, 7, 8, 9
B. Error
C. Infinite loop
D. An empty sequence
Correct Answer: B
Explanation: A step value of 0 in range() raises an error.

Question 35: What will the following code output?

for i in range(3):

print("Python")

A. Python Python Python


B. Python\nPython\nPython
C. Python
D. Error
Correct Answer: B
Explanation: The loop iterates 3 times, printing "Python" in each iteration on a new line.

Question 36: How do you iterate backward through a range of numbers?


A. for i in range(10, 1):
B. for i in range(10, 1, -1):
C. for i in range(10, 1, +1):
D. None of the above
Correct Answer: B
Explanation: The third parameter, -1, specifies a decrementing step.
Question 37: What is the output of this code?

x = 10

if x > 5:

if x % 2 == 0:

print("Even and greater than 5")

else:

print("Odd and greater than 5")

else:

print("5 or less")

A. Even and greater than 5


B. Odd and greater than 5
C. 5 or less
D. Error
Correct Answer: A
Explanation: Since x = 10 is greater than 5 and even, the first block executes.

Question 38: What will the following code print?

x = 15

if x < 10:

print("Less than 10")

elif x < 20:

print("Between 10 and 20")

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.

Question 39: Which part of the following code will execute?

x = 7

if x > 10:

print("Greater than 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

print(i, end=" ")

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.

Question 41: What does the continue statement do in a loop?


A. Exits the loop
B. Skips the current iteration
C. Restarts the loop
D. Raises an error
Correct Answer: B
Explanation: The continue statement skips the rest of the code in the current iteration.

Question 42: What is the output of the following code?

for i in range(5):

if i == 2:

continue

print(i, end=" ")

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.

Question 43: What will this code output?

for i in range(3):

for j in range(3):

if i == j:

break

print(f"{i}, {j}", end="; ")

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.

Question 45: What does the // operator do in Python?


A. Performs division and returns the remainder
B. Performs division and returns the decimal result
C. Performs division and returns the largest integer less than or equal to the result
D. Performs multiplication
Correct Answer: C
Explanation: The // operator is used for floor division, which returns the largest integer less
than or equal to the division result.

Question 46: What is the output of the following code?

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.

Question 47: What does the ** operator do in Python?


A. Multiplies two numbers
B. Calculates the square root of a number
C. Raises a number to the power of another number
D. Divides two numbers
Correct Answer: C
Explanation: The ** operator is used for exponentiation, raising one number to the power of
another.

Question 48: What is the output of the following code?

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.

Question 49: What is the purpose of the % operator in Python?


A. Performs division and returns the quotient
B. Performs multiplication
C. Returns the remainder of a division operation
D. Raises a number to a power
Correct Answer: C
Explanation: The % operator is the modulus operator, which returns the remainder of a division.

Question 50: What does the = operator do in Python?


A. Compares two values
B. Assigns a value to a variable
C. Checks if two values are equal
D. Checks if two values are not equal
Correct Answer: B
Explanation: The = operator is used for assigning a value to a variable.

Question 51: What does the == operator do in Python?


A. Assigns a value to a variable
B. Checks if two values are not equal
C. Checks if two values are equal
D. None of the above
Correct Answer: C
Explanation: The == operator compares two values and returns True if they are equal.

Question 52: What is the output of the following code?

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.

Question 53: What does the != operator check?


A. If two values are equal
B. If two values are not equal
C. If one value is greater than the other
D. If one value is less than the other
Correct Answer: B
Explanation: The != operator checks if two values are not equal and returns True if they are
different.

Question 54: What will the following code output?

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?

num = int(input("Enter a number: "))

sum = 0

for element in range(1, num):

sum = sum + element

avg = sum / n

print("Average: ", avg)

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.

You might also like