0% found this document useful (0 votes)
23 views5 pages

Viva Voce

Python is an interpreted programming language with benefits like simplicity, portability, extensibility, and being open source. NumPy arrays are faster and more memory efficient than lists for numerical computing due to contiguous memory allocation. Pandas is a Python library used for data manipulation and analysis. It provides data structures like Series for 1D data and DataFrame for 2D data that make data cleaning and transformation easy. Data visualization is important for understanding relationships in data, and Pandas supports visualizing data using various chart types via the Matplotlib library.

Uploaded by

gangwar098preeti
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)
23 views5 pages

Viva Voce

Python is an interpreted programming language with benefits like simplicity, portability, extensibility, and being open source. NumPy arrays are faster and more memory efficient than lists for numerical computing due to contiguous memory allocation. Pandas is a Python library used for data manipulation and analysis. It provides data structures like Series for 1D data and DataFrame for 2D data that make data cleaning and transformation easy. Data visualization is important for understanding relationships in data, and Pandas supports visualizing data using various chart types via the Matplotlib library.

Uploaded by

gangwar098preeti
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
You are on page 1/ 5

VIVA VOCE

1. What is Python? What are the benefits of using Python?


Ans. Python is a programming language with objects, modules, threads, exceptions and automatic memory
management. The benefits of using Python are that it is simple and easy, portable, extensible, has built-in
data structure and is open source.
2. How is Python interpreted?
Ans. Python is an interpreted language. Python program runs directly from the source code. It converts the
source code that is written by the programmer into an intermediate language, which is again translated
into machine language that has to be executed.
3. What are NumPy arrays?
Ans. A NumPy array is a table of elements, all of the same type, indexed by a list/tuple of integers. NumPy arrays
are also called ndarrays.
4. Why are NumPy arrays used over lists?
Ans. NumPy arrays have contiguous memory allocation. Thus, same data elements in array stored as lists
require more space as compared to arrays.
• They are speedier to work with and, hence, more efficient than lists.
• They are more convenient to deal with.
5. What do you understand by Array slicing?
Ans. Array slicing refers to the process of extracting a subset of elements from an existing array and returning
the result as another array, possibly in a different dimension from the original.
6. Is Python NumPy better than lists?
Ans. Yes, NumPy arrays are better than lists. We use Python NumPy array instead of a list because of the
following three reasons:
(a) Less memory
(b) Fast
(c) Convenient
7. What is Pandas Series?
Ans. Series is a one-dimensional labelled data structure capable of holding data of any type (integer, string, float,
Python objects, etc.) accessed using respective data labels, called its index.
8. Who is the main author of Pandas?
Ans. Wes McKinney.
9. What is a dataframe?
Ans. Dataframe is a two-dimensional data structure with heterogeneous data, usually represented in tabular
format. The data is represented in rows and columns. Each column represents an attribute and each row
represents a record. Features of dataframe are:
• Potentially, columns are of different types.
• Size is mutable.
• Labelled axes (rows and columns).
10. How is dataframe different from a 2D array?
Ans. Dataframe can store data of any type whereas a NumPy 2D array can contain data of similar type.
Moreover, dataframe elements can be accessed by their default indexes for rows and columns along
with the defined labels whereas NumPy 2D array can be accessed using default index specifications only.
Dataframe is a data structure in the Pandas library having a simpler interface for operations like file loading,
plotting, selection, joining, group by, which come in handy in data processing applications.
11. How are Dataframes related to Series?
Ans. Dataframe and Series both are data structures in Pandas library. The individual columns of a dataframe can
be considered as a Series object.

Appendices A.17
12. What do you understand by the size of (i) a Series, (ii) a Dataframe?
Ans. Size attribute gives the number of elements present in Series or Dataframes.
13. What type of error is returned when the length of index and the length of data in Series() function is not
same?
Ans. ValueError
14. How can we fill missing values in dataframe?
Ans. For filling missing values, we can use fillna() method. For example,
df = df1.fillna(0)
15. Which is the standard data missing marker used in Pandas?
Ans. NaN
16. Which method is used to add a new row and change the data values of a row in a DataFrame ‘df1’?
Ans. df1.loc[ ] method
17. What will the following statement do?
Df1 = df.drop(['Name','Class','Rollno'],axis = 1)#Df1 is a dataframe object
Ans. It will delete three columns having labels ‘Name’, ‘Class’ and ‘Rollno’ from the dataframe df.
18. Which parameter is used to specify row or column in rename() function of dataframe?
Ans. index
19. Define the following terms:
(i) Median
(ii) Standard deviation
(iii) Variance
Ans. (i) Median: Median refers to the middle value of a given data set.
(ii) Standard deviation: It is measured as the spread of data distribution in the given data set. The built-in
function std() is used for calculating the standard deviation for a given data set.
(iii) Variance: It is the average of squared deviations from the mean.
20. What difference do we see in deleting with del and pop methods?
Ans. del method does not display the contents of the column deleted whereas pop() method deletes an existing
column as well as displays the contents of the deleted column.
21. Does drop() function delete the column permanently from a dataframe? If not, how can we do that?
Ans. No, drop() function does not delete the content until and unless we use inplace=True argument as it makes
permanent changes.
22. Which library is used for plotting in Python language?
Ans. Matplotlib is the library used for plotting in Python language.
23. Explain reindexing in Pandas.
Ans. Reindexing means to conform dataframe to a new index placing NA/NaN in locations having no value in
the previous index. It changes the row labels and column labels of a dataframe.
24. What is Pandas used for?
Ans. Pandas library is written for Python programming language for performing operations like data
manipulation, data analysis, etc. The library provides various operations as well as data structures to
manipulate time series and numerical tables.
25. How can we create an empty dataframe?
Ans. By using the function DataFrame().
26. Which attribute is used to check if the Series object contains NaN values?
Ans. hasnans
27. Which object in Pandas cannot grow in size?
Ans. Series

A.18 Informatics Practices with Python–XII


28. Given the following dictionaries:
dict_exam={"Exam":"AISSCE", "Year":2023}
dict_result={"Total":500, "Pass_Marks":165}
Give the statement to merge the contents of both dictionaries?
Ans. dict_exam.update(dict_result)
29. Name the functions you can use to iterate over dataframes.
Ans. iterrows() and iteritems().
30. What is the basic difference between iterrows() and iteritems()?
Ans. <DF>.iteritems() iterates over vertical subsets in the form of (col-index, series) pairs while <DF>.iterrows()
iterates over horizontal subsets in the form of (row-index, series) pairs.
31. Name the function used to display first 5 and last 5 rows from a Series or Dataframe.
Ans. head() and tail() functions.
32. Write a command to store data of dataframe mdf into a CSV file Mydata.csv, with separate character as
"@".
Ans. mdf.to_csv("Mydata.csv", sep="@")
33. What is the importance of data visualization? Name the various types of charts supported by Pandas.
Ans. Data visualization is the graphical or visual representation of information and data using visual
elements like charts, graphs, maps, etc. They are often used to ease understanding of large quantities of
data and the relationships between parts of the data. Charts can usually be read more quickly than raw
data. The various types of charts supported by Pandas are line, bar, histograms, pie, box, etc.
34. What are subplots in Matplotlib library?
Ans. Subplots are grids of plots within a single figure. Subplots can be plotted using subplots() function from
matplotlib.pyplot module.
35. Name the pyplot functions for the following work (Assume plt as the alias name for pyplot).
(a) To display gridlines in the graph ________________ .
(b) To display the legend for the chart ________________ .
(c) To display the chart ________________ .
(d) To display the heading for the graph ________________ .
(e) To display the heading for the x-axis ________________ .
(f) To remove the gridlines from the chart ________________ .
Ans. (a) plt.grid(True) (b) plt.legend()
(c) plt.show() (d) plt.title()
(e) plt.xlabel() (f) plt.grid(False)
36. What is the purpose of plot() function?
Ans. plot() is a versatile command and takes an arbitrary number of arguments to plot a chart in Matplotlib
library. For example, plot (x, y) to plot x versus y.
37. List the methods used with pyplot.
Ans. Various methods used with pyplot object are:
• plot()
• show()
• title()
• xlabel()
• ylabel()
• explode()
• bar()
• hist()
• scatter()
• box plot()

Appendices A.19
38. Which function is used to draw a histogram?
Ans. hist()
39. What is a CSV file?
Ans. Comma Separated Values (CSV) file is a type of plain text file that is the simplest way to store/arrange
tabular data. It must be saved with the .csv file extension. It can store numbers as well as text. Each line
represents a record wherein the data corresponding to every field is separated or delimited by comma.
40. Which Pandas method is used to send content of a dataframe to CSV file?
Ans. to_csv() method
41. Which Pandas method is used to read CSV file?
Ans. read_csv()
42. Which argument is to be given in read_csv() method to suppress first row as header?
Ans. header = None
43. Define a network. Why is it needed?
Ans. A network is an interconnected collection of autonomous computers that can share and exchange
information.
Need for networking:
(i) Resource sharing: Resources are shared by all computers over the network for effective utilization.
(ii) File sharing: A file in a network can be accessed from anywhere.
44. What are the various types of networks?
Ans. A network is an interconnection of several nodes through some communication media with the goal of
sharing data, files and resources. There are three types of networks:
(i) Local Area Network (LAN) (ii) Metropolitan Area Network (MAN)
(iii) Wide Area Network (WAN)
45. Which of the network topologies should be preferred for a company that would like to keep adding more
and more computers to the topology economically as it grows?
Ans. Tree/Star
46. What is meant by topology? Name some popular topologies.
Ans. Topology is the arrangement by which computers are connected to each other, either physically or
logically. The popular topologies are:
(i) Bus or Linear Topology (ii) Ring Topology
(iii) Star Topology (iv) Tree Topology
47. What is TCP/IP?
Ans. TCP/IP (Transmission Control Protocol/Internet Protocol) is a protocol for communication between
computers used as a standard for transmitting data over networks and is the basis for standard internet
protocols. It is also responsible for assembling packets at the receiver’s side.
48. Define the following data communicating devices:
(i) Repeater (ii) Bridge
(iii) Router (iv) Gateway
Ans. (i) Repeater: It is a device that amplifies and restores the signal before it gets degraded and transmits the
original signal back to the destination. A repeater is a regenerator and not an amplifier.
(ii) Bridge: A bridge is a device designed to connect two LAN segments. The purpose of a bridge is to filter
traffic on a LAN. Bridge relays frames between two originally separate segments. When a frame
enters a bridge, the bridge not only regenerates the signal but also checks the physical address of the
destination and forwards the new copy only to that port.
(iii) Router: Routers operate in the physical, data link and network layers of the OSI model. They decide the
path a packet should take. A router is a networking device whose software and hardware are usually
tailored to the tasks of routing and forwarding data packets across the network.
(iv) Gateway: A gateway operates on all the seven layers of OSI model. A network gateway is a computer
which has internet-working capability of joining together two networks that use different base
protocols. Gateway converts one protocol to another and can, therefore, connect two dissimilar
networks.
A.20 Informatics Practices with Python–XII
49. What is primary key?
Ans. Primary key is a combination of columns that uniquely identifies a row in a relational table.
50. What is candidate key?
Ans. All possible combinations of columns that can possibly serve as the primary key are called candidate keys.
51. What is foreign key?
Ans. A combination of columns where values are derived from primary key of some other table is called the
foreign key of the table in which it is contained.
52. What is alternate key?
Ans. A candidate key that is not serving as a primary key is called an alternate key.
53. What is MySQL?
Ans. MySQL is an open-source RDBMS that relies on SQL for processing the data in the database. The database
is available for free under the terms of General Public Licence (GPL).
54. What is RDBMS?
Ans. Relational Database Management System (RDBMS) facilitates access, security and integrity of data and
eliminates data redundancy. For example, MySQL, Oracle, Microsoft SQL Server, etc.
55. What is the use of DROP TABLE command?
Ans. DROP TABLE command is used to delete tables. For example, DROP TABLE Orders; will delete the table
named ‘Orders’.
56. What do you understand by NOT NULL constraint?
Ans. This constraint ensures that the null values are not permitted on a specified column. This constraint can be
defined at the column level and not at the table level.
57. What is the significance of COUNT?
Ans. It is used to count the number of values in a given column or number of rows in a table, for example,
SELECT COUNT(RollNo) FROM Students;
58. What is the importance of cyber laws?
Ans. Communication technology uses several means of transferring textual messages, pictures, etc., via
internet. Each time there may be a number of threats on either the sender’s or the receiver’s side
which create a bridge between networking communication. To sort out these problems, cyber laws exist
that touch almost all aspects of transactions and activities on the internet. Cyber laws are used to protect
people from online frauds.
59. Explain phishing.
Ans. Phishing is the fraudulent attempt to obtain sensitive information such as usernames, passwords and
credit card details, often for malicious reasons, by disguising as a trustworthy entity in an electronic
communication. Phishing is typically carried out by email spoofing or instant messaging and it often
directs users to enter personal information at a fake website, the look and feel of which is identical to the
legitimate one, the only difference being the URL of the website in question.
60. What is cyber stalking?
Ans. Cyber stalking is defined as the unlawful act of harassing a person or collecting an individual’s private
information using electronic network.
61. What are digital footprints?
Ans. Digital footprints are the trail of data we leave behind when we visit any website or use any online
application or portal to fill in data or perform any transaction.
62. What is identity theft?
Ans. Identity theft involves obtaining personal or financial information of another person and using their identity
to commit fraud, such as making unauthorised transactions or purchases. Identity theft is committed in
many different ways and its victims suffer damage to their reputation as well as financial loss.

Appendices A.21

You might also like