Data Analysis Python SQL Notes MCQ
Data Analysis Python SQL Notes MCQ
1. Introduction to Python 3
2. Functions in Python 4
7. SQL Queries 9
8. NoSQL Databases 10
2. Environment setup involves installing Python interpreter and an IDE (e.g., VS Code, PyCharm, Jupyter
Notebook).
IDE ( VS Code, PyCharm, Jupyter
Notebook) ।
3. Variables are created by assignment (x = 10); Python is dynamically typed, so type is decided at runtime.
(x = 10);
, - ।
4. Basic data types: int, float, complex, str, bool, list, tuple, set, dict.
: int, float, complex, str, bool, list, tuple, set, dict।
5. Operators: Arithmetic (+ - * / // % **), Comparison (== != > < >= <=), Logical (and or not), Assignment (=
+= -=), Membership (in, not in), Identity (is, is not).
: (+ - * / // % **), (== != > < >= <=), (and or not),
(= += -=), (in, not in), (is, is not)।
6. Data structures: List (ordered, mutable, []), Tuple (ordered, immutable, ()), Set (unordered, unique
elements, {}), Dictionary (key-value pairs, {key: value}).
: (ordered, mutable, []), (ordered, immutable, ()), (unordered,
unique elements, {}), (key-value pairs, {key: value})।
7. Control flow statements: if / elif / else for decisions; for and while loops for repetition; break, continue, pass
for loop control.
: if / elif / else; for
while ; break, continue, pass।
8. Indentation (whitespace) defines code blocks in Python instead of curly braces {}.
{}
( ) ।
REVISION NOTES • पुनरावृत्ति नोट्स Data Analysis with Python & SQL | NSQF L5
2. Built-in functions (print(), len(), range(), type(), input()) are readily available; user-defined functions are
created by the programmer.
- (print(), len(), range(), type(), input()) ;
- ।
4. The 'return' statement sends a value back to the caller; a function without return gives None.
'return' ; return
None ।
5. Lambda functions are small, anonymous, single-expression functions defined with the 'lambda' keyword,
useful for short operations passed to other functions (e.g., map, filter, sorted).
, (anonymous), -
'lambda' , map, filter, sorted
।
6. Python 'datetime' module handles dates and times; strftime()/strptime() convert between string and
datetime formats.
'datetime' ; strftime()/strptime()
datetime ।
7. Timezone handling uses modules like pytz or zoneinfo; timedelta is used for date/time arithmetic
(adding/subtracting durations).
pytz zoneinfo ;
timedelta / ( / )
।
8. Modules are single .py files; packages are folders of related modules with an __init__.py file, imported
using 'import' or 'from ... import ...'.
.py ;
__init__.py , 'import' 'from ... import ...'
।
2. An object is an instance of a class, created by calling the class name like a function; __init__() is the
constructor method.
,
; __init__() ।
4. NumPy is a Python library for fast numerical computation using n-dimensional arrays (ndarray).
NumPy n- (ndarray)
।
5. NumPy arrays are created using [Link](), [Link](), [Link](), [Link](), [Link]().
NumPy [Link](), [Link](), [Link](), [Link](), [Link]()
।
6. Indexing and slicing access specific elements/sub-arrays (arr[0], arr[1:3], arr[:, 0] for 2D arrays).
/ -
(arr[0], arr[1:3], 2D arr[:, 0])।
7. Array operations (add, multiply, broadcasting) work element-wise and are much faster than plain Python
loops.
( , , ) -
।
2. DataFrames can be created from dictionaries, lists, NumPy arrays, or by reading files (pd.read_csv(),
pd.read_excel()).
DataFrame dictionaries, lists, NumPy arrays , (pd.read_csv(), pd.read_excel())
।
3. [Link](), [Link](), [Link](), [Link]() give a quick overview of data structure and statistics.
[Link](), [Link](), [Link](), [Link]()
।
4. Indexing/slicing uses loc[] (label-based) and iloc[] (position-based) to select rows and columns.
/ loc[] ( - ) iloc[] ( - )
।
5. df.to_csv() writes data to CSV, while pd.read_csv() reads data efficiently while preserving structure.
df.to_csv() CSV , pd.read_csv()
।
6. GroupBy() groups rows sharing common values and applies aggregate functions (sum, mean, count) to
analyze data based on specific criteria.
GroupBy()
(sum, mean, count)
।
7. [Link]() and merge() combine data from multiple DataFrames based on common attributes/keys
while preserving data integrity and structure.
[Link]() merge() /keys DataFrames
।
8. Handling missing data: isnull(), dropna(), fillna() detect and manage missing/NaN values.
: isnull(), dropna(), fillna() /NaN
।
2. Good data modelling adheres to principles of clarity, consistency, accuracy, completeness, and
reusability.
, (consistency), , :
।
3. Data modelling improves data quality, understanding, accessibility and supports better decision-making.
, ,
।
4. Common types: Conceptual model (high-level entities), Logical model (attributes & relationships), Physical
model (actual database implementation).
: ( - ),
(attributes ), ( )।
2. RDBMS (Relational DBMS) stores data in tables (relations) made of rows and columns, e.g., MySQL,
PostgreSQL, Oracle, SQL Server.
RDBMS ( DBMS) (relations)
, MySQL, PostgreSQL, Oracle, SQL Server।
3. RDBMS ensures data integrity through primary keys (unique row identifiers) and foreign keys (linking
related tables).
RDBMS (unique row identifiers) (
) ।
4. ACID properties (Atomicity, Consistency, Isolation, Durability) guarantee reliable transaction processing.
ACID (Atomicity, Consistency, Isolation, Durability)
।
5. Normalization organizes tables to reduce redundancy and improve data segregation and integrity (1NF,
2NF, 3NF).
6. RDBMS provides efficient data access, query processing, and transaction management capabilities.
RDBMS ,
।
7. Joins (INNER, LEFT, RIGHT, FULL) combine rows from two or more tables based on a related column,
minimizing redundancy.
(INNER, LEFT, RIGHT, FULL)
, ।
2. SELECT retrieves data; WHERE filters rows; ORDER BY sorts results; GROUP BY groups rows for
aggregation; HAVING filters groups.
SELECT ; WHERE ; ORDER BY
; GROUP BY
; HAVING ।
3. Aggregate functions: COUNT(), SUM(), AVG(), MIN(), MAX() summarize data across rows.
: COUNT(), SUM(), AVG(), MIN(), MAX()
।
4. DDL (CREATE, ALTER, DROP) defines schema; DML (INSERT, UPDATE, DELETE) manipulates data;
DCL (GRANT, REVOKE) controls access.
DDL (CREATE, ALTER, DROP) ; DML (INSERT, UPDATE, DELETE)
; DCL (GRANT, REVOKE) ।
5. JOIN clause combines columns from multiple tables using a related key; subqueries (nested SELECT)
filter or compute values used by an outer query.
JOIN
; ( SELECT)
।
6. Constraints (PRIMARY KEY, FOREIGN KEY, NOT NULL, UNIQUE, CHECK) enforce data validity and
relationships.
(PRIMARY KEY, FOREIGN KEY, NOT NULL, UNIQUE, CHECK)
।
2. NoSQL databases efficiently store and retrieve data with high scalability and availability, providing
flexibility in data modelling.
NoSQL
,
।
3. Common types: Document stores (MongoDB), Key-Value stores (Redis), Column-family stores
(Cassandra), Graph databases (Neo4j).
: (MongoDB), - (Redis),
- (Cassandra), (Neo4j)।
4. High availability, replication, and consistency in NoSQL ensure data integrity and reliability for
mission-critical applications.
NoSQL , (replication) (consistency)
-
।
5. NoSQL databases generally follow the CAP theorem (Consistency, Availability, Partition tolerance — pick
any two) rather than strict ACID compliance.
NoSQL ACID CAP (Consistency,
Availability, Partition tolerance — ) ।
Marks Distribution / अंक वितरण Theory Marks only — Total 100 Marks
Python Basics 15
Functions 13
Data Modelling 7
SQL Queries 15
NoSQL 10
TOTAL 100
Tip / : Attempt easy topics first, mark tough questions for review, and manage roughly 54 seconds per question
within the 90-minute limit.
Which of the following is the correct file extension for Python files?
?
A. .pt B. .py
C. .pyt D. .pyth
Which data structure allows duplicate values but no ordering guarantee change (unordered,
unique elements)?
(unique)
(unordered) ?
A. List B. Tuple
C. Set D. Dictionary
Which loop is best suited when the number of iterations is known in advance?
,
?
A. while loop B. for loop
C. do-while loop D. infinite loop
Which statement skips the current iteration and continues with the next one in a loop?
?
A. break B. pass
C. continue D. return
Q16. Functions
Q17. Functions
Q18. Functions
Q19. Functions
Q20. Functions
Q21. Functions
Which module in Python is primarily used for date and time handling?
?
A. time_utils B. datetime
C. calendar_lib D. dates
Q22. Functions
Q23. Functions
Q24. Functions
Q25. Functions
A Python 'package' is a folder that must contain which special file (traditionally)?
' '
?
A. [Link] B. __init__.py
C. [Link] D. [Link]
Q26. Functions
Which statement correctly imports only the 'sqrt' function from the math module?
'sqrt'
?
A. import sqrt from math B. from math import sqrt
C. include [Link] D. using [Link]
Q27. Functions
Q28. Functions
What is the special method called that runs automatically when an object is created?
?
A. __start__ B. __init__
C. __new__ D. __create__
Which OOP principle allows a child class to acquire properties of a parent class?
OOP
?
A. Encapsulation B. Polymorphism
C. Inheritance D. Abstraction
Hiding internal data of an object and exposing only necessary parts is called:
?
A. Polymorphism B. Encapsulation
C. Inheritance D. Overloading
The ability of different classes to respond to the same method call in their own way is:
-
?
A. Polymorphism B. Abstraction
C. Encapsulation D. Inheritance
Which NumPy function generates evenly spaced values within a given interval (using step size)?
NumPy (step size)
?
A. [Link]() B. [Link]()
C. [Link]() D. [Link]()
In a NumPy 2D array 'arr', which expression selects the first column of all rows?
NumPy 2D 'arr'
?
A. arr[0,:] B. arr[:,0]
C. arr[0][0] D. [Link](0)
What is the main advantage of NumPy arrays over plain Python lists for numerical work?
NumPy
?
A. Easier syntax only B. Faster, vectorized element-wise
operations
C. They can store any object type D. They are always smaller in size
Which NumPy function creates an array with a given range and step, similar to Python's range()?
NumPy ,
range() ?
A. [Link]() B. [Link]()
C. [Link]() D. [Link]()
Which method gives summary statistics (mean, std, min, max, etc.) of numeric columns?
(mean, std, min, max ) ?
A. [Link]() B. [Link]()
C. [Link]() D. [Link]()
Which function/method groups rows sharing a common value to apply aggregate functions?
/
?
A. df.sort_values() B. [Link]()
C. [Link]() D. [Link]()
Which method combines two DataFrames based on common columns or indexes (similar to SQL
joins)?
DataFrames
(SQL )?
A. [Link]() B. [Link]()
C. [Link]() D. [Link]()
Which method gives the data types and non-null counts of all columns in a DataFrame?
DataFrame non-null ?
A. [Link]() B. [Link]()
C. [Link]() D. [Link]()
Which type of data model represents high-level business entities without technical details?
-
?
A. Physical model B. Conceptual model
C. Logical model D. Index model
Which type of data model includes attributes and relationships but not physical storage details?
attributes
?
A. Logical model B. Physical model
C. Conceptual model D. Index model
Which type of data model describes the actual database implementation (tables, columns, data
types)?
( , ,
) ?
A. Conceptual model B. Logical model
C. Physical model D. Business model
Which ACID property ensures a transaction is fully completed or not executed at all?
ACID
?
A. Consistency B. Atomicity
C. Isolation D. Durability
Which ACID property ensures that once a transaction is committed, it remains so even after a
system failure?
ACID
?
A. Isolation B. Atomicity
C. Durability D. Consistency
?
A. Denormalization B. Normalization
C. Indexing D. Partitioning
Which JOIN returns only the matching rows from both tables?
JOIN ?
A. LEFT JOIN B. RIGHT JOIN
C. INNER JOIN D. FULL OUTER JOIN
Which JOIN returns all rows from the left table and matched rows from the right table?
JOIN
?
A. INNER JOIN B. LEFT JOIN
C. RIGHT JOIN D. CROSS JOIN
Which SQL clause is used to filter grouped results (after GROUP BY)?
GROUP BY SQL
?
A. WHERE B. HAVING
C. FILTER D. ORDER BY
Which SQL command permanently removes rows from a table based on a condition?
SQL
?
A. REMOVE B. DELETE
C. DROP D. TRUNCATE ROW
Which SQL clause is used to combine rows from two tables based on a related column?
SQL
?
A. UNION B. JOIN
C. MERGE D. LINK
Q91. NoSQL
Q92. NoSQL
Q93. NoSQL
Q94. NoSQL
Q95. NoSQL
Q96. NoSQL
NoSQL databases generally favor which trade-off compared to strict ACID compliance?
NoSQL ACID (trade-off)
?
A. CAP theorem trade-offs (e.g., eventual B. No trade-offs at all
consistency)
C. Strict single-server storage D. Manual replication only
Q97. NoSQL
Q98. NoSQL
Q99. NoSQL
Which scenario is generally MORE suitable for a NoSQL database over an RDBMS?
RDBMS NoSQL
?
A. Rapidly changing, large-scale, B. Small, fixed, strictly relational data
semi-structured data
C. Simple single-user desktop app D. Data requiring strict multi-table joins only
Q100. NoSQL
11-B 12-C 13-B 14-B 15-B 16-B 17-C 18-B 19-B 20-A
21-B 22-B 23-B 24-B 25-B 26-B 27-B 28-A 29-A 30-B
31-B 32-C 33-B 34-A 35-A 36-B 37-B 38-B 39-C 40-B
41-B 42-B 43-B 44-B 45-B 46-B 47-A 48-B 49-B 50-A
51-B 52-C 53-B 54-B 55-B 56-B 57-C 58-B 59-A 60-C
61-A 62-B 63-A 64-B 65-A 66-B 67-B 68-C 69-B 70-C
71-B 72-C 73-B 74-B 75-B 76-B 77-C 78-B 79-B 80-A
81-A 82-A 83-B 84-B 85-B 86-B 87-B 88-C 89-B 90-B
91-B 92-B 93-A 94-B 95-A 96-A 97-A 98-B 99-A 100-B
All the best for your exam! / आपकी परीक्षा के लिए शुभकामनाएं!