Font size
WorksheetsQPDS Topic_1 MCQ_2
Total questions: 91
Worksheet time: 46mins
What is Python primarily used for?
Web development
Data analysis
Machine learning
All of the above
A CSV file contains inconsistent date formats causing parsing failures. Which Python library helps unify date formats?
datetime
hashlib
turtle
math
A data analyst receives customer transaction data where dates are written in multiple formats (DD/MM/YYYY, MM-DD-YY). She must convert all formats into ISO (YYYY-MM-DD) before analysis.
Data merging
Data formatting
Data binning
Data sampling
A dataset contains a column with mixed data types (strings and numbers). Which pandas function helps convert the entire column to a single numeric type while handling errors?
pd.to_numeric(column, errors='coerce')
pd.to_string(column)
pd.astype(column, dtype=int)
column.astype(int)
What is the correct way to define a function in Python?
def functionName[]:
function functionName():
A hospital system integrates patient data from multiple departments, but each department stores different column names for “Patient ID”. The analyst must standardize all names into a single field. Which step of wrangling is needed?
Enrichment
Normalization
Standardization
Validation
Your team receives sales data with several missing values for "Price". You decide to compute the median price and fill the missing values. This wrangling activity is known as:
Imputation
Encoding
Tokenization
Partitioning
Consider the following SQL query: SELECT name, COUNT(*) FROM employees GROUP BY name HAVING COUNT(*) > 1; What does this query return?
Names of employees appearing only once
Employees with duplicate names
Employees with unique names
All employee names
Your schema analysis shows a many-to-many relationship needing decomposition. What must be created?
Junction table
View
Trigger
Which of the following is used to access rows in a pandas DataFrame?
Index
Column
Row
Index
A telecom company stores call logs in CSV, customers' plans in JSON, and billing data in XML. You need to combine all three data types into one analysis table.
Multi-format parsing
Stream ETL
Aggregation
Feature scaling
Which of the following data types is mutable in Python?
Tuple
String
List
Integer
A researcher loads a CSV file but notices that commas inside quoted text cause misalignment of columns. Which parameter of Python’s CSV reader should solve this?
delimiter
quotechar
escapechar
lineterminator
A CSV file is loaded into a pandas DataFrame, but some columns are incorrectly inferred as objects instead of integers. How can this issue be resolved?
Use df.astype({'column_name': 'int'})
Use df.convert_dtypes()
Use df.dtypes to fix data types
Use df.infer_objects()
During schema understanding, you find that a database table has foreign keys linking to multiple tables but with no documentation. What must you analyze first?
Primary key constraints
Data cardinality
Relationship structure
View dependencies
Consider the following SQL query: SELECT COUNT(*) FROM employees WHERE department = 'HR'; What does this query return?
The total number of employees.
The number of employees in the HR department.
The names of employees in the HR department.
A dataset uses “0” to represent missing age, which is incorrect. Which analytical decision is required?
Replace zeros with NULL
Delete all rows
Convert all ages to strings
Drop age column
Your JSON data contains nested objects for user preferences. You need a flat table for analysis. Which wrangling task fits?
Encoding
Flattening
Smoothing
Interpolation
Which SQL command is used to remove all records from a table without deleting the table structure?
TRUNCATE
DROP
DELETE
ALTER
Which SQL command is used to remove all records from a table, including all spaces allocated for the records are removed?
DROP
DELETE
TRUNCATE
REMOVE
Consider the following Python snippet: import sqlite3 conn = sqlite3.connect('database.db') cur = conn.cursor() cur.execute('INSERT INTO users (id, name) VALUES (?, ?)', (1, 'Alice')) conn.commit() A Python script throws a KeyError when accessing a dictionary. Which situation likely caused it?
Wrong data type
Missing key
Incorrect loop
Float value error
A company wants to switch from an unstructured XML-based system to a structured relational model. What is the first step in understanding XML data?
Reading XML tags
Understanding XML schema (XSD)
Parsing with DOM
Checking indentation
A retailer uses Python to filter products priced above ₹5000 from a list. Which Python feature is best suited?
Tuples
List slicing
List comprehensions
Sets
What happens if `conn.commit()` is omitted?
A) Data will still be saved permanently.
B) Data will be lost after the connection is closed.
C) An error will occur.
D) The database file will be deleted
An analyst loads a dataset with columns containing mixed types (numeric + string). He must convert them into consistent types before modeling. Which step is this?
Type coercion
Type imputation
Type removal
Type indexing
Which SQL function is used to return the total number of rows in a query result?
SUM()
COUNT()
TOTAL()
NUMBER()
A database table breaks 1NF rules with multivalued fields. What must be done?
Remove duplicates
Normalize structure
Reorder rows
Reintroduce foreign keys
Which SQL keyword is used to combine the results of two queries?
JOIN
MERGE
UNION
COMBINE
You receive a CSV file where the header row is missing. You manually add column names before processing. What is this action called?
Data enrichment
Data labeling
Data merging
Data augmentation
What does the following SQL query do? SELECT name FROM students WHERE marks > 80 ORDER BY marks DESC;
Returns the names of students who scored more than 80 marks, sorted in ascending order.
Returns the names of students who scored more than 80 marks, sorted in descending order.
Returns all student names sorted by marks.
Returns all students who scored exactly 80 marks.
A financial firm must ensure that daily transaction values follow business rules before storing them. What wrangling activity supports this?
Data sampling
Data validation
Data mining
Data aggregation
Which Python library is used to work with JSON data?
Jsonlib
Simplejson
Json
jsonHandler
While wrangling, you find duplicate entries that differ only by letter case (e.g., "Delhi" and "delhi"). Which transformation is required?
Convert all entries to lowercase
Remove all duplicates without transformation
Sort entries alphabetically
Replace spaces with underscores
Which of the following is a process in NLP to reduce words to their root form?
Normalization
Segmentation
Tokenization
Standard encoding
Consider the following Python SQL query execution: cur.execute('SELECT * FROM users WHERE age > ?', (30,)) What is the purpose of `(30,)` in this query?
It is an incorrect syntax.
It is a way to pass parameters safely to prevent SQL injection.
It is used for table joins.
It updates the database schema.
Python code reading a CSV generates a UnicodeDecodeError. The file is encoded in UTF-16. Which change resolves it?
Set encoding="UTF-16"
Use delimiter=","
Enable quoting
Use strip()
A Python beginner prints a string but receives an IndentationError. What is the most likely cause?
Missing semicolon
Wrong quotation
Improper spacing/tab alignment
Unclosed parentheses
Which SQL command is used to add a new column to an existing table?
ADD COLUMN
ALTER TABLE ADD COLUMN
MODIFY COLUMN
CHANGE TABLE
Which of the following is the correct way to delete a specific record from an SQL table?
DELETE FROM users;
DELETE FROM users WHERE id = 5;
REMOVE FROM users WHERE id = 5;
DROP FROM users WHERE id = 5;
Which tool is most suitable for visualizing a database schema?
SQL
ER Diagram
JSON Viewer
XML Parser
An XML file contains repeated nested nodes for "employee" inside multiple departments. You want to convert this to a normalized database schema. Which step is essential?
Parsing root first
Identifying repeating groups
Removing attributes
Trimming whitespace
What method retrieves the root element in an XML tree?
getroot()
root()
find()
tree()
Consider the Python SQLite query execution: cur.execute('DELETE FROM students WHERE age < ?', (18,)) What happens after this statement?
All students are deleted.
All students younger than 18 are deleted.
A JSON dataset includes derived attributes that are redundant. You must remove them for efficiency. Which wrangling step is applied?
Feature selection
Feature scaling
Feature duplication
Feature isolation
Your data pipeline receives corrupted JSON due to missing braces. Python raises a JSONDecodeError. Which library feature handles this?
json.dump
json.load
try-except block
json.parse
Which SQL clause is used to remove duplicate values from query results?
UNIQUE
DISTINCT
FILTER
REMOVE
Your system receives thousands of JSON records per hour, and you must validate structure quickly. Which approach is efficient?
Manual inspection
Automated schema validation
Row filtering
Data sorting
A dataset has incorrect phone numbers that don't follow a pattern. You want to detect invalid ones. What can be used?
Regex validation
Metadata extraction
Binning
Indexing
A retail dataset has many outlier values in the "Quantity" column. You evaluate whether to remove or cap them. Which step does this reflect?
Data smoothing
Outlier treatment
Aggregation analysis
Feature selection
While integrating XML and JSON, you must detect whether both datasets refer to the same data concept. Which phase does this belong to?
Schema mapping
Data transformation
Data scaling
Data sorting
A CSV file contains various encodings such as UTF-8 and ISO-8859. Python throws errors when reading them. What parameter helps resolve this?
newline
encoding
quoting
dialect
Consider the following Python snippet: import sqlite3 conn = sqlite3.connect('mydb.db') What is the purpose of the 'conn' object in this code?
It represents a connection to the SQLite database 'mydb.db'.
It is used to execute SQL queries directly.
It stores the results of a database query.
It is a cursor object for iterating over query results.
What does `cur.fetchone()` return?
A list of all rows in the table
A tuple containing the first row of the query result
A dictionary mapping column names to values
An error if the table is empty
A logistic company merges data from trucks and drones. Each dataset describes location differently. Which issue must be fixed first?
Cardinality mismatch
Schema inconsistency
Format translation
Aggregation
You have a JSON file listing students and their enrolled subjects as arrays. The analysis requires one subject per row. What transformation is needed?
Explode operation
Merge
Slice
Sort
What is the purpose of `GROUP BY` in SQL?
To filter records based on a condition
To sort query results
To group rows that have the same values in specified columns
To delete duplicate rows
Your CSV file uses semicolons (;) instead of commas. Python misreads it using default settings. Which parameter fixes this?
sep
prefix
suffix
comment
A dataset contains age values such as “23 years”, “45yrs”, and “50”. You must extract only numeric values. Which technique helps?
Hashing
Regex extraction
Windowing
Token aggregation
How is an element’s text accessed in an XML document in Python?
a). element.text()
b) . element.text
c). get_text()
d). element.getText()
A large XML file loads very slowly using DOM parsing. Which alternative improves efficiency?
SAX parsing
JSON parsing
Pandas parse
HTML parsing
Your team wants to identify whether columns in a dataset are primary keys or descriptive fields. Which process is required?
Schema profiling
Data sampling
A CSV dataset includes trailing spaces like “Laptop ”. This affects joins with other datasets. Which transformation is appropriate?
Padding
Stripping
Formatting
Encoding
What is the structure of an XML file?
Key-value pairs
Hierarchical tree
Relational table
Flat file
Which SQL clause is used to filter query results based on a condition?
WHERE
ORDER BY
GROUP BY
HAVING
A Python script concatenates strings and integers incorrectly, causing a TypeError. What is the solution?
Remove concatenation
Convert integer to string
Use try-except
Remove integers
An automobile manufacturer wants to combine engine logs (CSV) and firmware logs (JSON) for fault analysis. Which Python library is best suited for reading both?
(a)
Which of the following is a Python library for data analysis?
pandas
pillow
sklearn
Consider the following SQL command: UPDATE employees SET salary = salary * 1.1 WHERE department = 'Sales'; What does this command do?
Increases the salary of all employees.
Increases the salary of employees in the Sales department by 10%.
Decreases the salary of employees in the Sales department.
Deletes employees from the Sales department.
A JSON file contains keys in different orders, but you must compare structural integrity across files. Which concept is most relevant?
Syntactic equality
Structural schema validation
Key sorting
Literal parsing
What does JSON stand for?
JavaScript Online Notation
JavaScript Object Notation
JavaScript Object Network
None of the above
Which of the following is a valid way to execute an SQL query using Python SQLite module?
cur.run('SELECT * FROM table')
cur.query('SELECT * FROM table')
cur.execute('SELECT * FROM table')
cur.fetch('SELECT * FROM table')
A streaming service collects logs with inconsistent timestamp formats. Analysts must unify the format.
Data splitting
Data standardization
Data substitution
Data augmentation
What library is used to handle CSV files in Python?
json
os
csv
xml.etree.ElementTree
A data engineer compares columns across tables to detect mismatched data types affecting joins.
Data validation
Data encoding
Data enrichment
Data sampling
A student attempts to print multiple lines using Python triple quotes but mistakenly nests quotes incorrectly. What error type is expected?
NameError
SyntaxError
RuntimeError
ImportError
A bank merges transaction logs but finds mismatched column sizes. Which wrangling task is required first?
Alignment
Extrapolation
Sorting
A dataset stores values like "Yes", "yes", and "YES" for the same meaning. Which transformation ensures consistency?
Case normalization
Standard encoding
Feature extraction
Value aggregation
Consider the following Python snippet using SQLite: import sqlite3 conn = sqlite3.connect(':memory:') cur = conn.cursor() cur.execute('CREATE TABLE users (id INTEGER, name TEXT)') What does ':memory:' do in this code?
Creates a database file named memory.db
Stores the database in RAM instead of a file
Clears all database data after execution
Creates an encrypted SQLite database
While creating a Python dictionary, a beginner repeats a key unknowingly. The dictionary stores only the last value. What Python property explains this?
Ordered collection
Mutable nature
Unique key constraint
Immutable keys
Your JSON dataset uses arrays for employee skills. You need counts of skills per employee. Which transformation is required?
Length calculation
Array flattening
Feature extraction
A JSON API response contains both mandatory and optional fields. You must verify the fields before using them. What should you perform?
Schema checking
Encoding
Parsing
Transformation
An analyst loads employee data but the “Salary” column has values like “NA”, “NULL”, and blanks. Which cleaning step comes first?
Missing value unification
Outlier removal
Discretization
Enrichment
How do you create a comment in Python?
# This is a comment
// This is a comment
/* This is a comment */
Python list operations on a large dataset perform slowly. You decide to switch to NumPy arrays. Which benefit are you utilizing?
Recursive operations
Vectorized computation
Memory segmentation
Automatic parsing
How do you parse a JSON string in Python?
json.parse()
json.load()
Which of the following is used to parse a JSON string into a Python dictionary?
json.loads()
json.read()
A dataset contains a column with mixed data types (strings and numbers). Which pandas function helps convert the entire column to a single numeric type while handling errors?
pd.to_numeric(column, errors='coerce')
pd.to_string(column)
pd.astype(column, dtype=int)
column.astype(int)
You find that a dataset's “Salary” field stored as a string includes commas, like “40,000”. Which step should you perform to convert it to numeric?
Remove punctuation
Indexing
Sorting
Resampling
Consider the following Python snippet: import pandas as pd data = {'ID': [1, 2, 3], 'Name': ['A', 'B', 'C']} df = pd.DataFrame(data) df.to_csv('output.csv', index=False) What will be the result?
A CSV file named 'output.csv' with an extra index column
A CSV file named 'output.csv' without an index column
A JSON file named 'output.csv'
An XML file named 'output.csv'
An XML structure contains optional tags that are missing in several entries. Which step is required before loading into a database?
Add NULL placeholders
Trim whitespace
C) Remove attributes D) Minify XML
A
B
C
D
