0% found this document useful (0 votes)
37 views3 pages

Data Structures and Programming Concepts

Uploaded by

zubair413427
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)
37 views3 pages

Data Structures and Programming Concepts

Uploaded by

zubair413427
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

Question Answer Rate (0

to 10)
What is a data structure? Why A data structure is a way to organize, manage, and
are they important? store data in a way that enables efficient access and
modification. They are important because they
optimize operations like searching, sorting, and
manipulating data, directly impacting algorithm
performance.
Explain the difference between Arrays are continuous memory blocks, and linked lists
an array and a linked list. are like pointers. Arrays are fast, and linked lists are
not.
Tell me What is a stack? Give a A stack is a linear data structure that follows the Last
real-world example. In, First Out (LIFO) principle. A real-world example is a
stack of plates where the last plate added is the first
to be removed.
How does a queue differ from A queue follows the First In, First Out (FIFO) principle,
a stack? while a stack follows LIFO. In a queue, the first
element added is the first to be removed, like a line at
a ticket counter.
Explain the difference between Alright. Next question please.
an array and a linked list.
What is the time complexity of The time complexity is O(logn) for a balanced BST
searching an element in a because the tree's height determines the number of
balanced binary search tree comparisons needed for searching.
(BST)?
What is a data structure? Why Data structures are used to store data. They are good
are they important? for programming.
What is a stack? Give a real- A stack is a data structure used in programming. An
world example. example is a pile of files.

Tell the time complexity of It is O(n) because you might have to search through all
searching an element in a the elements.
balanced binary search tree
(BST)?
Describe the difference A tree is a type of graph with no cycles and a single
between a graph and a tree. root, where every node has exactly one parent. A
graph is a general structure that can have cycles,
multiple roots, and disconnected components.
What is the purpose of a trie A trie is used to store strings in a tree structure, where
(prefix tree)? each node represents a character of the string. It is
efficient for prefix-based searches, such as
autocomplete systems.
Describe the difference A tree is a graph with a root. Graphs have more
between a graph and a tree. connections than trees.

What is inheritance, and why is Inheritance allows a class to acquire the properties
it used? and methods of another class. It promotes code reuse
and establishes a parent-child relationship between
classes.
Explain the concept of Polymorphism is when the same thing works
polymorphism with an differently. For example, shapes can behave
example. differently.
What is the difference Overloading is when a method does many things.
between method overloading Overriding is when a method in a child class replaces
and method overriding? one in a parent class.
What is inheritance, and why is Inheritance is when one class copies another. It makes
it used? coding easier.
Explain the concept of Polymorphism allows objects of different classes to be
polymorphism with an treated as objects of a common superclass. For
example. example, a method draw() in a superclass Shape can
be overridden in subclasses like Circle and Rectangle
to perform specific behaviors.
What is inheritance, and why is Nice Question!! Thanks for asking
it used?
What is inheritance, and why is Inheritance is about getting properties from parents.
it used?
What is the difference Composition is better than inheritance because it is
between composition and more flexible.
inheritance?
What is an abstract class, and An abstract class can have both abstract
how is it different from an (unimplemented) and concrete (implemented)
interface? methods. An interface only defines abstract methods
(in some languages) and does not contain
implementation.
What do you know about Overfitting occurs when a model learns the training
overfitting, and how can it be data too well, including noise, and performs poorly on
prevented? new data. It can be prevented by using regularization,
cross-validation, or collecting more data.
What is the bias-variance It is about balancing bias and variance to get the best
tradeoff? accuracy.
What do you know about Parametric models assume a specific form for the
parametric and a non- function and have a fixed number of parameters (e.g.,
parametric model? linear regression). Non-parametric models do not
assume a specific form and can grow in complexity
with more data (e.g., decision trees).
What is the bias-variance The bias-variance tradeoff is the balance between
tradeoff? underfitting (high bias) and overfitting (high variance)
in a model. A good model achieves the right balance
for optimal performance.
What are some common Common methods include:
methods to handle missing • Removing rows with missing values.
data? • Imputing missing values with the mean,
median, or mode.
• Using advanced methods like k-nearest
neighbors (KNN) imputation or predictive
models.

What are some common Just delete the missing data or fill it with zeros.
methods to handle missing
data?
What is the purpose of cross- Cross-validation is used to evaluate a model's
validation? performance by splitting the data into training and
validation sets multiple times, ensuring the model
generalizes well to unseen data.
What is gradient descent, and Gradient descent is an optimization algorithm used to
why is it used? minimize a function by iteratively adjusting
parameters in the direction of the steepest descent,
as defined by the negative gradient.

What are the ACID properties ACID properties ensure reliable transactions:
in databases? • Atomicity: Transactions are all-or-nothing.
• Consistency: Transactions maintain database
validity.
• Isolation: Transactions run independently.
• Durability: Changes persist even after a
failure.

What are indexes, and how do Indexes are used to organize tables.
they work?
What is the difference DELETE removes specific rows from a table and can be
between DELETE and rolled back. TRUNCATE removes all rows from a table
TRUNCATE? and cannot be rolled back.
What is gradient descent, and Give me 5 grace marks for it.
why is it used?
What are indexes, and how do Indexes are data structures that improve the speed of
they work? data retrieval by creating pointers to the data in a
table.
What is the difference DELETE is used to remove data, while TRUNCATE is
between DELETE and used to clean a table.
TRUNCATE?
Do you know about A transaction is a sequence of operations performed
transaction in databases? as a single unit, ensuring ACID compliance for
Explain it. consistency and reliability.
What are stored procedures, Stored procedures are precompiled SQL statements
and why are they used? stored in the database to execute frequently used
operations, improving performance and reusability.
Do you know about A transaction is any operation in a database.k
transaction in databases?
Explain it.
Why is foreign key used? A foreign key is a column in one table that refers to
the primary key in another table, creating a
relationship between the two tables.
What are indexes, and how do Indexes are used to organize tables.
they work?
Why is foreign key used? A foreign key is used to link two tables.

What is the difference In pass-by-value, a copy of the variable is passed, and


between pass-by-value and changes don’t affect the original. In pass-by-reference,
pass-by-reference? the actual variable is passed, so changes affect the
original.

You might also like