Python Tutorial: IP Assertions-Reason Type Questions

Friday, 17 March 2023

IP Assertions-Reason Type Questions

Class XII - IP

Assertions-Reason Type Questions

DataFrame & Series

Direction: In the Question given below there are two statements not as assertion a and reason are read the statement and choose the correct option.

  1. Both (a) and (R) are true, and (R) a is the correct explanation of (a)
  2. Both (a) and (R) are true, but (R) is not the correct explanation of (a).
  3. (a) is true, but (R) is false.
  4. (a) is false, but (R) is true

Q1. Asserton (a): Pandas is a popular data-science library of Python.

Reason (R) : A series is a Pandas data structure that represents.

Ans. (b)

 

Q2.  Asserton (a): A data structure is a pandas data structure that represents a 2D array like object.

Reason (R) : you can use Numpy NaN for missing data.

Ans. (d)

 

Q3. Asserton (a): Two specify data type for a series object, dtype argument is used.

Reason (R) : The  len() function on series object returns total elements in it including NAns.

Ans. (b)

 

Q4. Assertion(a): The count() function on series object returns only the count of non-NaN values in it.

Reason(R): Series is values mutable.

Ans: (b)

 

Q5. Assertion(a): Series is not size mutable.

Reason(R): Dataframe is size mutable as well as value mutable.

Ans. (b)

 

Q6.Assertion (a): In a dataframe, Axis = 1 represents the column elements.

Reason (R): To access values using row labels you can use DF.open.

Ans. (c)

 

Q 7. Assertion (a): To access Individual value, you can use DF on using row/column index labels.

Reason (R): To access Individual value, you can use DF. iat using row/column integer position.

Ans. (d)

Q 8. Assertion (a): The rename() function reQuires inplace argument to make changes in the original dataframe.

Reason (R): To access values using row labels you can use DF.loc.

Ans. (b)

 

Q9. Assertion (a): A Pandas series object can be thought of as a column or a row,essentially.

Reason (R): Both series and dataframe are one-dimensional data structure objects.

Ans. (c)

 

Q 10. Assertion (a): While series is a one-dimensional data structure object, dataframe is a multi-dimensional data structure object.

Reason (R): A series object is value mutable.

Ans. (b)

 

Q11.Assertion (a): A series object is size mutable.

Reason (R): A dataframe value mutable.

Ans. (d)

 

Q12. Assertion (a): A dataframe object is size mutable.

Reason (R): There is no difference between NumPy array and a series object.

Ans. (c)

 

Q 13. Assertion (a): A dataframe can be thought of as a group of multiple series objects. Reason (R): A dataframe has similar properties as a series object.

Ans. (c)

 

Q 14. Assertion (a): In a dataframe, Axis = 1 represents the column elements.

Reason (R): To access values using row labels you can use DF.open.

Ans. (c)

 

Q 15. Assertion (a): A series object can store only homogeneous (same type of) elements. Reason (R): A dataframe object can store only homogeneous elements.

Ans. (c)

 

Q 16. Assertion (a): The del statement can remove the rows as well as columns in a dataframe.

Reason (R): A Pandas series object can be thought of as a column or a row, essentially.

Ans. (d)

 

Q 17. Assertion (a): The rename() always makes changes in the default dataframe.

Reason (R): While series is a one-dimensional data structure object, dataframe is a multi-dimensional data structure object.

Ans. (d)

 

Q18. Assertion (a): A series object is value mutable.

Reason (R): A series object can store only homogeneous (same type of) elements.

Ans. (b)

 

Q19. Assertion (a): To create an empty Series object, you can use pd.Series().

Reason (R): To specify datatype int16 for a Series object, you can write pd.Series(data = array, dtype = numpy.int16).

Ans. (b)

 

Q 20. Assertion (a): To get the number of dimensions of a series object, ndim attribute is displayed.

Reason (R): To get the size of the datatype of the items in series object, you can display index attribute.

Ans. (c)

 

Q 21 Assertion (a): To get the number of elements in a series object, size attribute may be used.

Reason (R): To get the number of bytes of the series data, dtype attribute is displayed.

Ans. (c)

 

Q 22. Assertion (a): To check if the series object contains NaN values, hasnAns attribute is displayed.

Reason (R): To display third element of a series object S, you will write S[2].

Ans. (b)

 

Q 23. Assertion (a): To display first three elements of a series object S, you may write S[:3].

Reason (R): To display last five rows of a series object S, you may write head().

Ans. (c)

 

Q 24. Assertion (a): Missing data in Pandas object is represented through NaN.

Reason (R): Given a Pandas series called SeQuences, the command which will display the first 4 rows is print(SeQuences.head(4)).

Ans. (b)

 

Q 25. Assertion (a): If a dataframe is created using a 2D dictionary, then the Indexes/row labels are formed from Inner dictionary's keys.

Reason (R): If a dataframe is created using a 2D dictionary, then the column labels are formed from outer dictionary's keys.

Ans. (b)

 

Q 26. Assertion (a): The axis 0 identifies a dataframe's rows.

Reason (R): The axis 1 identifies a dataframe's columns.

Ans. (b)

 

Q 27. Assertion (a): To get the number of elements in a dataframe, size attribute may be used.

Reason (R): To get NumPy representation of a dataframe, shape attribute may be used.

Ans. (c)

 

Q 28. Assertion (a): 18. To get NumPy representation of a dataframe, values attribute may be used.

Reason (R): To get a number representing the number of axes in a dataframe, values attribute may be used.

Ans. (c)

 

Q 29. Assertion (a): To get the trAnspose of a dataframe D1, you can write D1.T.

Reason (R): To extract row/column from a dataframe, loc() function may be used.

Ans. (b)

 

Q 30. Assertion (a): To display the 3rd, 4th and 5th columns from the 6th to 9th rows of a dataframe DF, you can write DF.iloc[6:10, 3:6].

Reason (R): To change the 5th column's value at 3rd row as 35 in dataframe DF, you can write DF.lat[3, 5]= 35.

Ans. (b)

Plotting Data using in Pandas

Direction: In the Question given below there are two statements not as assertion a and reason are read the statement and choose the correct option.

  1. Both (a) and (R) are true, and (R) a is the correct explanation of (a)
  2. Both (a) and (R) are true, but (R) is not the correct explanation of (a).
  3. (a) is true, but (R) is false.
  4. (a) is false, but (R) is true

 

Q1. Assertion (a): A histogram is a plot that shows the underlying freQuency distribution of a set of continuous data.

Reason (R): Pyplot Interface is a collection of methods within matplotlib library of Python.

Ans. (b)

 

Q2. Assertion (a): Pyplot's plot() function is used to create line charts.

Reason (R): Pyplot's barh() function is used to create horizontal bar charts.

Ans. (b)

 

Q 3.Assertion (a): Pyplot's scatter() function is used to create scatter charts. Reason (R): Pyplot's hist() function is used to create histogram.

Ans. (b)

 

Q4 Assertion (a): The datapoints plotted on a graph are called markers.

Reason (R): The width argument of plot() specifies the width for the line.

Ans. (c)

 

Q5. Assertion (a): The linestyle argument of plot() specifies the style of the line.

Reason (R): The line argument of bar() specifies the bar width.

Ans. (c)

 

Q6. Assertion (a): The xticks() function is used to specify ticks for x-axis.

Reason (R): To save a plot, savefig() function is used.

Ans. (b)

 

Q7. Assertion (a): The orientation argument of hist() is set to create a horizontal histogram.

Reason (R): The show meAns argument shows the arithmetic mean on a boxplot.

Ans. (b)

 

Q8. Assertion (a): The notch argument in a boxplot() creates a notched boxplot.

Reason (R): The loc argument of legend() provides the location of legend.

Ans. (b)

 

Q9. Assertion (a): Using Python Matplotlib, histogram can be used to count how many values fall into each interval.

Reason (R): Pyplot's barh() function is used to create line chart.

Ans. (c)

 

Q 10. Assertion (a): Statement Import pyplot.matplotlib is a valid statement for working on pyplot functions.

Reason (R): By default, pie chart is printed in elliptical or oval shape.

Ans. (c)

 

Q 11. Assertion (a): The axes define the area (mostly rectangular in shape for simple plots) on which actual plot (line or bar or graph etc.) will appear. Axis have properties like label, Umits and tick marks on them.

Reason (R): A Boxplot is the visual representation of a statistical 5 number summary of a given data set.

Ans. (b)

 

Q12. Assertion (a): A marker is any symbol that represents a data value in a line chart or a scatter plot. In other words, the data points being plotted on a graph/chart are called markers.

Reason (R): The linewidth and linestyle property can be used to change the width and the style of the bar chart.

Ans. (c)

 

Q20. Assertion (a): A pie chart (or a circle chart) is a circular statistical graphic, which is divided into slices to illustrate numerical proportion.

Reason (R): Histogram is a type of graph that provides a visual interpretation of numerical data by indicating the number of data points that lie within a range of value.

Ans. (b)

 

Q21. Assertion (a): Data visualisation demand much more from a graph/plot. The graph or plot should have a proper title, X & Y limits defined, labels, legends etc.

Reason (R): Any graph or chart that you create using matplotlib's PyPlot interface is created as per a specific structure of a plot or shall we say a specific anatomy.

Ans. (b)

 

Q22. Assertion (a): Patterns, trends and correlations that might go undetected in text-based data can be exposed and recognised easier with data visualisation techniQues or tools such as line chart, bar chart, pie chart, histogram, scatter chart, etc.

Reason (R): Thus, with data visualisation tools, information can be processed in an efficient manner and hence better decisions can be made.

Ans. (a)

 

Q23. Assertion (a): When we plot multiple ranges on a single plot, it becomes necessary that legends are specified. Recall that a legend is a colour or mark linked to a specific data range plotted.

Reasons (R): bar() function is used to plot vertical bar graph while barh() function is used to plot horizontal bar graph.

Ans. (b)

 

Q24. Assertion (a): Pyplot is a collection of methods within matplotlib library (of Python) which allows user to construct 2D plots easily and interactively.

Reason (R): A histogram is a statistical tool used to summarise discrete or continuous data. It provides a visual interpretation of numerical data by showing the number of data points that fall within a specified range of values (called "bins").

Ans. (b)

 

Q 25. Assertion (a): A freQuency polygon is a type of freQuency distribution graph. In a freQuency polygon, the number of observations is marked with a single point at the midpoint of an interval.

Reason (R): The histogram chart is a graph of plotted points that show the relationship between two sets of data. With a scatter plot, a mark or marker (usually a dot or small circle), represents a single data point.

Ans. (c)

 

Q 26. Assertion (a): Histogram is a type of graph that provides a visual interpretation of numerical data by indicating the number of data points that lie within a range of value.

Reasons (R): The loc argument of legend() provides the Location of legend.

Ans. (b)

 

Q 27. Assertion (a): Patterns, trends and correlations that might go undetected in text-based data can be exposed and recognised easier with data visualisation techniQues or tools such as line chart, bar chart, pie chart, histogram, scatter chart, etc.

Reasons (R): A marker is any symbol that represents a data value in a line chart or a scatter plot. In other words, the data points being plotted on a graph/chart are called markers.

Ans. (c)

Social Impact and Data Protection

Assertion-Reason Type Questions

 Directions: In the Questions given below, there are two Statements marked as Assertion (a) and Reason (R). Read the statements and choose the cortect option.

a)                  Both (a) and (R) are true, and (R) is the correct explanation of (a)

b)                  Both (a) and (R) are true, but (R) is not correct explanation of (a).

c)                  (a) is true, but (R) is false.

d)                  (a) is false, but (R) is true.

Q 1. Assertion (a): Encryption is a secure techniQue to protect data being trAnsmitted over a network.

Reason (R): The sender of the information encrypts the data using a secret code and the specified receiver only can decrypt the data using the same or different secret code.

Ans. (a)      

 

Q 2. Assertion (a): A digital signature is a form of electronic signature that authenticates a document or trAnsaction through encryption and password.

Reason (R): Security certificate is also a uniQue digital identification that is used to verify the identity of an individual website or user.

Ans. (b)

 

Q 3. Assertion (a): Session Electronic TrAnsaction is a secure protocol developed by MasterCard and Visa, in collaboration.

Reason (R): The term ethics generally refers to a set of moral principles that govern the behaviour of an individual or a group of individuals.

Ans. (d)

 

Q 4. Assertion (a): Plagiarism, Cyber bullying, Hacking, Phishing, Spamming, Software piracy, Intellectual property rights are some common issues that are governed by computer ethics.

Reason (R): Patent refers to the creations of the mind, which have both a moral and a commercial value.

Ans. (c)

 

Q 5. Assertion (a): Patent is a legal document that gives the inventor sole rights to make, sell or use an invention.

Reason (R): Intellectual Property (IP) is a right that is granted by Law to the creator or inventor for his original work.

Q 6. Assertion (a): A logo or symbol that is printed on business items to make it exclusive, is known as a trademark. A trademark is valid for seven years and can be renewed after that.

Reason (R): Copyright covers literary and artistic establishments such as books, plays, novels, articles, music compositions and much more.

Ans. (d)

 

Q 7. Assertion (a): In Minimal plagiarism the original work is edited, reframed and reproduced. It is very common in the education field.    

Reason (R): Direct or complete plagiarism is the verbatim trAnscription of a section of someone else's work, without making any changes in the original work.

Ans. (b)

 

Q 8. Assertion (a): Digital assets that users create, and which exist in any kind of digital form, for example, online or on storage media, constitute the digital property of users.

Reason (R): The owners are the ones who only can decide in what form the assets can be sold, reused, modified, repurposed or applied in any other media other than what the assets were originally meant for.

Ans. (b)

 

Q 9. Assertion (a): There are many anti-hacking software and technologies available which can be used to protect digital assets such as proprietary software, applications, tools, etc.

Reason (R): These anti-hacking tools prevent attackers from controlling or accessing your software, and therefore, help in protecting digital assets.

Ans. (a)

 

Q 10. Assertion(a): A software licence is a document that provides legally binding guidelines for the use and distribution of software.

Reason (R): Open source software licences a notice that grants the receiver of software wide-ranging rights to use, modify or redistribute that particular software.

Ans. (c)

 

Q 11. Assertion (a): Digital unite refers to a society where everyone would be skilled and eQuipped to take advantages of various ICT services.

Reason (R): The licence must discriminate against any person or group of persons.

Ans. (c)

 

Q 12. Assertion (a): As good digital citizens we have the right to privacy and the freedom of personal expression. At the same time, we have to understand that other digital citizens also have the same rights and freedoms.

Reason (R) : In a group or public forum, we should respect the diversity of the people in terms of knowledge, experience, culture and other aspects.

Ans. (b)

 

Q 13. Assertion (a): Passive digital footprints which includes data that we intentionally submit online. This would include emails we write, or responses or posts we make on different websites or mobile Apps, etc.

Reason (R): Digital footprints are the records and traces individuals' activities as they use the internet. Digital footprints are permanently stored. It includes websites we visit, emails we send, and any information we submit online, etc., along with the computer's IP address, location, and other device specific details.

Ans. (d)

 

Q 14. Assertion (a): For concerns related to data and bandwidth, very large attachments may be avoided. Rather send compressed files or link of the files through cloud shared storage like Google Drive, Microsoft OneDrive, etc.

Reason (R): Social media are websites or applications that enable their users to participate in social networking by creating and sharing content with others in the community.These platforms encourage users to share their thoughts and experiences through posts or pictures.

Ans. (b)

 

Q 15. Assertion (a): In this digital age, data or information protection is mainly about the privacy of data stored digitally. Elements of data that can cause substantial harm, embarrassment, inconvenience and unfairness to an individual, if breached or compromised, is called sensitive data.

 

Reason (R): Identity thieves increasingly use personal information stolen from computers or computer networks, to commit fraud by using the data gained unlawfully.

Ans. (b)

 

Q 16. Assertion (a): Licensing is the legal term used to describe the terms under which people are allowed to use the copyrighted material.

Reason (R): Patent includes any visual symbol, word, name, design, slogan, label, etc., that distinguishes the brand or commercial enterprise, from other brands or commercial enterprises.

Ans. (c)

 

Q 17. Assertion (a): The Govemment of India's The Information Technology Act, 2000 (also known as IT Act), amended in 2008, and provides guidelines to the user on the processing, storage and trAnsmission of sensitive information.

Reason (R): E-waste or Electronic waste includes electric or electronic gadgets and devices that are no longer in use. Hence, discarded computers, laptops, mobile phones, televisions, tablets, music systems, speakers, printers, scanners, etc. constitute e-waste when they are near or end of their useful life.

Ans. (b)

 


No comments:

Post a Comment