Skip to content
elevatedevco

Data & MLOps

Data and Algorithms

Learn Data and Algorithms: 40 practice questions and answers with an interactive quiz — from the offline AI Learning app.

Intermediate40 questions40 quiz questions

Questions & Answers

Tap a question to reveal its answer. Written for self-study and interview preparation.

What is 'data' in computing?

Data is raw facts, numbers, words, images, or sounds that a computer can store and process. On its own, a single piece of data (like the number 37) may have little meaning until it is given context, such as '37 degrees Celsius'. Computers turn data into useful information by organizing and analyzing it.

What is an algorithm?

An algorithm is a clear, step-by-step set of instructions for solving a problem or completing a task. Like a cooking recipe, it has a defined order of steps that lead to a result. Computers follow algorithms exactly to do everything from sorting names to recommending videos.

What is the difference between data and information?

Data is raw, unprocessed facts, while information is data that has been organized or given meaning so it is useful. For example, the numbers 90, 85, 78 are data, but 'your average test score is 84' is information. Processing data correctly turns it into helpful information.

Why do computers need algorithms to learn from examples?

Machine learning algorithms find patterns in many examples so a computer can make predictions on new, unseen data. Instead of being told every rule by a human, the computer adjusts itself based on the examples it sees. The more good-quality examples it gets, the better its predictions usually become.

What is a dataset?

A dataset is a collection of related data gathered together, often arranged in rows and columns like a spreadsheet. Each row might be one item (such as one student) and each column a feature (such as age or grade). Datasets are what machine learning models learn from.

In a data table, what is a 'feature' (or column)?

A feature is one measurable property or characteristic of each item in a dataset, usually shown as a column. For example, in a table of animals, features might be 'weight', 'height', and 'number of legs'. Features are the inputs a model uses to make predictions.

What is a 'label' in machine learning?

A label is the correct answer attached to an example that we want the model to predict. For instance, if we show a model photos of fruit, the label might be 'apple' or 'banana'. Learning from labeled examples is called supervised learning.

What is the difference between a list and a single value in Python?

A single value holds one piece of data, like the number 5, while a list holds many values in order inside square brackets, like [5, 8, 3]. Lists let us store and process collections of data easily. We can access items by their position, called an index, starting at 0.

single = 5
numbers = [5, 8, 3]
print(numbers[0])  # prints 5
What does a sorting algorithm do?

A sorting algorithm rearranges data into a particular order, such as smallest to largest or alphabetical order. Sorting makes data easier to read, search, and compare. Common examples include bubble sort and the built-in sort used in most programming languages.

nums = [4, 1, 3, 2]
nums.sort()
print(nums)  # [1, 2, 3, 4]
How does a simple linear search work?

A linear search checks each item in a list one by one, from start to end, until it finds the target or reaches the end. It is simple and works on any list, even unsorted ones, but can be slow for very large lists. In the worst case it must look at every single item.

How is binary search different from linear search?

Binary search works only on a sorted list and repeatedly checks the middle item, throwing away the half that cannot contain the target. This makes it much faster than linear search for large lists. Linear search checks items one by one and works on unsorted lists too.

What is bias in data, and why is it a problem?

Bias in data means the examples do not fairly represent all groups or situations, so the data is skewed. A model trained on biased data can make unfair or wrong decisions, such as working well for one group but poorly for another. Collecting diverse, balanced data helps reduce bias.

Give an example of how biased training data could cause an unfair AI.

If a face-recognition system is trained mostly on photos of light-skinned faces, it may work poorly for people with darker skin. This happens because the model learned from examples that did not represent everyone equally. Using a balanced, diverse dataset helps the system work fairly for all people.

What is 'training data' versus 'test data'?

Training data is the set of examples a model learns from, while test data is a separate set used to check how well the model performs on new examples it has not seen. Keeping them separate helps us judge if the model truly learned patterns or just memorized answers. Good performance on unseen test data is the real goal.

What does it mean for a model to 'overfit'?

Overfitting happens when a model memorizes the training examples too closely, including their noise and quirks, instead of learning general patterns. Such a model does great on training data but poorly on new, unseen data. It is like a student who memorizes answers but cannot solve new problems.

What is the difference between numerical data and categorical data?

Numerical data is made of numbers you can measure or count, like height or temperature. Categorical data is made of categories or labels, like colors or types of animals, which are not measured on a number scale. Knowing the type helps choose the right way to analyze the data.

What is the 'mean' (average) of a set of numbers?

The mean is found by adding up all the numbers and dividing by how many numbers there are. It gives a single value that represents the center of the data. For example, the mean of 4, 6, and 8 is (4+6+8)/3 = 6.

nums = [4, 6, 8]
mean = sum(nums) / len(nums)
print(mean)  # 6.0
What is the 'median' of a dataset?

The median is the middle value when the numbers are arranged in order. If there is an even number of values, the median is the average of the two middle ones. The median is useful because it is not pulled off by a few very large or very small values.

What is the 'mode' in a set of data?

The mode is the value that appears most often in a dataset. A dataset can have one mode, more than one mode, or no mode at all if every value appears equally. For example, in 2, 3, 3, 5, the mode is 3.

Why is cleaning data important before analyzing it?

Real-world data often has errors, missing values, or duplicates that can lead to wrong conclusions. Cleaning data means fixing or removing these problems so the analysis is accurate. The phrase 'garbage in, garbage out' reminds us that bad input data produces bad results.

What is a flowchart and how does it relate to algorithms?

A flowchart is a diagram that uses boxes and arrows to show the steps of an algorithm in order. Different shapes show different actions, like decisions (diamonds) or processes (rectangles). Flowcharts help people plan and understand an algorithm before writing code.

What is a loop in programming and why is it useful for data?

A loop repeats a set of instructions multiple times without writing them again. Loops are very useful for processing data because they can go through every item in a list one by one. This lets us handle large amounts of data with just a few lines of code.

for score in [90, 85, 78]:
    print(score)
What is a conditional ('if') statement used for?

An 'if' statement lets a program make decisions by running certain instructions only when a condition is true. This allows algorithms to react differently to different data. For example, a program could print 'Pass' only if a score is 40 or above.

score = 75
if score >= 40:
    print('Pass')
What is 'pattern recognition' in the context of AI?

Pattern recognition is when a computer detects regularities or repeated structures in data, like shapes in images or trends in numbers. AI systems use it to classify things, such as telling cats from dogs in photos. It is a core idea behind how machines 'understand' data.

What is the difference between supervised and unsupervised learning?

In supervised learning, the model learns from examples that include the correct answers (labels). In unsupervised learning, there are no labels, so the model tries to find hidden groups or patterns on its own. Both are common ways machines learn from data.

What does 'classification' mean in machine learning?

Classification is a task where a model puts data into one of several categories. For example, an email program may classify a message as 'spam' or 'not spam'. The model learns to do this from many labeled examples.

What is a graph (chart) used for when working with data?

A graph or chart shows data visually, using bars, lines, or points to make patterns and comparisons easy to see. For example, a line graph can show how temperature changes over a week. Visualizing data helps people spot trends that are hard to notice in raw numbers.

Why should we protect people's privacy when collecting data?

Data can include personal details like names, locations, or health information that people expect to be kept safe. Misusing or leaking this data can harm people or be unfair to them. Responsible data use means collecting only what is needed and keeping it secure and private.

What is 'big data'?

Big data refers to extremely large and complex datasets that are too big for ordinary tools to handle easily. It is often described by huge volume, fast speed of arrival, and many different types of data. Companies use special algorithms and computers to find useful patterns in big data.

How does an algorithm decide which video or post to recommend to you?

Recommendation algorithms look at data about what you and similar users have watched, liked, or clicked. They find patterns and predict what you are likely to enjoy next. The more you interact, the more data the algorithm has to refine its suggestions.

What is an 'index' when accessing items in a list?

An index is the position number of an item in a list, and in most languages like Python it starts at 0. So the first item has index 0, the second has index 1, and so on. Indexes let us pick out specific items from a collection of data.

fruits = ['apple', 'banana', 'cherry']
print(fruits[1])  # banana
What is a 'true/false' (Boolean) value and where is it used?

A Boolean value can only be one of two things: true or false. It is used in decisions, like checking whether a number is greater than 10. Booleans are the foundation of the logic that lets algorithms make choices.

is_adult = 15 >= 18
print(is_adult)  # False
Why is the order of steps important in an algorithm?

Algorithms must follow steps in the correct order because each step often depends on the result of the previous one. Doing steps out of order can give a wrong answer or make the algorithm fail. For example, you must boil the water before you put in the pasta, not after.

What does it mean to say one algorithm is 'faster' or 'more efficient' than another?

A more efficient algorithm solves the same problem using fewer steps, less time, or less memory. For large datasets this matters a lot, because a slow algorithm might take hours while a fast one takes seconds. Choosing an efficient algorithm is an important part of computer science.

What is a 'variable' in programming?

A variable is a named container that stores a piece of data, and its value can change while a program runs. For example, 'age = 12' stores the number 12 under the name 'age'. Variables let algorithms remember and update data as they work.

age = 12
age = age + 1
print(age)  # 13
What is missing data and how can it affect results?

Missing data happens when some values in a dataset are blank or not recorded, perhaps because a survey question was skipped. If ignored, missing data can make analyses inaccurate or biased. Data scientists handle it by filling in estimates or carefully removing incomplete records.

How can the same algorithm work on many different inputs?

A good algorithm is written as a general set of steps that does not depend on one specific input. For example, a sorting algorithm can sort any list of numbers, whether short or long. This generality is what makes algorithms so powerful and reusable.

What is an 'outlier' in a dataset?

An outlier is a value that is very different from most of the other values in a dataset. For example, if most test scores are between 60 and 90 but one is 5, that 5 is an outlier. Outliers can be real or mistakes, so data scientists investigate them carefully before deciding what to do.

Why is it important that AI decisions can be explained?

When AI affects people's lives, such as in loans or grades, those people deserve to know why a decision was made. Explainable algorithms let humans check for mistakes or unfairness and build trust. A system that no one can understand or question can hide errors and bias.

What is the rule 'correlation does not mean causation' about?

Two things can change together (correlation) without one actually causing the other. For example, ice cream sales and sunburns both rise in summer, but ice cream does not cause sunburns; hot sunny weather causes both. Confusing correlation with causation can lead to wrong conclusions from data.

Put it into practice with AI Learning

This topic — and hundreds more — comes from our free, offline AI Learning app. Practice Q&A, quizzes and cheat sheets anywhere, no account needed.

  • Free
  • No account
  • Works offline
Coming soon toGoogle Play