You are on page 1of 3

QUESTIONA

1. What is a List

2. What is a Tuple

3. What is a dictionary

4. Explain Modules and Packages in Python

5. What is OOPS concept

6. Explain various OOPS concepts

7. Explain Inheritance

8. Explain Normalization

9. Explain Encapsulation

10. Explain Polymorphism

11. How many keywords are there in Python

12. Common built-in Data Types in Python

13. Difference between PYTHON/JAVA

14. Which is faster JAVA or Python

15. What is break, continue and Pass in Python

16. What is slicing in Python

17. Explain about decorators in python

ANSWERS :-

1. As a Python fresher, I understand that a list is a versatile data structure used to store
multiple items in a single variable. It is ordered, mutable, and allows duplicate
elements.

2. A tuple is similar to a list, but it is immutable, meaning its elements cannot be


changed after creation. It is often used to store related pieces of information
together.
3. A dictionary is a collection of key-value pairs. It is unordered, mutable, and indexed.
Each key in a dictionary must be unique, and it allows for efficient data retrieval
based on keys.

4. Modules are Python files containing reusable code, while packages are directories
containing multiple modules. They help organize and manage code, allowing for
better code structure and reusability.

5. OOPS (Object-Oriented Programming) is a programming paradigm that revolves


around objects, which are instances of classes. It promotes concepts like
encapsulation, inheritance, and polymorphism.

6. Various OOPS concepts include:

- Encapsulation: Bundling data and methods that operate on that data within a single unit.

- Inheritance: Ability of a class to inherit properties and behavior from another class.

- Polymorphism: Ability to use a single interface for different data types or objects.

- Abstraction: Hiding the implementation details and showing only the necessary features
of an object.

7. Inheritance is a mechanism in OOPS where a new class (subclass) is created by


inheriting properties and behaviors from an existing class (superclass). It promotes
code reusability and establishes a hierarchical relationship between classes.

8. Normalization is the process of organizing data in a database to minimize


redundancy and dependency. It involves breaking down large tables into smaller,
related tables and defining relationships between them to maintain data integrity.

9. Encapsulation is the bundling of data and methods that operate on that data within
a single unit, typically a class. It hides the internal state of an object and only
exposes the necessary methods to interact with it, promoting data security and
abstraction.
10. Polymorphism refers to the ability of an object to take on multiple forms. In Python,
it can be achieved through method overloading and method overriding, allowing
different classes to implement methods with the same name but different
functionalities.

11. Python has a total of 35 keywords, including ‘if’, ‘else’, ‘for’, ‘while’, ‘class’, ‘def’,
‘import’, ‘from’, ‘try’, ‘except’, ‘finally’, and more.

12. Common built-in data types in Python include integers, floats, strings, lists, tuples,
dictionaries, sets, and booleans.

13. PYTHON and JAVA are both popular programming languages, but they have
differences in syntax, usage, and ecosystem. Python is known for its simplicity,
readability, and versatility, while Java is renowned for its performance, platform
independence, and strong typing.

14. Java is generally faster than Python due to its statically-typed nature and Just-In-
Time (JIT) compilation. However, Python offers simplicity, ease of use, and rapid
development, making it suitable for many applications despite its slower execution
speed.

15. In Python, ‘break’ is used to exit a loop prematurely, ‘continue’ is used to skip the
current iteration and proceed to the next one, and ‘pass’ is a null operation that
serves as a placeholder when no action is required.

16. Slicing in Python is a technique used to extract a subset of elements from a


sequence (e.g., a list, tuple, or string) based on specified indices or ranges. It
provides a concise way to manipulate sequences and access their elements
efficiently.

17. Decorators in Python are functions that modify the behavior of other functions or
methods. They allow you to add functionality to existing functions dynamically, such
as logging, authentication, or memoization, without modifying their source code.

You might also like