PYTHON
PYTHON
Python
Decorators are typically applied using the "@" symbol followed by the decorator function's name
above the function definition. When the decorated function is called, the decorator function is
executed before the decorated function's code.
# Result: [2, 4]
In this example, the list comprehension filters out only the even numbers from the numbers list
using the condition if num % 2 == 0.
4) What is the generator in Python, and how does it differ from a regular function?
Ans: In Python, a generator is a type of iterable that generates values on-the-fly, conserving
memory by producing items one at a time rather than storing them all at once. It's created using
a function with the yield keyword instead of return. When the generator function is called, it
returns a generator object. Iterating over this generator using a loop or other iterable methods
yields values one at a time, computing them when requested. Unlike regular functions that
compute and return a result, generators maintain their state between calls, allowing for efficient
processing of large or infinite sequences, making them particularly useful for memory-intensive
tasks like working with large datasets or streaming data.
SQL
SQL databases are relational databases that use tables to store structured data with a fixed
schema. They use structured query language for data manipulation and support ACID
(Atomicity, Consistency, Isolation, Durability) transactions. SQL databases are suitable for
complex queries and relationships but may lack scalability.
NoSQL databases, on the other hand, are non-relational databases that store unstructured
or semi-structured data with a flexible schema. They offer high scalability and can handle
large volumes of data but may sacrifice ACID compliance for better performance. NoSQL
databases are ideal for dynamic, rapidly changing data and horizontal scaling. The choice
between SQL and NoSQL depends on the specific requirements of a project.
2) What are the basic SQL commands for interacting with a database?
Ans: Basic SQL commands for interacting with a database include:
Uniqueness: Every value in the primary key column(s) must be unique across all rows in the
table.
Non-null: The primary key column(s) cannot contain NULL values, ensuring that each row
has a valid and unique identifier.
Uniqueness: It enforces data integrity by preventing duplicate rows, ensuring data accuracy.
Efficient Retrieval: The primary key is used to quickly locate specific rows, improving query
performance.
Relationships: Primary keys are used to establish relationships between tables through
foreign keys, enabling data normalization and referential integrity.
Indexing: Databases automatically create indexes on primary key columns, speeding up data
retrieval.
Data Integrity: Primary keys help maintain data consistency and prevent data anomalies.
Tableau
1) Explain the concept of hierarchies in Tableau.
Ans: In Tableau, hierarchies are organizational structures for data dimensions, facilitating
interactive exploration and visualization. They define levels of detail within categorical
data, like time or geography, enabling users to drill down into finer details or roll up to
broader summaries with ease. Hierarchies simplify data aggregation, enhance
visualizations, and act as filters for focused analysis. Users can dynamically navigate
through data levels, fostering a more intuitive dashboard experience. By providing
flexibility in data exploration and visualization, hierarchies empower Tableau users to
gain deeper insights and effectively communicate findings in a structured, user-friendly
manner.
2) What is the Tableau story and how can it be used to present data?
Ans: A Tableau story is a feature that allows you to combine sheets, dashboards, and text
descriptions into a sequence to create a data-driven narrative. Stories help present data
effectively by guiding the audience through key insights, analysis, and findings. They
enable storytellers to arrange visualizations and add context, annotations, and
explanations, creating a cohesive and interactive data presentation. Stories are
particularly useful for conveying a clear and compelling data-driven narrative, making
complex information more understandable and engaging for stakeholders, clients, or
decision-makers. Users can interact with story points, filter data, and explore
visualizations, enhancing their understanding of the presented data.