×

Multiple-Choice Questions

Web Technologies MCQs

Computer Science Subjects MCQs

Databases MCQs

Programming MCQs

Testing Software MCQs

Digital Marketing Subjects MCQs

Cloud Computing Softwares MCQs

AI/ML Subjects MCQs

Engineering Subjects MCQs

Office Related Programs MCQs

Management MCQs

More

AI with Python MCQs (Multiple-Choice Questions)

Artificial Intelligence (AI) enables computer systems to perform tasks that normally require human intelligence, such as learning from data, recognizing patterns, making predictions, understanding language, and making decisions. Python is widely used for AI development because of its extensive ecosystem of libraries and frameworks for machine learning, deep learning, data analysis, and natural language processing.

AI with Python MCQs

These AI with Python MCQs cover important concepts such as artificial intelligence, machine learning, supervised and unsupervised learning, classification, regression, clustering, neural networks, deep learning, model training, evaluation, scikit-learn, PyTorch, and AI applications.

List of AI with Python MCQs

The following AI with Python MCQs are designed to test your understanding of artificial intelligence concepts and their implementation using Python.

1. What does AI stand for?

  1. Automated Information
  2. Artificial Intelligence
  3. Advanced Integration
  4. Applied Internet

Answer: B) Artificial Intelligence

Explanation:

AI stands for Artificial Intelligence, a field focused on developing systems capable of performing tasks associated with human intelligence.

2. Which programming language is widely used for Artificial Intelligence?

  1. Python
  2. HTML
  3. CSS
  4. XML

Answer: A) Python

Explanation:

Python is widely used for AI and machine learning because of its extensive ecosystem of libraries and frameworks.

3. Which Python library provides tools for machine learning?

  1. scikit-learn
  2. tkinter
  3. socket
  4. pathlib

Answer: A) scikit-learn

Explanation:

scikit-learn provides tools for predictive data analysis, including classification, regression, clustering, preprocessing, dimensionality reduction, and model selection.

4. Which Python framework is commonly used for deep learning?

  1. PyTorch
  2. Flask
  3. Beautiful Soup
  4. Requests

Answer: A) PyTorch

Explanation:

PyTorch is a deep learning framework that provides tensors, automatic differentiation, neural-network modules, optimization tools, and other features used to build machine learning models.

5. Which type of machine learning uses labeled training data?

  1. Supervised learning
  2. Unsupervised learning
  3. Random learning
  4. Unstructured learning

Answer: A) Supervised learning

Explanation:

Supervised learning trains a model using input data together with known target or output values.

6. Which type of machine learning works with data without predefined target labels?

  1. Supervised learning
  2. Unsupervised learning
  3. Rule-based learning
  4. Deterministic learning

Answer: B) Unsupervised learning

Explanation:

Unsupervised learning discovers patterns or structures in data without using predefined target labels.

7. Which machine learning task predicts a category or class?

  1. Regression
  2. Classification
  3. Clustering
  4. Dimensionality reduction

Answer: B) Classification

Explanation:

Classification is used when the target is a category, such as spam or not spam.

8. Which machine learning task predicts a continuous numerical value?

  1. Classification
  2. Regression
  3. Clustering
  4. Association

Answer: B) Regression

Explanation:

Regression models predict continuous-valued targets, such as prices, temperatures, or numerical measurements.

9. Which machine learning technique groups similar data points together?

  1. Regression
  2. Classification
  3. Clustering
  4. Prediction

Answer: C) Clustering

Explanation:

Clustering is an unsupervised learning technique used to automatically group similar data points.

10. Which algorithm is commonly used for clustering?

  1. K-Means
  2. Linear Regression
  3. Logistic Regression
  4. Naive Bayes

Answer: A) K-Means

Explanation:

K-Means is a popular clustering algorithm that partitions data into a specified number of clusters.

11. Which algorithm is commonly used for binary classification?

  1. Logistic Regression
  2. K-Means
  3. PCA
  4. Linear Regression only

Answer: A) Logistic Regression

Explanation:

Logistic Regression is commonly used for classification problems, including binary classification.

12. Which algorithm is based on decision trees and combines multiple trees?

  1. Random Forest
  2. K-Means
  3. Linear Regression
  4. PCA

Answer: A) Random Forest

Explanation:

Random Forest is an ensemble learning method that combines predictions from multiple decision trees.

13. Which algorithm predicts values using a linear relationship between variables?

  1. Linear Regression
  2. K-Means
  3. Decision Tree Classifier
  4. DBSCAN

Answer: A) Linear Regression

Explanation:

Linear Regression models a linear relationship between input features and a continuous target.

14. Which algorithm can classify data by finding a separating hyperplane?

  1. Support Vector Machine
  2. K-Means
  3. PCA
  4. Apriori

Answer: A) Support Vector Machine

Explanation:

Support Vector Machines can be used for classification by finding decision boundaries that separate classes.

15. Which algorithm is based on the idea of finding the nearest training examples?

  1. K-Nearest Neighbors
  2. Random Forest
  3. Naive Bayes
  4. PCA

Answer: A) K-Nearest Neighbors

Explanation:

K-Nearest Neighbors predicts the class or value of an observation based on nearby training examples.

16. Which algorithm is based on Bayes' theorem and commonly used for classification?

  1. Naive Bayes
  2. K-Means
  3. Random Forest
  4. Linear Regression

Answer: A) Naive Bayes

Explanation:

Naive Bayes classifiers use Bayes' theorem together with a conditional independence assumption between features.

17. What is a feature in a machine learning dataset?

  1. An input variable used by a model
  2. The final prediction only
  3. The model itself
  4. A programming language

Answer: A) An input variable used by a model

Explanation:

A feature is an input variable or measurable characteristic used by a machine learning model to make predictions.

18. What is a target in supervised machine learning?

  1. The input feature
  2. The value the model is trained to predict
  3. The Python interpreter
  4. The dataset filename

Answer: B) The value the model is trained to predict

Explanation:

The target, also called the label or output, is the value that a supervised learning model learns to predict.

19. Which function is commonly used to split data into training and testing sets in scikit-learn?

  1. train_test_split()
  2. split_data()
  3. divide_dataset()
  4. dataset_splitter()

Answer: A) train_test_split()

Explanation:

train_test_split() from sklearn.model_selection splits arrays or datasets into random training and testing subsets.

20. Why is a dataset commonly divided into training and testing sets?

  1. To evaluate how the trained model performs on unseen data
  2. To increase the number of features
  3. To remove Python syntax
  4. To convert classification into clustering

Answer: A) To evaluate how the trained model performs on unseen data

Explanation:

A test set provides data that was not used for training and can therefore be used to evaluate model performance on unseen examples.

21. Which method is generally used to train a scikit-learn estimator?

  1. fit()
  2. train()
  3. learn()
  4. build()

Answer: A) fit()

Explanation:

Scikit-learn estimators generally use the fit() method to learn model parameters from training data.

22. Which method is commonly used to generate predictions from a trained scikit-learn model?

  1. predict()
  2. forecast()
  3. output()
  4. classify_only()

Answer: A) predict()

Explanation:

Many scikit-learn estimators provide the predict() method for generating predictions from new input data.

23. What is overfitting in machine learning?

  1. When a model learns the training data too closely and performs poorly on new data
  2. When a model has no training data
  3. When all features are removed
  4. When a dataset contains only numbers

Answer: A) When a model learns the training data too closely and performs poorly on new data

Explanation:

Overfitting occurs when a model captures patterns specific to the training data, including noise, and does not generalize well to unseen data.

24. What is underfitting?

  1. When a model is too simple to capture important patterns in the data
  2. When a model memorizes all training examples
  3. When a dataset has too many rows
  4. When a model has no features

Answer: A) When a model is too simple to capture important patterns in the data

Explanation:

Underfitting occurs when a model is not sufficiently capable of representing the underlying patterns in the data.

25. Which technique is commonly used to evaluate a model using multiple train-validation splits?

  1. Cross-validation
  2. Data deletion
  3. Feature removal
  4. Random formatting

Answer: A) Cross-validation

Explanation:

Cross-validation repeatedly splits the data into training and validation portions to obtain a more robust estimate of model performance.

26. Which metric is commonly used to evaluate classification accuracy?

  1. accuracy_score
  2. mean_squared_error
  3. r2_score_only
  4. mean_absolute_error_only

Answer: A) accuracy_score

Explanation:

accuracy_score calculates the fraction or count of correctly classified samples, depending on its configuration.

27. Which metric is commonly used for regression problems?

  1. Mean Squared Error
  2. Accuracy
  3. Precision only
  4. Recall only

Answer: A) Mean Squared Error

Explanation:

Mean Squared Error (MSE) measures the average squared difference between predicted and actual target values and is commonly used for regression.

28. What does a confusion matrix summarize?

  1. Classification results by comparing predicted and actual classes
  2. Only regression errors
  3. Only training time
  4. Only feature names

Answer: A) Classification results by comparing predicted and actual classes

Explanation:

A confusion matrix summarizes classification predictions by comparing predicted classes with the actual classes.

29. What does precision measure in classification?

  1. The proportion of predicted positive cases that are actually positive
  2. The proportion of all samples that are negative
  3. The number of training iterations
  4. The number of input features

Answer: A) The proportion of predicted positive cases that are actually positive

Explanation:

Precision measures the proportion of predicted positive instances that are actually positive.

30. What does recall measure in classification?

  1. The proportion of actual positive cases that are correctly identified
  2. The number of features used by the model
  3. The number of classes only
  4. The training time

Answer: A) The proportion of actual positive cases that are correctly identified

Explanation:

Recall measures the proportion of actual positive instances that are correctly identified by the classifier.

31. What is a neural network?

  1. A model inspired by networks of interconnected processing units
  2. A database system
  3. A Python package manager
  4. A web server

Answer: A) A model inspired by networks of interconnected processing units

Explanation:

Artificial neural networks consist of interconnected computational units, commonly organized into layers, that learn patterns from data.

32. Which component of a neural network applies a transformation to its input?

  1. Activation function
  2. File handler
  3. Database cursor
  4. HTTP request

Answer: A) Activation function

Explanation:

Activation functions introduce nonlinear transformations into neural networks, allowing them to learn complex patterns.

33. Which activation function is commonly used in hidden layers of neural networks?

  1. ReLU
  2. CSV
  3. HTTP
  4. JSON

Answer: A) ReLU

Explanation:

ReLU, or Rectified Linear Unit, is a commonly used activation function in neural networks.

34. What is deep learning?

  1. A branch of machine learning involving neural networks with multiple layers
  2. A method for sorting Python lists
  3. A database query technique
  4. A file compression method

Answer: A) A branch of machine learning involving neural networks with multiple layers

Explanation:

Deep learning uses neural networks with multiple layers to learn increasingly complex representations of data.

35. What is a tensor in PyTorch?

  1. A multi-dimensional array-like data structure
  2. A database table
  3. A Python string
  4. A web request

Answer: A) A multi-dimensional array-like data structure

Explanation:

PyTorch tensors are multi-dimensional data structures used to store and process numerical data for machine learning and deep learning.

36. Which Python package provides the Tensor class used by PyTorch?

  1. torch
  2. pytorch.tensorlib
  3. torchdataonly
  4. deep.tensor

Answer: A) torch

Explanation:

The main PyTorch package is imported as torch and provides tensor operations and many other machine learning capabilities.

37. Which PyTorch feature automatically computes gradients?

  1. Autograd
  2. AutoData
  3. GradientLoader
  4. TensorFlow

Answer: A) Autograd

Explanation:

PyTorch's automatic differentiation system, commonly known as Autograd, computes gradients needed for optimization.

38. Which PyTorch method is commonly used to calculate gradients during backpropagation?

  1. backward()
  2. gradient()
  3. calculate_grad()
  4. propagate()

Answer: A) backward()

Explanation:

The backward() method is commonly used to initiate automatic differentiation and compute gradients.

39. What is the purpose of an optimizer in machine learning?

  1. To update model parameters based on gradients
  2. To display images
  3. To load HTML pages
  4. To rename datasets

Answer: A) To update model parameters based on gradients

Explanation:

Optimizers update model parameters using gradients calculated during training to minimize the model's loss.

40. Which PyTorch package provides neural network modules?

  1. torch.nn
  2. torch.network
  3. torch.neural
  4. torch.layers

Answer: A) torch.nn

Explanation:

The torch.nn package provides building blocks for constructing neural networks.

41. Which PyTorch class is commonly used as the base class for custom neural network models?

  1. torch.nn.Module
  2. torch.nn.Network
  3. torch.Model
  4. torch.NeuralModel

Answer: A) torch.nn.Module

Explanation:

Custom PyTorch neural network models generally inherit from torch.nn.Module.

42. What is the purpose of a loss function in machine learning?

  1. To measure the difference between predictions and target values
  2. To load the training dataset
  3. To increase the number of classes
  4. To create Python packages

Answer: A) To measure the difference between predictions and target values

Explanation:

A loss function quantifies how different the model's predictions are from the desired target values and provides a signal used during training.

43. What is an epoch in model training?

  1. One complete pass through the training dataset
  2. One feature in the dataset
  3. One class label
  4. One prediction only

Answer: A) One complete pass through the training dataset

Explanation:

An epoch generally refers to one complete pass through the training dataset during model training.

44. What is a batch in machine learning?

  1. A subset of training examples processed together
  2. The complete source code
  3. A single model parameter
  4. A classification label

Answer: A) A subset of training examples processed together

Explanation:

A batch is a group of training examples processed together during an optimization step.

45. What is reinforcement learning based on?

  1. Learning through interactions using rewards or penalties
  2. Only labeled static datasets
  3. Only clustering data
  4. Only image resizing

Answer: A) Learning through interactions using rewards or penalties

Explanation:

Reinforcement learning involves an agent interacting with an environment and learning behavior based on rewards and penalties.

46. Which AI field focuses on enabling computers to process and understand human language?

  1. Natural Language Processing
  2. Computer Graphics
  3. Database Management
  4. Operating Systems

Answer: A) Natural Language Processing

Explanation:

Natural Language Processing (NLP) focuses on processing, analyzing, and generating human language using computational methods.

47. Which AI field focuses on interpreting images and visual information?

  1. Computer Vision
  2. Natural Language Processing
  3. Data Warehousing
  4. Network Programming

Answer: A) Computer Vision

Explanation:

Computer Vision is an AI field concerned with analyzing and understanding visual information such as images and video.

48. What is dimensionality reduction used for?

  1. Reducing the number of features or dimensions in data
  2. Increasing the number of duplicate records
  3. Adding random labels
  4. Converting Python into another language

Answer: A) Reducing the number of features or dimensions in data

Explanation:

Dimensionality reduction transforms data into a lower-dimensional representation while attempting to preserve useful information.

49. Which algorithm is commonly used for dimensionality reduction?

  1. Principal Component Analysis
  2. Random Forest
  3. Logistic Regression
  4. K-Nearest Neighbors

Answer: A) Principal Component Analysis

Explanation:

Principal Component Analysis (PCA) is a commonly used dimensionality-reduction technique that transforms data into a set of principal components.

50. Which statement best describes AI with Python?

  1. Python can be used for AI through libraries and frameworks for machine learning, deep learning, NLP, computer vision, and data processing
  2. Python can only be used for simple mathematical calculations in AI
  3. Python is used only for creating AI databases
  4. Python does not support machine learning

Answer: A) Python can be used for AI through libraries and frameworks for machine learning, deep learning, NLP, computer vision, and data processing

Explanation:

Python has a broad AI and machine learning ecosystem. Python.org lists tools such as PyTorch, TensorFlow, scikit-learn, Transformers, and other AI-related technologies, while scikit-learn and PyTorch provide dedicated APIs for machine learning and deep learning workflows.

Advertisement
Advertisement

Comments and Discussions!

Load comments ↻


Advertisement
Advertisement
Advertisement

Copyright © 2026 www.includehelp.com. All rights reserved.