0% found this document useful (0 votes)
4 views27 pages

Unit Qn. No 35921C03-Data Analytics Using Python Blooms Level Course Outcom e

The document contains a series of multiple-choice questions related to data analytics using Python, covering topics such as file extensions, functions, loops, data types, and libraries like NumPy and Pandas. Each question is associated with a Bloom's taxonomy level and a course outcome. The questions test fundamental concepts and operations in Python programming and data manipulation.

Uploaded by

udaya.avcs0102
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views27 pages

Unit Qn. No 35921C03-Data Analytics Using Python Blooms Level Course Outcom e

The document contains a series of multiple-choice questions related to data analytics using Python, covering topics such as file extensions, functions, loops, data types, and libraries like NumPy and Pandas. Each question is associated with a Bloom's taxonomy level and a course outcome. The questions test fundamental concepts and operations in Python programming and data manipulation.

Uploaded by

udaya.avcs0102
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

QB

Course
Qn. Blooms
Unit Part 35921C03-DATA ANALYTICS USING PYTHON Outcom
No Level
e
What is the correct extension for a Python file?

A) .java
1 1 1 2 CO1
B) .py
C) .pt
D) .python
Which function is used to display output in Python?

A) input()
1 1 2 1 CO1
B) display()
C) print()
D) show()
What does the if statement do in Python?

A) Repeats code
1 1 3 1 CO1
B) Stores data
C) Makes decisions
D) Imports modules

Which loop is best when the number of iterations is known?

A) while loop
1 1 4 1 CO1
B) for loop
C) do-while loop
D) Infinite loop

What is the output of the following code?

for i in range(3):
print(i)
1 1 5 1 CO1
A) 1 2 3
B) 0 1 2
C) 0 1 2 3
D) Error
Which keyword stops a loop completely?

A) skip
1 1 6 1 CO1
B) stop
C) continue
D) break
Which keyword skips the current iteration in a loop?

A) pass
1 1 7 B) continue 1 CO1
C) break
D) return

What is a function in Python?

A) A loop
1 1 8 1 CO1
B) A variable
C) A reusable block of code
D) A list

Page 1 of 15
QB
Which keyword is used to define a function?

A) func
1 1 9 2 CO1
B) define
C) def
D) function
What is the output of this code?

def add(a, b):


return a + b

1 1 10 print(add(2, 3)) 1 CO1

A) 23
B) 5
C) Error
D) None
Which data type stores multiple items in Python?

A) Integer
1 1 11 1 CO1
B) Float
C) List
D) Boolean
Which symbol is used for list indexing?

A) { }
1 1 12 2 CO1
B) ( )
C) < >
D) [ ]
What is the index of the first element in a list?

A) 1
1 1 13 2 CO1
B) -1
C) 0
D) 2
Which method adds an element to a list?

A) insert()
1 1 14 2 CO1
B) append()
C) add()
D) push()
Lists in Python are:

A) Immutable
1 1 15 2 CO1
B) Mutable
C) Fixed-size
D) Read-only
What is the output of this code?

x = [1, 2, 3]
x[1] = 5
print(x)
1 1 16 1 CO1
A) [1, 2, 3]
B) [1, 5, 3]
C) [5, 2, 3]
D) Error

Page 2 of 15
QB
Which function returns the length of a list?

A) size()
1 1 17 1 CO1
B) count()
C) len()
D) length()
What does range(5) generate?

A) 1 to 5
1 1 18 B) 0 to 4 1 CO1
C) 0 to 5
D) 1 to 4

Which special variable indicates that a Python file is executed directly?

A) __python__
1 1 19 1 CO1
B) __file__
C) __main__
D) __name__
What is the output of this code?

numbers = [1, 2, 3]
print(numbers[-1])
1 1 20 1 CO1
A) 1
B) 2
C) 3
D) Error
Which of the following is a sequence data type in Python?

A) Set
2 1 21 1 CO2
B) Dictionary
C) List
D) Boolean
Which sequence type is immutable?

A) List
2 1 22 1 CO2
B) Set
C) Dictionary
D) Tuple
Which collection stores unique elements only?

A) List
2 1 23 B) Tuple 1 CO2
C) Set
D) String
Which data type stores values in key-value pairs?

A) List
2 1 24 2 CO2
B) Set
C) Dictionary
D) Tuple

Page 3 of 15
QB
What is the output of this code?

x = {1, 2, 2, 3}
print(x)
2 1 25 1 CO2
A) {1, 2, 2, 3}
B) {1, 2, 3}
C) [1, 2, 3]
D) Error
Which method returns all keys in a dictionary?

A) values()
2 1 26 1 CO2
B) items()
C) keys()
D) get()
Which method removes an item from a dictionary?

A) append()
2 1 27 1 CO2
B) remove()
C) delete()
D) pop()
What is a class in Python?

A) A loop
2 1 28 1 CO2
B) A blueprint for objects
C) A module
D) A variable
An object is also called:

A) Function
2 1 29 1 CO2
B) Operator
C) Instance
D) Constructor
Which special method is automatically called when an object is created?

A) __start__()
2 1 30 1 CO2
B) __main__()
C) __create__()
D) __init__()
Which keyword is used for inheritance?

A) extends
2 1 31 1 CO2
B) inherits
C) class
D) No special keyword needed
What is inheritance mainly used for?

A) Error handling
2 1 32 1 CO2
B) Code reusability
C) Loop execution
D) File handling
Which block is used to handle exceptions?

A) check-except
2 1 33 2 CO2
B) try-except
C) error-catch
D) final-except

Page 4 of 15
QB
Which exception occurs when dividing by zero?

A) ValueError
2 1 34 2 CO2
B) TypeError
C) ZeroDivisionError
D) NameError
Which block always executes whether an exception occurs or not?

A) except
2 1 35 2 CO2
B) try
C) finally
D) raise
Which module is used for regular expressions in Python?

A) regex
2 1 36 2 CO2
B) pyregex
C) re
D) pattern
Which function finds all matches of a pattern?

A) search()
2 1 37 2 CO2
B) match()
C) split()
D) findall()
What does \d represent in regular expressions?

A) Alphabet
2 1 38 2 CO2
B) Digit
C) Space
D) Symbol
Which function replaces matched text in a string?

2 1 39 A) replace() 1 CO2
B) sub()
C) findall()
D) search()
What is the output of this code?

import re

text = "apple banana"


x = [Link]("banana", text)
2 1 40 1 CO2
print(x is not None)

A) False
B) None
C) True
D) Error
NumPy is mainly used for:

A) Web development
3 1 41 1 CO3
B) Numerical computing
C) Game development
D) Networking

Page 5 of 15
QB
Which function is used to import NumPy?

A) import numpy as np
3 1 42 1 CO3
B) import np
C) import num
D) load numpy
NumPy arrays are:

A) Slow
3 1 43 2 CO3
B) Fixed-size and homogeneous
C) Heterogeneous only
D) Unstructured only
Which attribute gives the shape of an array?

A) size
3 1 44 B) shape 1 CO3
C) dim
D) type
What does ndim represent?

A) Number of elements
3 1 45 1 CO3
B) Number of dimensions
C) Data type
D) Index position
Which operation is faster in NumPy?

3 1 46 A) Loop-based operations 2 CO3


B) Vectorized operations
C) Recursive operations
D) Manual indexing
Broadcasting in NumPy means:

A) Sending data over network


3 1 47 1 CO3
B) Copying arrays
C) Performing operations on different shaped arrays
D) Sorting arrays
Which function returns the sum of array elements?

A) add()
3 1 48 1 CO3
B) sum()
C) total()
D) aggregate()
What does axis=0 represent?

A) Row-wise operation
3 1 49 2 CO3
B) Column-wise operation
C) Diagonal operation
D) Random operation
Which function returns maximum value in an array?

A) max()
3 1 50 1 CO3
B) maximum()
C) highest()
D) top()

Page 6 of 15
QB
Boolean indexing is used for:

A) Sorting arrays
3 1 51 1 CO3
B) Filtering data
C) Creating loops
D) Merging arrays
What is the output type of a comparison operation on NumPy arrays?

A) Integer array
3 1 52 1 CO3
B) Boolean array
C) String array
D) Float array
Fancy indexing uses:

A) Strings
3 1 53 B) Lists of indices 2 CO3
C) Loops
D) Dictionaries

Which function sorts a NumPy array?

A) order()
3 1 54 2 CO3
B) sort()
C) arrange()
D) rank()
argsort() returns:

A) Sorted values
3 1 55 1 CO3
B) Index positions of sorted elements
C) Maximum value
D) Boolean mask
Structured arrays in NumPy are used for:

A) Image processing
3 1 56 1 CO3
B) Storing different data types like records
C) Sorting only
D) Random numbers
Which of the following is NOT a NumPy aggregation function?

A) sum()
3 1 57 2 CO3
B) mean()
C) median()
D) append()
Which of the following is a NumPy feature?

A) Weak typing
B) High memory usage
C) Fast vectorized computation
3 1 58 D) No indexing support 1 CO3

Page 7 of 15
QB
What does masking in NumPy do?

A) Encrypts data
3 1 59 1 CO3
B) Filters elements using conditions
C) Deletes arrays
D) Copies arrays
Which is used to access elements in structured arrays?

A) Index only
3 1 60 2 CO3
B) Field names
C) Loops only
D) Random access
Pandas is mainly used for:

A) Web development
B) Data analysis
4 1 61 C) Game design 1 CO4
D) Networking

Which Pandas object is 1-dimensional?

A) DataFrame
4 1 62 B) Panel 1 CO4
C) Series
D) Array
Which Pandas object is 2-dimensional?

A) Series
4 1 63 2 CO4
B) DataFrame
C) Index
D) List
Which function is used to read a CSV file?

A) load_csv()
B) read_csv()
4 1 64 1 CO4
C) import_csv()
D) open_csv()

Which method is used for label-based indexing?

A) iloc[]
4 1 65 1 CO4
B) loc[]
C) index[]
D) get[]
Which method is used for integer-based indexing?

A) loc[]
4 1 66 2 CO4
B) iloc[]
C) ix[]
D) intloc[]
Which function is used to check missing values?

A) isna()
4 1 67 1 CO4
B) missing()
C) null()
D) checkna()

Page 8 of 15
QB
Which function removes missing data?

A) dropna()
4 1 68 2 CO4
B) remove()
C) delete()
D) clean()
Which function fills missing values?

A) fillna()
4 1 69 2 CO4
B) replace()
C) update()
D) fixna()
Which method combines DataFrames vertically?

A) merge()
4 1 70 2 CO4
B) join()
C) concat()
D) append_only()
Which method is used for SQL-like joining?

A) concat()
4 1 71 1 CO4
B) merge()
C) stack()
D) combine()
Grouping data in Pandas is done using:

A) groupby()
4 1 72 1 CO4
B) split()
C) group()
D) divide()
Pivot tables are used for:

A) Data encryption
4 1 73 1 CO4
B) Data summarization
C) Sorting files
D) Image processing
Which method is used for string operations in Pandas?

A) .str
4 1 74 1 CO4
B) .string()
C) .text()
D) .char()
Time series data in Pandas is based on:

A) Integers
4 1 75 2 CO4
B) Dates and times
C) Strings
D) Lists
Which function filters data using SQL-like syntax?

A) filter()
4 1 76 2 CO4
B) query()
C) select()
D) where()

Page 9 of 15
QB
MultiIndex is used for:

A) Single-level indexing
4 1 77 1 CO4
B) Hierarchical indexing
C) Sorting data
D) Removing duplicates
Which method gives summary statistics in Pandas?

A) describe()
4 1 78 1 CO4
B) summary()
C) stats()
D) info()
Which method returns column names of a DataFrame?

A) rows
4 1 79 1 CO4
B) index
C) columns
D) labels
Which of the following is used for fast vectorized string operations?

A) [Link]
4 1 80 1 CO4
B) [Link]
C) [Link]
D) [Link]
Matplotlib is mainly used for:

A) Data storage
5 1 81 2 CO5
B) Data visualization
C) Machine learning
D) Networking
Which module is commonly used in Matplotlib?

A) plt
5 1 82 B) pyplot 1 CO5
C) numpy
D) pandas

Which function is used to create a line plot?

A) plot()
5 1 83 2 CO5
B) line()
C) draw()
D) graph()
Which function is used for scatter plots?

A) scatter()
5 1 84 2 CO5
B) plot()
C) lineplot()
D) draw()
A histogram is used to represent:

A) Relationships between variables


5 1 85 2 CO5
B) Frequency distribution
C) Images
D) Text data

Page 10 of 15
QB
Which parameter controls bin size in histogram?

A) size
5 1 86 2 CO5
B) bins
C) range
D) width
Which plot shows 2D density using contour lines?

A) Bar plot
5 1 87 1 CO5
B) Pie chart
C) Contour plot
D) Line plot
Density plots are used to show:

A) Categorical data
5 1 88 2 CO5
B) Probability distribution
C) File size
D) Sorting
Which function adds a legend in Matplotlib?

A) legend()
5 1 89 2 CO5
B) label()
C) showlegend()
D) plotlegend()
Color bar is used to represent:

A) Time
5 1 90 2 CO5
B) Frequency
C) Value scale of colors
D) Labels
Which function adds a color bar?

A) colorbar()
5 1 91 2 CO5
B) barcolor()
C) cb()
D) colorshow()
Which library is required for 3D plotting?

A) [Link]
5 1 92 2 CO5
B) mpl_toolkits.mplot3d
C) numpy
D) pandas
Which function is used for 3D scatter plot?

A) scatter3d()
5 1 93 1 CO5
B) plot3d()
C) [Link]()
D) scatter()
Which function is used to display plot?

A) show()
5 1 94 2 CO5
B) display()
C) print()
D) draw()

Page 11 of 15
QB
Which function sets plot title?

A) title()
5 1 95 1 CO5
B) set_title()
C) plot_title()
D) name()
Which function sets x-axis label?

A) xlabel()
5 1 96 2 CO5
B) xaxis()
C) set_x()
D) labelx()
Which function sets y-axis label?

A) ylabel()
5 1 97 2 CO5
B) yaxis()
C) set_y()
D) labely()
Which plot type is best for comparing categories?

A) Line plot
5 1 98 2 CO5
B) Scatter plot
C) Bar plot
D) Density plot
Which function is used to create subplots?

A) subplot()
5 1 99 2 CO5
B) plots()
C) multi_plot()
D) grid()
Matplotlib is built on top of:

A) Java
5 1 100 2 CO5
B) C++
C) NumPy
D) SQL
1 2 1 Explain the structure of a Python program with an example. 2 CO1
Describe the underlying mechanism of module execution in Python. Explain
1 2 2 6 CO1
the role of __name__ == "__main__".
1 2 3 Explain branching statements in Python with suitable examples of if, if-else, 2 CO1
and [Link] for loop and while loop with examples.
Differentiate
1 2 4 4 CO1
Write a Python program to check whether a number is prime or not using
1 2 5 2 CO1
loops and branching.
Explain functions in Python. Discuss function definition, parameters, return
1 2 6 2 CO1
statement, and advantages of functions.
1 2 7 Write a Python program using functions to find the largest element in a list. 2 CO1
1 2 8 Explain lists and mutability in Python with suitable examples. 3 CO1
Write a Python program to count even and odd numbers in a list using
1 2 9 3 CO1
functions.
Develop a Python program to print the multiplication table of a given number
1 2 10 3 CO1
using loops.
Explain sequences in Python. Discuss lists, tuples, and strings with suitable
2 2 11 2 CO2
examples.
2 2 12 2 CO2
Differentiate between sequences, mapping, and sets in Python with examples.
2 2 13 Explain sets in Python and discuss various set operations with examples. 4 CO2

Page 12 of 15
QB
Explain dictionaries in Python. Describe dictionary creation, accessing
2 2 14 3 CO2
elements, updating values, and dictionary methods.
What are classes and objects in Python? Explain with a suitable example
2 2 15 3 CO2
program.
2 2 16 Explain the role of constructor __init__() in Python classes with an example. 2 CO2
Describe inheritance in Python and explain its advantages with a suitable
2 2 17 4 CO2
example.
Explain exception handling in Python using try, except, and finally blocks with
2 2 18 2 CO2
examples.
2 2 19 What are regular expressions? Explain the use of the re module in Python. 2 CO2
Explain the functions search(), findall(), split(), and sub() in the re module with
2 2 20 3 CO2
examples.
Explain the basics of NumPy. Discuss its features and advantages over Python
3 2 21 2 CO3
lists.
Explain how NumPy arrays are created. Describe 1D, 2D, and 3D arrays with
3 2 22 2 CO3
examples.
Explain important attributes of NumPy arrays such as ndim, shape, size, and
3 2 23 3 CO3
dtype with examples.
Explain element-wise operations in NumPy. Discuss vectorized computation
3 2 24 3 CO3
with suitable examples.
3 2 25 Explain broadcasting in NumPy with suitable examples. 4 CO3
Explain aggregation functions in NumPy such as sum(), mean(), min(), max(),
3 2 26 2 CO3
and std().
3 2 27 Explain comparisons, masks, and Boolean arrays in NumPy with examples. 3 CO3
3 2 28 Explain fancy indexing in NumPy with suitable examples. 4 CO3
Explain sorting of arrays in NumPy. Discuss sort() and argsort() with
3 2 29 3 CO3
examples.
Explain structured arrays in NumPy. Discuss how they are used to store
3 2 30 3 CO3
heterogeneous data with examples.
Explain the different Pandas objects (Series, DataFrame, and Index) with
4 2 31 2 CO4
suitable examples.
Explain data indexing and selection in Pandas. Discuss .loc[], .iloc[], and
4 2 32 2 CO4
conditional filtering with examples.
Explain handling missing data in Pandas. Discuss isnull(), dropna(), and
4 2 33 2 CO4
fillna() with examples.
Explain combining datasets in Pandas. Discuss concat(), merge(), and join()
4 2 34 2 CO4
with examples.
4 2 35 Explain hierarchical indexing (MultiIndex) in Pandas with a suitable example. 2 CO4
4 2 36 Explain aggregation and grouping in Pandas using groupby() with examples. 4 CO4
Explain pivot tables in Pandas. Discuss their structure and applications with
4 2 37 6 CO4
examples.
Explain vectorized string operations in Pandas using the .str accessor with
4 2 38 3 CO4
examples.
Explain working with time series data in Pandas. Discuss date-time indexing
4 2 39 3 CO4
and resampling.
Explain the query() method in Pandas. How does it improve performance in
4 2 40 3 CO4
filtering data?
5 2 41 Explain the basic functions of Matplotlib. Why is it used in data visualization? 2 CO5
Write a Python program to create a simple line plot using Matplotlib. Explain
5 2 42 2 CO5
its components.
5 2 43 Explain how scatter plots are created in Matplotlib. Give a suitable example. 2 CO5
What is a histogram? Explain how histograms are created in Matplotlib with
5 2 44 2 CO5
the concept of binning.
Explain density plots in Matplotlib and discuss their importance in data
5 2 45 2 CO5
visualization.
5 2 46 What are contour plots? Explain how they are used to represent 2D data. 2 CO5
5 2 47 Explain how legends are added and customized in Matplotlib plots. 3 CO5
5 2 48 Explain different
Explain how colorways
barsof
arecustomizing
used in Matplotlib. Give an example.
plots in Matplotlib (labels, titles, 3 CO5
5 2 49 colors, styles). 2 CO5

Page 13 of 15
QB
Explain the basics of 3D plotting in Matplotlib. Give an example of a simple
5 2 50 3 CO5
3D plot.
Explain the structure of a Python program in detail. Discuss variables,
1 3 1 comments, indentation, functions, modules, and program execution with a 2 CO1
suitable example.
Describe branching and looping statements in Python. Explain if, if-else, if-elif-
1 3 2 2 CO1
else, for loop, while loop, break, and continue with examples.
Write a Python program to perform the following operations using loops and
branching:
1 3 3 4 CO1
Check whether a number is prime
Find the sum of digits of a number
Print multiplication tables

1 3 4 Explain functions in Python in detail. Discuss types of functions, arguments, 2 CO1


return values, scope of variables, and advantages of functions with examples.
1 3 5 list methods, nested lists, and mutability with suitable examples. 3 CO1
Write Python programs using lists and functions for the following:

Find the largest and smallest elements in a list


1 3 6 4 CO1
Count even and odd numbers
Reverse a list
Search for an element in a list
Explain sequences, mapping, and sets in Python in detail. Discuss their
3 7
2 characteristics, differences, and provide suitable examples for each. 2 CO2
Explain dictionaries in Python in detail. Discuss creation, accessing elements,
3 8 updating values, deleting elements, and important dictionary methods with
2 examples. 2 CO2
Define classes and objects in Python. Explain object-oriented programming
3 9 concepts with a program example including class definition, object creation,
2 and methods. 2 CO2
Explain inheritance in Python in detail. Discuss different types of inheritance
3 10
2 (single, multiple, multilevel) with suitable examples and advantages. 4 CO2
Explain exception handling in Python. Discuss try, except, else, and finally blocks
3 11
2 with examples and explain different types of exceptions. 2 CO2

3 12 Explain regular expressions in Python. Discuss the re module and functions like
2 search(), findall(), split(), and sub() with suitable examples and applications. 3 CO2
Explain NumPy in detail. Discuss its features, advantages over Python lists,
3 3 13 3 CO3
and its role in scientific computing.
Explain NumPy arrays in detail. Describe how arrays are created and discuss
3 3 14 3 CO3
1D, 2D, and 3D arrays with suitable examples.
Explain computation on NumPy arrays. Discuss element-wise operations,
3 3 15 3 CO3
vectorized operations, and broadcasting with examples.
Explain aggregation functions in NumPy. Discuss sum(), mean(), min(),
3 3 16 3 CO3
max(), and std() along with axis-wise operations.
Explain comparisons, masks, and Boolean arrays in NumPy. Provide
3 3 17 2 CO3
examples of filtering data using conditions.
Explain fancy indexing, sorting of arrays, and structured arrays in NumPy
3 3 18 3 CO3
with suitable examples and applications.
Explain Pandas in detail. Discuss its objects (Series, DataFrame, Index), their
4 3 19 1 CO4
structure, and importance in data analysis with examples.
Explain data indexing and selection in Pandas. Discuss .loc[], .iloc[], slicing,
4 3 20 3 CO4
and conditional filtering with suitable examples.
Explain handling missing data in Pandas in detail. Discuss isnull(), notnull(),
4 3 21 4 CO4
dropna(), and fillna() with examples and use cases.
Explain combining datasets in Pandas. Discuss concat(), merge(), and join() in
4 3 22 2 CO4
detail with examples and differences.

Page 14 of 15
QB
Explain aggregation and grouping in Pandas. Discuss groupby() operations
4 3 23 4 CO4
and pivot tables with suitable examples and applications.
Explain advanced Pandas operations in detail:

Vectorized string operations (.str)


4 3 24 2 CO4
Working with time series data
High-performance Pandas techniques
query() method for efficient filtering
Explain Matplotlib in detail. Discuss its basic functions, structure, and
5 3 25 2 CO5
importance in data visualization. Include an example using pyplot.
Explain how to create line plots and scatter plots in Matplotlib. Discuss their
5 3 26 2 CO5
syntax, use cases, and differences with suitable examples.
Explain histograms in Matplotlib. Discuss binning and density plots with
5 3 27 2 CO5
examples. How are they useful in data distribution analysis?
Explain density plots and contour plots in Matplotlib. Discuss how they
5 3 28 2 CO5
represent 2D data and their applications with examples.
Explain how to customize plots in Matplotlib. Discuss legends, colors, labels,
5 3 29 2 CO5
titles, and
Explain 3Dcolor bars in
plotting with suitable examples.
Matplotlib. Discuss how to create 3D line plots, scatter
5 3 30 plots, and surface plots with examples. Mention the importance of 3D 2 CO5

Page 15 of 15
Course
Qn. Blooms
Unit Part 35921C03-DATA ANALYTICS USING PYTHON Outcom
No Level
e
MCQ ANSWERS
What is the correct extension for a Python file?

A) .java
1 1 1 2 CO1 b
B) .py
C) .pt
D) .python
Which function is used to display output in Python?

A) input()
1 1 2 1 CO1 c
B) display()
C) print()
D) show()
What does the if statement do in Python?

A) Repeats code
1 1 3 1 CO1 c
B) Stores data
C) Makes decisions
D) Imports modules
Which loop is best when the number of iterations is known?

A) while loop
1 1 4 1 CO1 b
B) for loop
C) do-while loop
D) Infinite loop
What is the output of the following code?

for i in range(3):
print(i)
1 1 5 1 CO1 b
A) 1 2 3
B) 0 1 2
C) 0 1 2 3
D) Error
Which keyword stops a loop completely?

A) skip
1 1 6 1 CO1 d
B) stop
C) continue
D) break
Which keyword skips the current iteration in a loop?

A) pass
1 1 7 B) continue 1 CO1 b
C) break
D) return

What is a function in Python?

A) A loop
1 1 8 1 CO1 c
B) A variable
C) A reusable block of code
D) A list
Which keyword is used to define a function?

A) func
1 1 9 2 CO1 c
B) define
C) def
D) function
What is the output of this code?

def add(a, b):


return a + b

1 1 10 print(add(2, 3)) 1 CO1 b

A) 23
B) 5
C) Error
D) None
Which data type stores multiple items in Python?

A) Integer
1 1 11 1 CO1 c
B) Float
C) List
D) Boolean
Which symbol is used for list indexing?

A) { }
1 1 12 2 CO1 d
B) ( )
C) < >
D) [ ]
What is the index of the first element in a list?

A) 1
1 1 13 2 CO1 c
B) -1
C) 0
D) 2
Which method adds an element to a list?

A) insert()
1 1 14 2 CO1 b
B) append()
C) add()
D) push()
Lists in Python are:

A) Immutable
1 1 15 2 CO1 b
B) Mutable
C) Fixed-size
D) Read-only
What is the output of this code?

x = [1, 2, 3]
x[1] = 5
print(x)
1 1 16 1 CO1 b
A) [1, 2, 3]
B) [1, 5, 3]
C) [5, 2, 3]
D) Error
Which function returns the length of a list?

A) size()
1 1 17 1 CO1 c
B) count()
C) len()
D) length()
What does range(5) generate?

A) 1 to 5
1 1 18 B) 0 to 4 1 CO1 b
C) 0 to 5
D) 1 to 4

Which special variable indicates that a Python file is executed


directly?

1 1 19 A) __python__ 1 CO1 d
B) __file__
C) __main__
D) __name__
What is the output of this code?

numbers = [1, 2, 3]
print(numbers[-1])
1 1 20 1 CO1 c
A) 1
B) 2
C) 3
D) Error
Which of the following is a sequence data type in Python?

A) Set
2 1 21 1 CO2 c
B) Dictionary
C) List
D) Boolean
Which sequence type is immutable?

A) List
2 1 22 1 CO2 d
B) Set
C) Dictionary
D) Tuple
Which collection stores unique elements only?

A) List
2 1 23 1 CO2 c
B) Tuple
C) Set
D) String
Which data type stores values in key-value pairs?

A) List
2 1 24 2 CO2 c
B) Set
C) Dictionary
D) Tuple
What is the output of this code?

x = {1, 2, 2, 3}
print(x)
2 1 25 1 CO2 b
A) {1, 2, 2, 3}
B) {1, 2, 3}
C) [1, 2, 3]
D) Error
Which method returns all keys in a dictionary?

A) values()
2 1 26 1 CO2 c
B) items()
C) keys()
D) get()
Which method removes an item from a dictionary?

A) append()
2 1 27 1 CO2 d
B) remove()
C) delete()
D) pop()
What is a class in Python?

A) A loop
2 1 28 1 CO2 b
B) A blueprint for objects
C) A module
D) A variable
An object is also called:

A) Function
2 1 29 1 CO2 c
B) Operator
C) Instance
D) Constructor
Which special method is automatically called when an object is
created?

2 1 30 A) __start__() 1 CO2 d
B) __main__()
C) __create__()
D) __init__()
Which keyword is used for inheritance?

A) extends
2 1 31 1 CO2 d
B) inherits
C) class
D) No special keyword needed
What is inheritance mainly used for?

A) Error handling
2 1 32 1 CO2 b
B) Code reusability
C) Loop execution
D) File handling
Which block is used to handle exceptions?

A) check-except
2 1 33 2 CO2 b
B) try-except
C) error-catch
D) final-except
Which exception occurs when dividing by zero?

A) ValueError
2 1 34 2 CO2 c
B) TypeError
C) ZeroDivisionError
D) NameError
Which block always executes whether an exception occurs or
not?

2 1 35 A) except 2 CO2 c
B) try
C) finally
D) raise
Which module is used for regular expressions in Python?

A) regex
2 1 36 2 CO2 c
B) pyregex
C) re
D) pattern
Which function finds all matches of a pattern?

A) search()
2 1 37 2 CO2 d
B) match()
C) split()
D) findall()
What does \d represent in regular expressions?

A) Alphabet
2 1 38 2 CO2 b
B) Digit
C) Space
D) Symbol
Which function replaces matched text in a string?

A) replace()
2 1 39 1 CO2 b
B) sub()
C) findall()
D) search()
What is the output of this code?

import re

text = "apple banana"


x = [Link]("banana", text)
2 1 40 1 CO2 c
print(x is not None)

A) False
B) None
C) True
D) Error
NumPy is mainly used for:

A) Web development
3 1 41 1 CO3 b
B) Numerical computing
C) Game development
D) Networking
Which function is used to import NumPy?

A) import numpy as np
3 1 42 1 CO3 a
B) import np
C) import num
D) load numpy
NumPy arrays are:

A) Slow
3 1 43 2 CO3 b
B) Fixed-size and homogeneous
C) Heterogeneous only
D) Unstructured only
Which attribute gives the shape of an array?

A) size
3 1 44 1 CO3 b
B) shape
C) dim
D) type
What does ndim represent?

A) Number of elements
3 1 45 1 CO3 b
B) Number of dimensions
C) Data type
D) Index position
Which operation is faster in NumPy?

3 1 46 A) Loop-based operations 2 CO3 b


B) Vectorized operations
C) Recursive operations
Broadcasting in NumPy means:

A) Sending data over network


3 1 47 1 CO3 c
B) Copying arrays
C) Performing operations on different shaped arrays
D) Sorting arrays
Which function returns the sum of array elements?

A) add()
B) sum()
3 1 48 C) total() 1 CO3 b
D) aggregate()

What does axis=0 represent?

A) Row-wise operation
3 1 49 2 CO3 b
B) Column-wise operation
C) Diagonal operation
D) Random operation
Which function returns maximum value in an array?

A) max()
3 1 50 1 CO3 a
B) maximum()
C) highest()
D) top()
Boolean indexing is used for:

A) Sorting arrays
3 1 51 1 CO3 b
B) Filtering data
C) Creating loops
D) Merging arrays
What is the output type of a comparison operation on NumPy
arrays?

3 1 52 A) Integer array 1 CO3 b


B) Boolean array
C) String array
D) Float array
Fancy indexing uses:

A) Strings
3 1 53 2 CO3 b
B) Lists of indices
C) Loops
D) Dictionaries
Which function sorts a NumPy array?

A) order()
3 1 54 2 CO3 b
B) sort()
C) arrange()
D) rank()
argsort() returns:

A) Sorted values
3 1 55 1 CO3 b
B) Index positions of sorted elements
C) Maximum value
D) Boolean mask
Structured arrays in NumPy are used for:

A) Image processing
3 1 56 1 CO3 b
B) Storing different data types like records
C) Sorting only
D) Random numbers
Which of the following is NOT a NumPy aggregation function?

A) sum()
3 1 57 B) mean() 2 CO3 d
C) median()
D) append()
Which of the following is a NumPy feature?

A) Weak typing
B) High memory usage
C) Fast vectorized computation
D) No indexing support
3 1 58 1 CO3 c

What does masking in NumPy do?

A) Encrypts data
3 1 59 1 CO3 b
B) Filters elements using conditions
C) Deletes arrays
D) Copies arrays
Which is used to access elements in structured arrays?

A) Index only
3 1 60 2 CO3 b
B) Field names
C) Loops only
D) Random access
Pandas is mainly used for:

A) Web development
4 1 61 B) Data analysis 1 CO4 b
C) Game design
D) Networking

Which Pandas object is 1-dimensional?

A) DataFrame
4 1 62 1 CO4 c
B) Panel
C) Series
D) Array
Which Pandas object is 2-dimensional?

A) Series
4 1 63 2 CO4 b
B) DataFrame
C) Index
D) List
Which function is used to read a CSV file?

A) load_csv()
4 1 64 1 CO4 b
B) read_csv()
C) import_csv()
D) open_csv()
Which method is used for label-based indexing?

A) iloc[]
4 1 65 B) loc[] 1 CO4 b
C) index[]
D) get[]
Which method is used for integer-based indexing?

A) loc[]
4 1 66 2 CO4 b
B) iloc[]
C) ix[]
D) intloc[]
Which function is used to check missing values?

A) isna()
4 1 67 1 CO4 a
B) missing()
C) null()
D) checkna()
Which function removes missing data?

A) dropna()
4 1 68 2 CO4 a
B) remove()
C) delete()
D) clean()
Which function fills missing values?

A) fillna()
4 1 69 2 CO4 a
B) replace()
C) update()
D) fixna()
Which method combines DataFrames vertically?

A) merge()
4 1 70 2 CO4 c
B) join()
C) concat()
D) append_only()
Which method is used for SQL-like joining?

A) concat()
4 1 71 1 CO4 b
B) merge()
C) stack()
D) combine()
Grouping data in Pandas is done using:

A) groupby()
4 1 72 1 CO4 a
B) split()
C) group()
D) divide()
Pivot tables are used for:

A) Data encryption
4 1 73 1 CO4 b
B) Data summarization
C) Sorting files
D) Image processing
Which method is used for string operations in Pandas?

A) .str
4 1 74 1 CO4 a
B) .string()
C) .text()
D) .char()
Time series data in Pandas is based on:

A) Integers
4 1 75 2 CO4 b
B) Dates and times
C) Strings
D) Lists
Which function filters data using SQL-like syntax?

A) filter()
4 1 76 2 CO4 b
B) query()
C) select()
D) where()
MultiIndex is used for:

A) Single-level indexing
4 1 77 1 CO4 b
B) Hierarchical indexing
C) Sorting data
D) Removing duplicates
Which method gives summary statistics in Pandas?

A) describe()
4 1 78 1 CO4 a
B) summary()
C) stats()
D) info()
Which method returns column names of a DataFrame?

A) rows
4 1 79 1 CO4 c
B) index
C) columns
D) labels
Which of the following is used for fast vectorized string
operations?

4 1 80 A) [Link] 1 CO4 d
B) [Link]
C) [Link]
D) [Link]
Matplotlib is mainly used for:

A) Data storage
5 1 81 2 CO5 b
B) Data visualization
C) Machine learning
D) Networking
Which module is commonly used in Matplotlib?

A) plt
5 1 82 B) pyplot 1 CO5 b
C) numpy
D) pandas

Which function is used to create a line plot?

A) plot()
5 1 83 2 CO5 a
B) line()
C) draw()
D) graph()
Which function is used for scatter plots?

A) scatter()
5 1 84 2 CO5 a
B) plot()
C) lineplot()
D) draw()
A histogram is used to represent:

A) Relationships between variables


5 1 85 2 CO5 b
B) Frequency distribution
C) Images
D) Text data
Which parameter controls bin size in histogram?

A) size
5 1 86 2 CO5 b
B) bins
C) range
D) width
Which plot shows 2D density using contour lines?

A) Bar plot
5 1 87 1 CO5 c
B) Pie chart
C) Contour plot
D) Line plot
Density plots are used to show:

A) Categorical data
5 1 88 2 CO5 b
B) Probability distribution
C) File size
D) Sorting
Which function adds a legend in Matplotlib?

A) legend()
5 1 89 2 CO5 a
B) label()
C) showlegend()
D) plotlegend()
Color bar is used to represent:

A) Time
5 1 90 2 CO5 c
B) Frequency
C) Value scale of colors
D) Labels
Which function adds a color bar?

A) colorbar()
5 1 91 2 CO5 a
B) barcolor()
C) cb()
D) colorshow()
Which library is required for 3D plotting?

A) [Link]
5 1 92 2 CO5 b
B) mpl_toolkits.mplot3d
C) numpy
D) pandas
Which function is used for 3D scatter plot?

A) scatter3d()
5 1 93 1 CO5 c
B) plot3d()
C) [Link]()
D) scatter()
Which function is used to display plot?

A) show()
5 1 94 2 CO5 a
B) display()
C) print()
D) draw()
Which function sets plot title?

A) title()
5 1 95 1 CO5 a
B) set_title()
C) plot_title()
D) name()
Which function sets x-axis label?

A) xlabel()
5 1 96 2 CO5 a
B) xaxis()
C) set_x()
D) labelx()
Which function sets y-axis label?

A) ylabel()
5 1 97 2 CO5 a
B) yaxis()
C) set_y()
D) labely()
Which plot type is best for comparing categories?

A) Line plot
5 1 98 2 CO5 c
B) Scatter plot
C) Bar plot
D) Density plot
Which function is used to create subplots?

A) subplot()
5 1 99 2 CO5 a
B) plots()
C) multi_plot()
D) grid()
Matplotlib is built on top of:

A) Java
5 1 100 2 CO5 c
B) C++
C) NumPy
D) SQL

You might also like