Overview 1 Flashcards
Difference between Tuple & List
A tuple is immutable, whereas a list is mutable. Tuples are generally used for fixed data, while lists are used for dynamic data.
Remove duplicates from a sorted list
Use set()
or a list comprehension to remove duplicates. Example: list(set(sorted_list))
.
In the given string, print each literal followed by number of occurrences in the string.
*
Example code: from collections import Counter;
s = 'yaaba daaba do';
counts = Counter(s);
for char, count in counts.items(): print(f'{char}: {count}')
.
What is Python Unit test?
Python Unit Test is a framework for testing individual units of code, usually functions, ensuring they work as expected.
How does String interpolation work in Python?
String interpolation in Python can be done using f-strings, format()
, or %
formatting. Example: f'Hello {name}'
.
Create a List in Python and print the smallest and largest items, reverse the list max, min? also could you sort list
Example code: lst = [5, 3, 8, 1]; print(min(lst), max(lst)); lst.sort(); print(lst[::-1])
.
What is SQL?
SQL (Structured Query Language) is a domain-specific language used for managing and querying data in relational databases.
What is a RDBMS, relational database management system?
RDBMS is a type of database management system that stores data in tables with relationships between them. Examples include MySQL, PostgreSQL.
What are the sublanguages of SQL?
The main sublanguages are Data Definition Language (DDL), Data Manipulation Language (DML), Data Control Language (DCL), and Transaction Control Language (TCL).
What is and How implement (multiplicity)?*
Multiplicity refers to the number of instances of one entity that can be associated with another entity. Implemented through foreign keys and relationships in database schemas.
how many primary keys in table, how many foreign
A table can have only one primary key but multiple foreign keys.
What are the differences between WHERE vs HAVING?* ex
WHERE filters rows before aggregation, while HAVING filters rows after aggregation.
List the 4 major joins (inner, outer, left, right)
INNER JOIN: Returns rows that match in both tables. OUTER JOIN: Includes unmatched rows. LEFT JOIN: Includes unmatched rows from the left table. RIGHT JOIN: Includes unmatched rows from the right table.
Write database script that creates joins between tables and queries them. Write examples here.
Example: SELECT * FROM employees INNER JOIN departments ON employees.dept_id = departments.dept_id;
What is the difference between an aggregate function and a scalar function?, examples?
Aggregate functions perform operations on groups of data, e.g., SUM()
, AVG()
. Scalar functions operate on single values, e.g., UPPER()
, LEN()
.
What is a transaction?*
A transaction is a logical unit of work, which can be committed or rolled back. It ensures data integrity.
What are the properties of a transaction?
The properties of a transaction are Atomicity, Consistency, Isolation, and Durability (ACID).
What does ACID stand for?
ACID stands for Atomicity, Consistency, Isolation, and Durability.
What are the transaction isolation levels and what do they prevent?*
The isolation levels are Read Uncommitted, Read Committed, Repeatable Read, and Serializable. They control the visibility of uncommitted data to other transactions.
what is serializable isolation level?*
Serializable isolation level ensures that transactions are executed in such a way that it’s as if they were run one after another, without interference.
What is normalization?
Normalization is the process of organizing data in a database to reduce redundancy and improve integrity.
What is the CAP Theorem?*
The CAP Theorem states that in a distributed database, you can only achieve two out of the following three properties:
Consistency: All reads received are the most updated data.
Availability: Reads and write is
Partition Tolerance.: in the case of failed nodes, the system will still rubn
List down characteristics of Bigdata (Volume/Variety/Velocity& Variability)
The 3 Vs are Volume, Velocity, and Variety. Variability refers to the inconsistency of the data flow.
What are the 5 Vs of big data?
Volume, Velocity, Value, Variety, Veracity.