0% found this document useful (0 votes)
18 views4 pages

DS Using Python Viva QA QuestionsColored

The document outlines weekly experiment-wise viva questions and answers related to data structures using Python, covering various topics such as Object-Oriented Programming, inheritance, abstraction, comprehensions, recursion, searching algorithms, sorting algorithms, stacks, queues, and linked lists. Each week focuses on specific concepts, definitions, and their applications in Python. The document serves as a study guide for understanding fundamental data structure concepts and their implementations.
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)
18 views4 pages

DS Using Python Viva QA QuestionsColored

The document outlines weekly experiment-wise viva questions and answers related to data structures using Python, covering various topics such as Object-Oriented Programming, inheritance, abstraction, comprehensions, recursion, searching algorithms, sorting algorithms, stacks, queues, and linked lists. Each week focuses on specific concepts, definitions, and their applications in Python. The document serves as a study guide for understanding fundamental data structure concepts and their implementations.
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

DATA STRUCTURES USING PYTHON

WEEKLY EXPERIMENT-WISE VIVA QUESTIONS &


ANSWERS

■ WEEK 1 – Flower Class (OOP Concepts)


1. What is the aim of this experiment?
The aim is to understand Object-Oriented Programming concepts such as class, object, constructor, and
encapsulation using a Flower class.

2. What is a class?
A class is a blueprint used to create objects. It defines properties and methods.

3. What is an object?
An object is an instance of a class that occupies memory and can access class methods.

4. What is the purpose of constructor (__init__)?


The constructor initializes the object data at the time of object creation.

5. What are instance variables?


Instance variables store data specific to an object, such as flower name and price.

6. Why are getter and setter methods used?


They control access to data and maintain encapsulation.

7. Which OOP concept is mainly used here?


Encapsulation.

■ WEEK 2 & 3 – Polygon (Inheritance & Abstraction)


1. What is the aim of this experiment?
To understand inheritance and abstraction using polygon shapes.

2. What is inheritance?
Inheritance allows a child class to acquire properties of a parent class.

3. What is an abstract class?


An abstract class contains abstract methods and cannot be instantiated.

4. What is an abstract method?


An abstract method is declared but not implemented in the parent class.

5. Why should child classes implement abstract methods?


To provide complete functionality and avoid errors.

6. What is method overriding?


Redefining a parent class method in a child class.

7. Advantage of abstraction?
It hides implementation details and improves security.

■ WEEK 4 – Comprehensions
1. What is the aim of this experiment?
To learn Python comprehensions for efficient data creation.

2. What are comprehensions?


They provide a short and readable way to create collections.
3. What is list comprehension?
A compact way to create lists in a single line.

4. What is dictionary comprehension?


A method to create dictionaries using key-value expressions.

5. What is set comprehension?


Creates a set and removes duplicate values.

6. What is generator comprehension?


Produces values one at a time and saves memory.

7. Which comprehension is memory efficient?


Generator comprehension.

■ WEEK 5 – Combinations using Recursion


1. What is the aim of this experiment?
To generate combinations using recursion.

2. What is a combination?
A selection where order does not matter.

3. Why is recursion used?


It breaks a problem into smaller sub-problems.

4. What is base condition?


It stops recursive function calls.

5. What happens without base condition?


Infinite recursion occurs.

6. What is yield keyword?


It returns a generator and pauses execution.

7. Advantage of generators?
They save memory.

■ WEEK 6 – Linear & Binary Search


1. What is searching?
Finding an element in a data structure.

2. What is linear search?


It checks elements one by one.

3. Time complexity of linear search?


O(n)

4. What is binary search?


It divides a sorted list into halves.

5. Why must data be sorted?


Binary search works only on sorted data.

6. Time complexity of binary search?


O(log n)

7. Which is faster and why?


Binary search due to divide and conquer.

■ WEEK 7 – Bubble & Selection Sort


1. What is sorting?
Arranging elements in order.

2. What is bubble sort?


Swaps adjacent elements if they are in wrong order.

3. Time complexity of bubble sort?


O(n²)

4. What is selection sort?


Selects minimum element and places it correctly.

5. Which sort is stable?


Bubble sort.

6. Why are they inefficient?


They take more time for large data.

■ WEEK 8 – Merge & Quick Sort


1. What technique is used?
Divide and conquer.

2. What is merge sort?


Divides list and merges sorted halves.

3. Time complexity of merge sort?


O(n log n)

4. What is quick sort?


Uses pivot and partitioning.

5. What is pivot?
Reference element for partitioning.

6. Worst case of quick sort?


O(n²)

■ WEEK 9 – Stack & Queue


1. What is a stack?
A data structure following LIFO.

2. Stack operations?
Push and Pop.

3. What is stack overflow?


Insertion into full stack.

4. What is a queue?
A data structure following FIFO.

5. Queue operations?
Enqueue and Dequeue.

6. Difference between stack and queue?


Stack: LIFO, Queue: FIFO.

■ WEEK 10 – Singly Linked List


1. What is a linked list?
A dynamic data structure of nodes.

2. Components of node?
Data and next pointer.
3. Why is linked list dynamic?
Memory is allocated at runtime.

4. Time complexity of traversal?


O(n)

5. Advantages of linked list?


Easy insertion and deletion.

6. Disadvantages?
No random access.

You might also like