Zollege is here for to help you!!
Need Counselling
Nidhi Bamnawat's profile photo

Nidhi Bamnawat

| Updated On - Mar 25, 2026

CBSE Class 12 Informatics Practices Question Paper 2026 with Solutions PDFs is available here for download.CBSE Board Class 12 Informatics Practices Paper 2026 was held on March 25, 2026. CBSE Board Class 12 question paper followed the latest syllabus and exam pattern prescribed by CBSE. CBSE Board Class 12 the examination was held in the first half from 10:30 AM to 1:30 PM. Students can download the official paper in PDF format for reference.

CBSE Board Class 12 Informatics Practices Paper 2026 with Solutions PDFs

CBSE Board Class 12 Informatics Practices Question Paper 2026 Download PDF Check Solutions
CBSE Class 12 Informatics Practices Question Paper with Solutions

Question 1:

State whether the following statement is True or False :

In Pandas Series, the Positional index can be a string or an integer.

Correct Answer: (B) False
View Solution




Step 1: Understanding the Concept:

In a Pandas Series, data can be accessed using two types of indices: the explicit Label-based index and the implicit Positional index.


Step 2: Detailed Explanation:

The positional index represents the numerical location of the elements, similar to indexing in a standard Python list or array.

By definition, positional indices are always integers starting from 0 for the first element, 1 for the second, and so on.

While the user-defined labels (Label-based index) can indeed be strings, integers, or other hashable types, the positional index is strictly restricted to integers.

Therefore, stating that a positional index can be a string is technically incorrect.


Step 3: Final Answer:

Since the positional index is always an integer-based sequence starting from 0, the statement is False.
Quick Tip: Always distinguish between "Index Labels" (which you define and can be strings) and "Positional Index" (which is the internal integer count).


Question 2:

We can add a new row to a DataFrame DF using the ______ method.

  • (A) DF.add()
  • (B) DF.loc[]
  • (C) DF.loc()
  • (D) DF.addloc[]
Correct Answer: (B) DF.loc[]
View Solution




Step 1: Understanding the Concept:

To add data to a DataFrame, we need to specify where the data should go by referencing a row label or a positional index.


Step 2: Detailed Explanation:

- DF.add() is an arithmetic method used to add the values of two DataFrames or a DataFrame and a scalar. It is not used for structural changes like adding rows.

- DF.loc[] is a label-based indexer. When we assign values to a label that does not exist in the current index, Pandas automatically appends a new row with that label.

- DF.loc() is syntactically wrong because \texttt{.loc is an attribute/indexer and uses square brackets \texttt{[], not parentheses.

- DF.addloc[] is not a valid method in the Pandas library.


Step 3: Final Answer:

The correct approach to add a new row by assigning values to a specific label is using \texttt{DF.loc[].
Quick Tip: To add a row with label 'R5', simply use: \texttt{df.loc['R5'] = [val1, val2, ...]}.


Question 3:

Naveen discarded various types of waste material without realizing that e-waste contains harmful substances that could pollute the environment. He wants to know which of the following will be considered as e-waste ?

  • (A) Plastic Bottle
  • (B) Broken Smartphone
  • (C) Aluminium Foil
  • (D) Banana Peel
Correct Answer: (B) Broken Smartphone
View Solution




Step 1: Understanding the Concept:

E-waste (Electronic Waste) encompasses all discarded electrical or electronic devices and their components.


Step 2: Detailed Explanation:

- Plastic Bottle: Classified as general plastic or recyclable waste.

- Broken Smartphone: It is an electronic device containing complex circuitry, heavy metals (like lead and mercury), and batteries. Once discarded, it becomes e-waste.

- Aluminium Foil: Classified as metal or household packaging waste.

- Banana Peel: Classified as organic or biodegradable waste.


Step 3: Final Answer:

The broken smartphone is the only electronic item in the list, therefore it is categorized as e-waste.
Quick Tip: Electronic waste often contains toxic materials. Always dispose of old gadgets at designated e-waste collection centers.


Question 4:

In which scenario is a bar chart preferred over a line chart ?

  • (A) To visualise monthly temperature trends over a year.
  • (B) To compare the number of students in different classes.
  • (C) To show stock price movements over time.
  • (D) To analyse trends in website traffic over days.
Correct Answer: (B) To compare the number of students in different classes.
View Solution




Step 1: Understanding the Concept:

Different charts are suited for different types of data analysis. Line charts are used for continuity, while bar charts are used for comparison.


Step 2: Detailed Explanation:

- Line Charts: These are ideal for showing trends over a continuous interval (usually time). Scenarios (A), (C), and (D) involve analyzing data "over time," making them perfect for line charts.

- Bar Charts: These are used to compare discrete, categorical groups. In scenario (B), "different classes" are distinct categories. A bar chart allows for a clear visual comparison of the magnitudes (number of students) for each category.


Step 3: Final Answer:

Since comparing categorical data is the primary strength of a bar chart, option (B) is the correct scenario.
Quick Tip: Keywords: "Trend/Time" \(\rightarrow\) Line Chart; "Compare Categories" \(\rightarrow\) Bar Chart.


Question 5:

Which of the following network topology uses a central cable (backbone) to connect all devices ?

  • (A) Mesh
  • (B) Star
  • (C) Tree
  • (D) Bus
Correct Answer: (D) Bus
View Solution




Step 1: Understanding the Concept:

Network topology is the physical or logical arrangement of nodes and connections in a network.


Step 2: Detailed Explanation:

- Mesh: Every node is connected to every other node, providing high redundancy.

- Star: All nodes are connected individually to a central hub or switch.

- Tree: A combination of star and bus topologies where multiple stars are linked via a bus.

- Bus: This topology uses a single common communication line (the backbone) to which all nodes are attached via drop lines. Data transmitted by any node travels the length of the bus.


Step 3: Final Answer:

The Bus topology is defined by its use of a single central backbone cable.
Quick Tip: Bus topology is easy to install but if the central backbone cable fails, the entire network goes down.


Question 6:

State whether the following statement is True or False :

In SQL, an aggregate function returns multiple values for each column on which it is applied.

  • (A) True
  • (B) False
Correct Answer: (B) False
View Solution




Step 1: Understanding the Concept:

Aggregate functions are used in SQL to perform calculations on multiple rows of a column and produce a summary result.


Step 2: Detailed Explanation:

The core purpose of functions like \(SUM()\), \(AVG()\), \(COUNT()\), \(MAX()\), and \(MIN()\) is to "aggregate" (group together) many values into one single result.

Even when used with a \texttt{GROUP BY clause, the function returns only one value per group, not "multiple values for each column."

For example, \(SELECT \ COUNT(*) \ FROM \ table;\) returns exactly one number representing the total row count.


Step 3: Final Answer:

The statement is False because aggregate functions condense multiple inputs into a single output value.
Quick Tip: Aggregate = "Formed by the conjunction of many separate items." It always results in a summary (single value).


Question 7:

Rohini has developed a new kind of water purifier that uses a unique filtration method. Which type of Intellectual Property Right should she apply to protect her invention ?

  • (A) Trademark
  • (B) Copyright
  • (C) Patent
  • (D) Both Copyright \& Trademark
Correct Answer: (C) Patent
View Solution




Step 1: Understanding the Concept:

Intellectual Property Rights (IPR) protect different forms of creative and intellectual output through legal frameworks.


Step 2: Detailed Explanation:

- Trademark: Protects branding elements like logos, slogans, and names to prevent consumer confusion.

- Copyright: Protects original creative works such as literature, music, and art.

- Patent: Provides an exclusive right for an invention, which must be a new product or a process that provides a new way of doing something or offers a new technical solution to a problem.

Since Rohini has created a "unique filtration method" and a new device (water purifier), a Patent is the specific IPR intended to protect such technical inventions.


Step 3: Final Answer:

Inventions and technical methods are protected by Patents.
Quick Tip: Think of "P" for "Patent" and "P" for "Product/Process" invention.


Question 8:

Aditya is working on a DataFrame named df. He has written the statement :

print(df.loc['S2'])

What will the above statement do ?

  • (A) Display the data of the row having label 'S2'.
  • (B) Display the columns of the DataFrame.
  • (C) Display the data type of the column having label 'S2'.
  • (D) Display the index numbers of the DataFrame.
Correct Answer: (A) Display the data of the row having label 'S2'.
View Solution




Step 1: Understanding the Concept:

The \texttt{.loc[] indexer in Pandas is used for label-based indexing.


Step 2: Detailed Explanation:

The general syntax for \texttt{loc is \texttt{df.loc[row_label, column_label].

If only one label is provided (like \texttt{'S2'), Pandas defaults to searching for that label in the row index.

Therefore, \texttt{df.loc['S2'] will locate the row identified by the label 'S2' and return all the data stored in that specific row across all columns.


Step 3: Final Answer:

The code specifically targets and displays the data associated with the row label 'S2'.
Quick Tip: \texttt{loc} is label-based, \texttt{iloc} is integer-based. Both primarily access rows first.


Question 9:

What will be the result of the following SQL command ?

SELECT LENGTH ('Data Base') ;

(Note : There is single space between the words Data and Base.)

  • (A) 7
  • (B) 8
  • (C) 9
  • (D) Error
Correct Answer: (C) 9
View Solution




Step 1: Understanding the Concept:

The \texttt{LENGTH() function in SQL calculates the total number of characters present in a string.


Step 2: Detailed Explanation:

We must count every character inside the single quotes, including spaces:

1. 'D'

2. 'a'

3. 't'

4. 'a'

5. ' ' (The single space mentioned in the note)

6. 'B'

7. 'a'

8. 's'

9. 'e'

Total count = \(4 \ (Data) + 1 \ (Space) + 4 \ (Base) = 9\).


Step 3: Final Answer:

The length of the string 'Data Base' is 9.
Quick Tip: In string functions, spaces are characters too! Always count them.


Question 10:

Which of the following is a key feature of a Static Web Page ?

  • (A) Its content updates very frequently.
  • (B) It displays different content to different users.
  • (C) It loads slower than a Dynamic Web Page.
  • (D) It shows the same content unless the code is manually updated.
Correct Answer: (D) It shows the same content unless the code is manually updated.
View Solution




Step 1: Understanding the Concept:

A static web page consists of pre-built files (usually HTML, CSS) stored on a server.


Step 2: Detailed Explanation:

- Frequent Updates: This is a characteristic of dynamic pages that pull from databases.

- User-Specific Content: Dynamic pages use scripts (like PHP or Python) to serve unique content based on who is logged in.

- Loading Speed: Static pages usually load \textit{faster because there is no server-side processing or database querying involved.

- Manual Updates: This is the defining feature. Since the content is "hard-coded" in the HTML file, the only way to change what a visitor sees is for the developer to manually open the file and edit the code.


Step 3: Final Answer:

The unchanging nature of the content (unless manually edited) defines a static web page.
Quick Tip: Static = Fixed content (like a digital brochure).
Dynamic = Changing content (like a Facebook feed).


Question 11:

Which of the following is the correct expanded form of DML ?

  • (A) Device Management Language
  • (B) Device Manipulation Language
  • (C) Data Management Language
  • (D) Data Manipulation Language
Correct Answer: (D) Data Manipulation Language
View Solution




Step 1: Understanding the Concept:

SQL commands are categorized into functional groups such as DDL, DML, DCL, etc.


Step 2: Detailed Explanation:

- DML stands for Data Manipulation Language.

- These commands are used to "manipulate" the actual data stored inside the tables.

- Common DML commands include \texttt{INSERT (to add data), \texttt{UPDATE (to change data), and \texttt{DELETE (to remove data).

- Note that \texttt{SELECT is also often grouped under DML in many academic contexts, though it is specifically a Data Query Language (DQL).


Step 3: Final Answer:

Option (D) provides the standard full form used in Database Management Systems.
Quick Tip: DDL = Definition (Table structure).
DML = Manipulation (The data inside).


Question 12:

CSV stands for _______ Separated Values.

  • (A) Colon
  • (B) CTRL
  • (C) Comma
  • (D) Caret
Correct Answer: (C) Comma
View Solution




Step 1: Understanding the Concept:

CSV is a plain-text file format used to store data in a tabular structure.


Step 2: Detailed Explanation:

In a CSV file, each line represents a row of data. To distinguish between different columns (fields) within that row, a delimiter is used.

The standard delimiter for this format is the comma (\(,\)).

Because of its simplicity, CSV is universally supported by almost all spreadsheet and database software.


Step 3: Final Answer:

The "C" in CSV stands for Comma.
Quick Tip: Pandas uses \texttt{read\_csv()} to load these files into DataFrames easily.


Question 13:

Which of the following is an example of maintaining good net etiquette ?

  • (A) Spamming emails or messages to strangers.
  • (B) Ignoring other's opinions in online discussions.
  • (C) Not using copyrighted materials without permission of the owner.
  • (D) Sharing someone's private information publicly.
Correct Answer: (C) Not using copyrighted materials without permission of the owner.
View Solution




Step 1: Understanding the Concept:

Netiquette refers to the "etiquette" or social rules governing online behavior and communication.


Step 2: Detailed Explanation:

- Spamming (A): Sending unsolicited messages is a major violation of netiquette.

- Ignoring opinions (B): While not always a rule, good netiquette involves being open-minded and respectful of diverse views.

- Copyright (C): Respecting intellectual property by obtaining permission or citing sources is a fundamental pillar of ethical and legal online behavior. This is an excellent example of good netiquette.

- Doxing (D): Sharing private information (Personally Identifiable Information) without consent is a serious violation of privacy.


Step 3: Final Answer:

Option (C) describes ethical and responsible digital citizenship.
Quick Tip: Core Netiquette Rule: Treat others on the internet as you would like to be treated in person.


Question 14:

In the context of creating a Pandas Series from a dictionary, which of the following statement is correct ?

  • (A) The values of the dictionary become the indices of the Series.
  • (B) The keys of the dictionary become the values of the Series.
  • (C) The keys of the dictionary become the indices of the Series.
  • (D) The Series will have default integer indices starting from 0, ignoring the dictionary keys.
Correct Answer: (C) The keys of the dictionary become the indices of the Series.
View Solution




Step 1: Understanding the Concept:

A Python dictionary consists of key-value pairs. Pandas is designed to map these pairs directly into a Series structure.


Step 2: Detailed Explanation:

When you pass a dictionary to \texttt{pd.Series():

- Each Key in the dictionary acts as a unique label for the data point. In Pandas terminology, this becomes the Index.

- Each corresponding Value in the dictionary becomes the actual Data stored in the Series.

For example, for \texttt{\{'A': 100\, 'A' is the index and 100 is the value.


Step 3: Final Answer:

Dictionary keys are mapped to Series indices.
Quick Tip: Map: Dictionary Key \(\rightarrow\) Series Index; Dictionary Value \(\rightarrow\) Series Data.


Question 15:

In Pandas, when extracting a portion of a Series ser1 using ser1[start:end] with positional indices start and end, which of the following statements is true ?

  • (A) The element at the end index is included in the output.
  • (B) The element at the end index is excluded from the output.
  • (C) The elements at both the start and end indices are excluded from the output.
  • (D) The element at the start index is excluded from the output.
Correct Answer: (B) The element at the end index is excluded from the output.
View Solution




Step 1: Understanding the Concept:

Slicing in Pandas follows two different behaviors depending on whether you use labels or positional (integer) indices.


Step 2: Detailed Explanation:

- For positional indexing (similar to standard Python lists), the slicing syntax \texttt{[start:end] follows the rule of including the start and excluding the end (\(start \leq index < end\)).

- Therefore, the data point located at position \texttt{end is not part of the final result.

- Note: If label-based slicing (\texttt{.loc) were used, the end label would be included. But since the question specifies "positional indices," the standard Python slicing rule applies.


Step 3: Final Answer:

Positional slicing excludes the element at the \texttt{end index.
Quick Tip: Standard list/positional slicing: End excluded.
Pandas Label slicing (\texttt{.loc}): End included.


Question 16:

Nisha is using an Android app to make a voice call over the internet to her friend in another country. Which protocol is being used in this case ?

  • (A) Chat
  • (B) VoIP
  • (C) Email
  • (D) TV
Correct Answer: (B) VoIP
View Solution




Step 1: Understanding the Concept:

Internet protocols are specific rules that allow different types of data (text, voice, video) to be transmitted across networks.


Step 2: Detailed Explanation:

- Chat: Not a specific protocol, but a type of communication service (often using protocols like XMPP).

- VoIP (Voice over Internet Protocol): This technology allows voice communication to be delivered over IP networks. It converts voice into digital packets for transmission.

- Email: Uses protocols like SMTP/POP/IMAP, not designed for real-time voice calls.

- TV: Not a protocol; it's a medium.


Step 3: Final Answer:

Any voice call made over the internet (like via WhatsApp or Skype) utilizes the VoIP protocol.
Quick Tip: VoIP is the reason we can make free "internet calls" worldwide today.


Question 17:

State whether the following statement is True or False :

The INSTR(string1, string2) function in SQL returns 0 if string2 is not present as a substring in string1.

  • (A) True
  • (B) False
Correct Answer: (A) True
View Solution




Step 1: Understanding the Concept:

The \texttt{INSTR() function is used in SQL (especially in MySQL) to search for the first occurrence of a substring within a main string.


Step 2: Detailed Explanation:

- If \texttt{string2 is found inside \texttt{string1, the function returns its starting position (index), where the count starts from 1.

- If \texttt{string2 does not exist anywhere within \texttt{string1, the function cannot return a valid position. In such cases, it is designed to return the value 0.


Step 3: Final Answer:

Since the function returns 0 to indicate the absence of a substring, the statement is True.
Quick Tip: In SQL, remember that valid string positions start at 1, so 0 is used as a "not found" indicator.


Question 18:

In a Pandas DataFrame, which value for axis will be used to delete a column ?

  • (A) \textbf{axis = -1}
  • (B) \textbf{axis = 0}
  • (C) \textbf{axis = 1}
  • (D) \textbf{axis = 2}
Correct Answer: (C) axis = 1
View Solution




Step 1: Understanding the Concept:

In the Pandas library for Python, DataFrames are two-dimensional labeled data structures.

Operations like dropping (deleting) data require specifying the direction of the operation using the axis parameter.


Step 2: Key Formula or Approach:

Pandas follows a standard convention for axes:

1. axis = 0 (or 'index') refers to the horizontal axis (rows).

2. axis = 1 (or 'columns') refers to the vertical axis (columns).


Step 3: Detailed Explanation:

When using methods like df.drop(), the function needs to know whether to look for labels in the row index or the column headers.

If you want to delete a column, you must set axis = 1.

For example: \texttt{df.drop('column_name', axis=1) will remove the specified column from the DataFrame.

Setting axis = 0 would instead attempt to find a row with that label and delete it.


Step 4: Final Answer:

Therefore, to delete a column, the correct value for the axis parameter is 1.
Quick Tip: Think of "0" as "Rows" (starts with 'R', looks like a zero if you stretch it) and "1" as "Columns" (a vertical line like the number 1).
Alternatively, remember: 0 = Down (rows), 1 = Across (columns).


Question 19:

What will be the result of the following SQL command ?

SELECT ROUND(15.678, 2);

  • (A) \textbf{15.00}
  • (B) \textbf{15.67}
  • (C) \textbf{15.68}
  • (D) \textbf{16.00}
Correct Answer: (C) 15.68
View Solution




Step 1: Understanding the Concept:

The ROUND() function in SQL is used to round a numeric value to a specified number of decimal places.

The syntax is \texttt{ROUND(number, decimals).


Step 2: Key Formula or Approach:

To round to \( n \) decimal places:

1. Look at the digit at the \((n+1)^{th}\) decimal place.

2. If this digit is 5 or greater, round the digit at the \(n^{th}\) place up by 1.

3. If this digit is less than 5, keep the digit at the \(n^{th}\) place as it is.


Step 3: Detailed Explanation:

The given command is SELECT ROUND(15.678, 2);.

The number of decimal places specified is 2.

Look at the \(3^{rd}\) decimal place in 15.678, which is 8.

Since \(8 \geq 5\), we round up the digit at the \(2^{nd}\) decimal place (7).

Increasing 7 by 1 gives us 8.

So, the number becomes 15.68.


Step 4: Final Answer:

The result of the query will be 15.68.
Quick Tip: If the second argument is omitted in \texttt{ROUND()}, it defaults to 0, meaning it will round to the nearest whole number.
If the second argument is negative, it rounds to the left of the decimal point (tens, hundreds, etc.).


Question 20:

Assertion (A) : Pandas DataFrame can store values of multiple data types in multiple Columns.

Reason (R) : DataFrames are implemented using 2D arrays, which allows only numeric values.

Correct Answer: (C) (A) is True, but (R) is False.
View Solution




Step 1: Understanding the Concept:

This question tests the fundamental characteristics of Pandas DataFrames compared to other data structures like NumPy arrays.


Step 2: Detailed Explanation:

Evaluation of Assertion (A):

A Pandas DataFrame is a heterogeneous data structure.

This means each column can have a different data type (e.g., Column 1 contains integers, Column 2 contains strings, Column 3 contains floats).

Therefore, Assertion (A) is True.


Evaluation of Reason (R):

While Pandas uses NumPy arrays internally for efficiency, DataFrames are designed to handle heterogeneous data.

The statement that they allow "only numeric values" is False.

DataFrames can store objects, strings, datetime objects, booleans, and more.

Standard 2D arrays (like those in pure C or basic NumPy) are often homogeneous, but the Reason's claim about DataFrames is incorrect.


Step 3: Final Answer:

Since Assertion (A) is True and Reason (R) is False, the correct choice is (C).
Quick Tip: Remember: \textbf{Series} are 1D and can hold any data type. \textbf{DataFrames} are 2D and can hold different types of Series as columns. Pandas is flexible, unlike basic NumPy arrays which prefer single data types for speed.


Question 21:

Assertion (A) : The output of the SQL query SELECT COUNT (name) FROM students; will differ from the output of SELECT COUNT (*) FROM students; if there are some NULL values in the name column.

Reason (R) : COUNT(column_name) returns the count of NON NULL values in that column, whereas COUNT (*) returns the number of records in the table.

Correct Answer: (A) Both (A) and (R) are True, and (R) correctly explains (A).
View Solution




Step 1: Understanding the Concept:

In SQL, the COUNT() function behaves differently depending on the argument passed to it, specifically regarding how it handles NULL values.


Step 2: Detailed Explanation:

Evaluation of Reason (R):

COUNT(column_name) specifically counts only the rows where the specified column has a non-null value.

COUNT(*) counts every row in the table, regardless of whether any or all columns in that row contain NULL values.

Thus, Reason (R) is True.


Evaluation of Assertion (A):

If the \texttt{name column has NULL values, \texttt{COUNT(name) will ignore them.

However, \texttt{COUNT(*) will include those rows in its count because the row exists.

Since one counts NULLs and the other doesn't, the outputs will definitely be different.

Therefore, Assertion (A) is True.


Step 3: Connection between (A) and (R):

The Reason (R) provides the exact functional definition that explains why the difference described in Assertion (A) occurs.


Step 4: Final Answer:

Both (A) and (R) are true, and (R) is the correct explanation of (A). The answer is (A).
Quick Tip: Always use \texttt{COUNT(*)} when you want the total number of rows.
Use \texttt{COUNT(column)} only when you need to know how many entries for that specific attribute have been filled (are NOT NULL).


Question 22:

List any two characteristics of Pandas library in Python.

Correct Answer: Characteristics of Pandas include its ability to handle missing data and its high-performance data structures like Series and DataFrames.
View Solution




Step 1: Understanding the Concept:

Pandas is an open-source library providing high-performance, easy-to-use data structures and data analysis tools for the Python programming language.


Step 2: Detailed Explanation:

Two major characteristics of the Pandas library are:

1. Handling of Missing Data: Pandas provides easy ways to identify, remove, or fill missing values (represented as NaN) in datasets, ensuring data integrity during analysis.

2. Flexible Data Structures: It offers two primary data structures—Series (1D) and DataFrame (2D)—which allow for efficient storage and manipulation of large datasets with labeled axes.

3. Size Mutability: Columns can be easily inserted into or deleted from DataFrames, allowing for dynamic data manipulation.


Step 3: Final Answer:

The two characteristics are efficient handling of missing data and the provision of powerful data structures (Series and DataFrames).
Quick Tip: Pandas is built on top of NumPy, meaning it inherits fast array processing while adding the flexibility of labeled data.


Question 23:

Briefly explain the purpose of Boolean Indexing with respect to DataFrames. Support your answer with a suitable example.

Correct Answer: Boolean indexing is used to filter or select data from a DataFrame based on specific conditions that evaluate to True or False.
View Solution




Step 1: Understanding the Concept:

Boolean indexing is a technique where we use a list or series of boolean values (True or False) to select the rows or columns from a DataFrame that satisfy a particular condition.


Step 2: Detailed Explanation:

When a condition is applied to a DataFrame column, it generates a boolean mask. Only the rows where the mask is \texttt{True are retrieved.


Step 3: Example:

Suppose we have a DataFrame \texttt{df with a column 'Marks'. To select all students who scored more than 80 marks, we use:
\[ df\_result = df[df['Marks'] > 80] \]

Here, \texttt{df['Marks'] > 80 creates a boolean series. The DataFrame returns only those rows where the value in the 'Marks' column is greater than 80.


Step 4: Final Answer:

Boolean indexing is essential for data filtering and subset selection based on logical conditions.
Quick Tip: Remember that you can combine multiple boolean conditions using operators like \texttt{\&} (AND), \texttt{|} (OR), and \texttt{\~} (NOT).


Question 24:

Anjana had created a website using free design elements sourced from different creators online. She then published the site for public access but did not mention the source of the design elements used. Identify one possible violation of IPR in this situation.

Correct Answer: Plagiarism (or Copyright Infringement if the license required attribution).
View Solution




Step 1: Understanding the Concept:

Intellectual Property Rights (IPR) are the rights given to persons over the creations of their minds. Using someone else's work without proper credit is a violation.


Step 2: Detailed Explanation:

In this scenario, Anjana is using design elements created by others. Even if the elements were "free," many digital creators release work under licenses that require "Attribution" (mentioning the original creator).

By not mentioning the source, she is presenting others' creative work as her own, which is Plagiarism.


Step 3: Final Answer:

The violation is Plagiarism, as she failed to acknowledge the original creators of the design elements.
Quick Tip: Always check the license (like Creative Commons) of "free" assets; most require you to give credit to the author.


Question 25:

Name any two licensing models that allow legal reuse of digital creative work with conditions.

Correct Answer: Creative Commons (CC) and GNU General Public License (GPL).
View Solution




Step 1: Understanding the Concept:

Software and content licenses define the legal terms under which work can be redistributed or reused.


Step 2: Detailed Explanation:

Two common licensing models are:

1. Creative Commons (CC): A set of public copyright licenses that allow for the free distribution of an otherwise copyrighted "work." It often includes conditions like Attribution (BY), Non-Commercial (NC), or Share-Alike (SA).

2. GNU General Public License (GPL): A widely used free software license which guarantees end users the freedom to run, study, share, and modify the software, provided they keep the same license for derivative works.


Step 3: Final Answer:

Creative Commons and GNU GPL are two such licensing models.
Quick Tip: Open Source licenses encourage collaboration while protecting the original author's rights through specific usage terms.


Question 26:

Define the following terms with respect to RDBMS: Domain

Correct Answer: A Domain is a set of all possible atomic values that an attribute (column) can take.
View Solution




Step 1: Understanding the Concept:

In a Relational Database Management System (RDBMS), data integrity is maintained by restricting the values that can enter a column.


Step 2: Detailed Explanation:

A Domain defines the data type, size, and constraints for a specific column. For example, a domain for a "Gender" column might be limited to \{'Male', 'Female', 'Other'\, or a domain for "Age" might be restricted to integers between 0 and 120.


Step 3: Final Answer:

A Domain is the pool of valid values from which the actual values appearing in a column are drawn.
Quick Tip: Think of a Domain as the "definition" or "legal range" for the data in a column.


Question 27:

Define the following terms with respect to RDBMS: Tuple

Correct Answer: A Tuple is a single row in a table that represents a complete record.
View Solution




Step 1: Understanding the Concept:

In RDBMS terminology, a table (relation) consists of horizontal and vertical components representing data entries.


Step 2: Detailed Explanation:

A Tuple is the formal term for a row in a database table. It contains a collection of values that belong together as a single entity or record. For example, in a "Student" table, one tuple would contain the Roll Number, Name, and Class of exactly one student.


Step 3: Final Answer:

A tuple is a horizontal row in a relation, representing a set of related data values for a specific entity.
Quick Tip: Remember the synonyms: Tuple = Row = Record. Attribute = Column = Field.


Question 28:

Explain the role of the following network devices in a network :

(I) Modem

(II) Gateway

Correct Answer: (I) Modem: Converts signals between analog and digital forms for internet access. (II) Gateway: Connects networks using different protocols.
View Solution




Step 1: Understanding the Concept:

Network devices are hardware components used to connect computers or other electronic devices together so that they can share resources.


Step 2: Detailed Explanation:

(I) Modem (Modulator-Demodulator):

Its primary role is to modulate a digital signal from a computer into an analog signal for transmission over phone lines or cables, and demodulate an incoming analog signal back into digital data for the computer. This is essential for connecting a home network to an Internet Service Provider (ISP).



(II) Gateway:

A gateway acts as a "gate" between two networks that operate on different communication protocols. It translates the protocol of the incoming packet into the protocol used by the destination network. It is often used to connect a local area network (LAN) to the public internet.


Step 3: Final Answer:

Modem facilitates internet communication by signal conversion, while a Gateway enables communication between heterogeneous networks by protocol translation.
Quick Tip: A Modem works on signal types, whereas a Gateway works on communication protocols.


Question 29:

Differentiate between add-ons and plug-ins in a web browser.

Correct Answer: Add-ons extend browser functionality (like ad-blockers), while plug-ins allow the browser to display external content (like PDF viewers or Flash).
View Solution




Step 1: Understanding the Concept:

Both add-ons and plug-ins are software components that enhance a web browser's capabilities, but they serve different architectural purposes.


Step 2: Detailed Explanation:

1. Add-ons (or Extensions): These are usually designed to add specific features to the browser's interface or functionality itself. Examples include ad-blockers, language translators, or themes that change the UI. They are built using standard web technologies like HTML and JavaScript.

2. Plug-ins: These are third-party software programs that the browser "plugs into" to handle specific types of content it wasn't originally designed to display. Examples include Adobe Flash Player (for animations), PDF viewers, or Silverlight. They act more like external programs integrated into the browser window.


Step 3: Final Answer:

Add-ons enhance the browser's user experience and tools, while plug-ins expand the browser's ability to render varied multimedia and document formats.
Quick Tip: Modern browsers are moving away from traditional plug-ins (like Flash) in favor of built-in HTML5 capabilities, while extensions (add-ons) remain popular.


Question 30:

Write SQL queries to perform the following :

(I) Display the month (in numeric form) of the date '2026-01-01'.

(II) Display only the year part from the date '2026-01-01'.

Correct Answer: (I) \texttt{SELECT MONTH('2026-01-01');} (II) \texttt{SELECT YEAR('2026-01-01');}
View Solution




Step 1: Understanding the Concept:

SQL provides built-in date functions to extract specific parts (year, month, day, etc.) from a date literal or a column containing date values.


Step 2: Detailed Explanation:

- Part (I): To extract the month in numeric form (1 to 12), we use the \texttt{MONTH() function.

Query: \texttt{SELECT MONTH('2026-01-01');

- Part (II): To extract the 4-digit year, we use the \texttt{YEAR() function.

Query: \texttt{SELECT YEAR('2026-01-01');


Step 3: Final Answer:

The queries are:

(I) \texttt{SELECT MONTH('2026-01-01');

(II) \texttt{SELECT YEAR('2026-01-01');
Quick Tip: Standard SQL date functions usually take a string in 'YYYY-MM-DD' format as an argument.


Question 31:

What is data protection ?

Correct Answer: Data protection is the process of safeguarding important information from corruption, compromise, or loss.
View Solution




Step 1: Understanding the Concept:

As data becomes a critical asset, ensuring its safety and privacy is paramount for individuals and organizations.


Step 2: Detailed Explanation:

Data protection involves a combination of legal frameworks (like the GDPR or Digital Personal Data Protection Act) and technical measures (like encryption and backups). Its goal is to ensure:

1. Privacy: Protecting data from unauthorized access.

2. Availability: Ensuring data is accessible when needed.

3. Integrity: Preventing unauthorized modifications to data.


Step 3: Final Answer:

Data protection is a set of strategies and processes aimed at securing the privacy, availability, and integrity of data.
Quick Tip: Data protection isn't just about hackers; it also involves protecting data from physical damage or accidental deletion.


Question 32:

Mention any two precautionary measures one can take to avoid the risk of cybercrime.

Correct Answer: Using strong, unique passwords and enabling Two-Factor Authentication (2FA).
View Solution




Step 1: Understanding the Concept:

Cybercrime refers to illegal activities carried out using computers or the internet. Preventive measures are essential for digital safety.


Step 2: Detailed Explanation:

Two effective precautionary measures are:

1. Use of Strong and Unique Passwords: Create complex passwords including uppercase, lowercase, numbers, and symbols. Avoid using the same password for multiple accounts to prevent a "domino effect" if one account is compromised.

2. Regular Software Updates: Keep operating systems and applications updated. These updates often contain "security patches" that fix vulnerabilities that cybercriminals might otherwise exploit.

3. Avoiding Suspicious Links: Be wary of "phishing" emails or messages that ask for personal information or contain unexpected attachments.


Step 3: Final Answer:

The two measures are using strong passwords and keeping software updated.
Quick Tip: A password manager can help you maintain complex and unique passwords for all your online accounts without needing to memorize them.


Question 33:

Niharika wants to create a Pandas Series using a NumPy array with three elements 'a', 'b', and 'c', and assign custom indexes 'first', 'second' and 'third'. Help her complete the code below.

import pandas as pd

import _____ as np

arr = np._____ (['a', 'b' , 'c'])

s = pd._____ (arr, _____ =['first','second','third'])

print(s)

Correct Answer: The missing words are: \texttt{numpy}, \texttt{array}, \texttt{Series}, \texttt{index}.
View Solution




Step 1: Understanding the Concept:

Pandas allows the creation of a Series from various data structures, including NumPy arrays, by mapping values to specific index labels.


Step 2: Detailed Explanation:

- \texttt{import numpy as np: Standard alias for the NumPy library.

- \texttt{arr = np.array(...): The function to create a basic array in NumPy.

- \texttt{s = pd.Series(...): The constructor to create a Pandas Series object.

- \texttt{index=['first',...]: The parameter used to specify custom labels for the data.


Step 3: Completed Code:

\texttt{import pandas as pd

\texttt{import numpy as np

\texttt{arr = np.array (['a', 'b', 'c'])

\texttt{s = pd.Series (arr, index =['first','second','third'])

\texttt{print(s)


Step 4: Final Answer:

The completed code uses \texttt{numpy, \texttt{array, \texttt{Series, and the \texttt{index parameter.
Quick Tip: Remember that capitalization matters in Python! Use \texttt{Series} (capital S) as it is a class constructor in Pandas.


Question 34:

Write the output of the following code :

import pandas as pd

s1 = pd.Series([1, 2, 3], index = ['a','b','c'])

s2 = pd.Series([4, 5, 6], index = ['b','c','d'])

print(s1 + s2)

Correct Answer:
a NaN
b 6.0
c 8.0
d NaN
dtype: float64
View Solution




Step 1: Understanding the Concept:

When adding two Pandas Series, Pandas performs alignment based on the index labels. If a label exists in only one of the Series, the result for that label is \texttt{NaN (Not a Number).


Step 2: Key Approach:

Identify all unique index labels across both series: \{'a', 'b', 'c', 'd'\.

- Label 'a': Present in s1 (value 1), absent in s2 \(\rightarrow\) \(1 + NaN = NaN\).

- Label 'b': Present in s1 (value 2), present in s2 (value 4) \(\rightarrow\) \(2 + 4 = 6.0\).

- Label 'c': Present in s1 (value 3), present in s2 (value 5) \(\rightarrow\) \(3 + 5 = 8.0\).

- Label 'd': Absent in s1, present in s2 (value 6) \(\rightarrow\) \(NaN + 6 = NaN\).


Step 3: Detailed Explanation:

Pandas automatically promotes integer values to floats when \texttt{NaN values are introduced into the Series to maintain numerical compatibility. Hence, 6 becomes 6.0.


Step 4: Final Answer:

The output is:

a NaN

b 6.0

c 8.0

d NaN

dtype: float64
Quick Tip: Arithmetic operations on Series with non-matching indices always result in \texttt{NaN} for the missing labels. Use \texttt{s1.add(s2, fill\_value=0)} if you want to avoid \texttt{NaN} results.


Question 35:

Mandeep is the victim of which type of cybercrime ?

Correct Answer: Phishing
View Solution




Step 1: Understanding the Concept:

Cybercrime refers to criminal activities carried out by means of computers or the internet.

Phishing is a specific type of social engineering attack where a criminal sends a fraudulent message designed to trick a person into revealing sensitive information.


Step 2: Detailed Explanation:

In the given case, Mandeep received a deceptive email (a "lottery" notification) designed to lure him into a false sense of security.

The goal of this email was to obtain his private financial information, specifically his bank details.

This act of using spoofed emails and fake websites to steal user data (like login credentials and credit card numbers) is called Phishing.


Step 3: Final Answer:

Mandeep is a victim of Phishing.
Quick Tip: Never share sensitive information like OTPs, passwords, or bank details via email or over the phone. Official banks never ask for such details through these channels.


Question 36:

Other than email, mention any two common methods through which this type of cybercrime is being committed these days.

Correct Answer: Smishing (SMS) and Vishing (Voice Calls).
View Solution




Step 1: Understanding the Concept:

Phishing attacks are not limited to emails; they have evolved into various other formats to target users through different communication channels.


Step 2: Detailed Explanation:

Two common modern methods are:

1. Smishing: Short for "SMS phishing." It involves sending fraudulent text messages to a user's mobile phone containing malicious links or requests for personal info.

2. Vishing: Short for "Voice phishing." It is the use of phone calls (often automated or using voice manipulation) to trick people into giving up sensitive financial or personal information.

3. Social Media Phishing: Sending malicious links via direct messages on platforms like WhatsApp, Instagram, or Facebook.


Step 3: Final Answer:

The two common methods are Smishing (SMS-based) and Vishing (Phone call-based).
Quick Tip: Check the URL of a website before entering data. If it starts with "http://" instead of "https://", it might not be secure.


Question 37:

Name one law that safeguards the rights of Internet users in India.

Correct Answer: Information Technology Act, 2000 (IT Act, 2000).
View Solution




Step 1: Understanding the Concept:

To protect citizens from digital threats and to regulate e-commerce, governments enact specific legal frameworks.


Step 2: Detailed Explanation:

In India, the primary legislation that provides a legal framework for electronic governance by giving recognition to electronic records and digital signatures is the Information Technology Act, 2000.

It also defines various cybercrimes (like hacking, identity theft, and data privacy breaches) and prescribes punishments for them to safeguard users.


Step 3: Final Answer:

The law is the Information Technology Act, 2000 (often abbreviated as the IT Act, 2000).
Quick Tip: The IT Act was significantly amended in 2008 to include more specific cybercrimes and electronic evidence rules.


Question 38:

Write a Python program to create and display a Pandas Series as shown below :

\begin{verbatim
July 31
Aug 31
Sept 30
Oct 31
\end{verbatim
The index labels are the names of the months - July, Aug, Sept, Oct.

The corresponding scalar values are the number of days in these respective months - 31, 31, 30, 31.

Correct Answer: \begin{verbatim} import pandas as pd data = [31, 31, 30, 31] idx = ['July', 'Aug', 'Sept', 'Oct'] s = pd.Series(data, index = idx) print(s) \end{verbatim}
View Solution




Step 1: Understanding the Concept:

A Pandas Series is a one-dimensional array capable of holding data of any type. It has associated labels called an index.


Step 2: Detailed Explanation:

1. We first need to import the pandas library.

2. We define the data part, which is the list of days: \([31, 31, 30, 31]\).

3. We define the index part, which is the list of month names: \(['July', 'Aug', 'Sept', 'Oct']\).

4. Use the \texttt{pd.Series() function to create the object.

5. Finally, use \texttt{print() to display the series.


Step 3: Final Answer:
\[ \texttt{import pandas as pd}
\texttt{s = pd.Series([31, 31, 30, 31], index=['July', 'Aug', 'Sept', 'Oct'])}
\texttt{print(s)} \]
Quick Tip: If you don't provide an index, Pandas will automatically assign default numeric indices starting from 0. Always specify the \texttt{index} parameter if custom labels are required.


Question 39:

A CSV file named customer.csv contains records of customers. The first row of the file represents the header. Sample data from the file is shown below :

Name, Age, City

Rudra, 17, Kolkata

Divya, 19, Dehradun

Nabeel, 22, Lucknow

Write a Python program to import data from the CSV file into a Pandas DataFrame named DF and display the last two rows.

Correct Answer: \begin{verbatim} import pandas as pd DF = pd.read_csv('customer.csv') print(DF.tail(2)) \end{verbatim}
View Solution




Step 1: Understanding the Concept:

Pandas provides the \texttt{read_csv() function to load data from external CSV files. To view rows from the end of a DataFrame, the \texttt{tail() method is used.


Step 2: Detailed Explanation:

1. Import the pandas module.

2. Create a DataFrame named DF by reading the file 'customer.csv' using \texttt{pd.read_csv().

3. To display specific rows from the bottom, use \texttt{DF.tail(n), where \(n\) is the number of rows. Here, \(n=2\).


Step 3: Final Answer:
\[ \texttt{import pandas as pd}
\texttt{DF = pd.read\_csv('customer.csv')}
\texttt{print(DF.tail(2))} \]
Quick Tip: The \texttt{tail()} function by default displays the last 5 rows if no argument is passed. Similarly, \texttt{head()} displays the first 5 rows.


Question 40:

Write an SQL statement to create a table named PRODUCTS with the following specifications :

Correct Answer: \begin{verbatim} CREATE TABLE PRODUCTS ( PID INT PRIMARY KEY, PName VARCHAR(30), PCat CHAR(15), Price DECIMAL(10, 2) ); \end{verbatim}
View Solution




Step 1: Understanding the Concept:

The \texttt{CREATE TABLE command is a Data Definition Language (DDL) command used to define the schema of a new table in a database.


Step 2: Detailed Explanation:

According to the requirements:

1. PID: Should be an integer and the Primary Key. Primary key constraint ensures the column has unique and non-null values.

2. PName: Should be variable character with a length of 30.

3. PCat: Should be fixed-length character with a length of 15.

4. Price: Decimal type is used for monetary values. Typically, we define it as \texttt{DECIMAL(10,2) to represent up to 10 digits with 2 decimal places.


Step 3: Final Answer:
\[ \texttt{CREATE TABLE PRODUCTS (}
\texttt{PID INT PRIMARY KEY,}
\texttt{PName VARCHAR(30),}
\texttt{PCat CHAR(15),}
\texttt{Price DECIMAL(10,2)}
\texttt{);} \]
Quick Tip: Always specify the primary key during table creation to maintain entity integrity. \texttt{VARCHAR} is preferred for names as it saves space compared to \texttt{CHAR}.


Question 41:

Write an SQL query to increase the price of all items by 100, whose product category is Grocery, in the table PRODUCTS.

Correct Answer: \begin{verbatim} UPDATE PRODUCTS SET Price = Price + 100 WHERE PCat = 'Grocery'; \end{verbatim}
View Solution




Step 1: Understanding the Concept:

The \texttt{UPDATE command is a Data Manipulation Language (DML) command used to modify existing records in a table.


Step 2: Detailed Explanation:

1. The \texttt{SET clause identifies the column to be changed (\texttt{Price).

2. The calculation is \texttt{Price = Price + 100.

3. The \texttt{WHERE clause filters the rows so only those with the category 'Grocery' are updated.


Step 3: Final Answer:
\[ \texttt{UPDATE PRODUCTS SET Price = Price + 100 WHERE PCat = 'Grocery';} \]
Quick Tip: Always be careful with the \texttt{WHERE} clause in an \texttt{UPDATE} statement. If you omit it, all rows in the table will be updated!


Question 42:

Write appropriate SQL query to : Delete the record of the subject whose TID is equal to 4.

Correct Answer: \texttt{DELETE FROM SUBJECT WHERE TID = 4;}
View Solution




Step 1: Understanding the Concept:

The \texttt{DELETE command removes specific rows from a table based on a condition.


Step 2: Detailed Explanation:

We target the table SUBJECT. The condition given is that the TID column must be equal to 4.

Execution: \texttt{DELETE FROM SUBJECT WHERE TID = 4;


Step 3: Final Answer:

\texttt{DELETE FROM SUBJECT WHERE TID = 4;
Quick Tip: The \texttt{DELETE} command only removes records, while \texttt{DROP} removes the entire table structure.


Question 43:

Write appropriate SQL query to : Display the names of teachers who have more than 5 years of experience and who stay in Nagpur.

Correct Answer: \texttt{SELECT TName FROM TEACHER WHERE Experience > 5 AND City = 'Nagpur';}
View Solution




Step 1: Understanding the Concept:

The \texttt{SELECT command is used to query data. Multiple conditions in the \texttt{WHERE clause can be combined using the \texttt{AND logical operator.


Step 2: Detailed Explanation:

1. Columns to fetch: \texttt{TName.

2. Table name: \texttt{TEACHER.

3. Conditions:

- \texttt{Experience > 5

- \texttt{City = 'Nagpur'

4. Combining them with \texttt{AND ensures both must be true.


Step 3: Final Answer:

\texttt{SELECT TName FROM TEACHER WHERE Experience > 5 AND City = 'Nagpur';
Quick Tip: Remember that string values in SQL like 'Nagpur' must be enclosed in single or double quotes, whereas numbers like 5 should not be.


Question 44:

Write appropriate SQL query to : Display subject names along with their teacher names.

Correct Answer: \texttt{SELECT SubName, TName FROM SUBJECT, TEACHER WHERE SUBJECT.TID = TEACHER.TID;}
View Solution




Step 1: Understanding the Concept:

This is a join query where data from two tables (TEACHER and SUBJECT) needs to be combined based on a common column (TID).


Step 2: Detailed Explanation:

To correctly pair a subject with its teacher, we match the TID present in both tables.

1. Select the required columns: \texttt{SubName (from SUBJECT) and \texttt{TName (from TEACHER).

2. Specify both tables in the \texttt{FROM clause.

3. Link them in the \texttt{WHERE clause using \texttt{SUBJECT.TID = TEACHER.TID.


Step 3: Final Answer:

\texttt{SELECT SubName, TName FROM SUBJECT, TEACHER WHERE SUBJECT.TID = TEACHER.TID;
Quick Tip: This type of join where we use an equality operator on a common column in the \texttt{WHERE} clause is known as an \textbf{Equi-Join}.


Question 45:

Which attribute(s) can be considered as the Candidate keys(s) ? Justify your answer.

Correct Answer: BookId and Title.
View Solution




Step 1: Understanding the Concept:

A Candidate Key is a set of one or more attributes that can uniquely identify a record in a table. It must be unique and non-null.


Step 2: Detailed Explanation:

Looking at the data:

1. BookId: Each row has a unique numeric ID (101, 201, 301, 401). No two books can have the same ID.

2. Title: In this specific table, all book titles are unique. Assuming no two different books share the exact same title in the library, it can also act as a candidate key.

- Attributes like Genre cannot be keys because "Technology" repeats.

- Price cannot be a key because it has a NULL value and could repeat.


Step 3: Final Answer:

The Candidate Keys are BookId and Title. BookId is unique for every record, and Title is also unique for every book in this list.
Quick Tip: From the set of Candidate Keys, the most suitable one is chosen as the \textbf{Primary Key}. BookId is the most logical Primary Key here.


Question 46:

Write an SQL query to insert a new record with the following values : BookId : 501, Title : AI for ALL, Genre : Technology, Price : 589.

Correct Answer: \texttt{INSERT INTO LIBRARY VALUES (501, 'AI for ALL', 'Technology', 589);}
View Solution




Step 1: Understanding the Concept:

The \texttt{INSERT INTO statement is used to add new rows of data to a table.


Step 2: Detailed Explanation:

The command follows the syntax: \texttt{INSERT INTO table_name VALUES (value1, value2, ...);.

Since we are providing values for all columns in the correct order, we don't need to specify column names.

- BookId: 501 (Number)

- Title: 'AI for ALL' (String)

- Genre: 'Technology' (String)

- Price: 589 (Number)


Step 3: Final Answer:

\texttt{INSERT INTO LIBRARY VALUES (501, 'AI for ALL', 'Technology', 589);
Quick Tip: Ensure the order of values in the \texttt{INSERT} statement matches the column order in the table schema exactly.


Question 47:

Write an SQL query to add a new column Author that is a character data type of size 20.

Correct Answer: \texttt{ALTER TABLE LIBRARY ADD Author VARCHAR(20);}
View Solution




Step 1: Understanding the Concept:

The \texttt{ALTER TABLE command is used to add, delete, or modify columns in an existing table structure (DDL).


Step 2: Detailed Explanation:

To add a new column, the \texttt{ADD keyword is used with the \texttt{ALTER TABLE command.

Syntax: \texttt{ALTER TABLE table_name ADD column_name datatype(size);

Here:

- Table name: \texttt{LIBRARY

- Column name: \texttt{Author

- Data type: \texttt{VARCHAR or \texttt{CHAR

- Size: \texttt{20


Step 3: Final Answer:

\texttt{ALTER TABLE LIBRARY ADD Author VARCHAR(20);
Quick Tip: When you add a new column to a table that already has data, the existing rows will automatically have \textbf{NULL} values for the new column until updated.


Question 48:

Ms. Anjali, a data analyst, has been assigned the task of creating a histogram to display the age distribution of ten participants in a workshop. She has been provided with the following list of their ages:

Ages = [22, 25, 24, 28, 30, 24, 29, 27, 21, 23]

She has started writing a Python program for it. However, the code is incomplete. Help her complete the program by filling in the missing parts, so that the histogram as shown below is displayed.





\texttt{import matplotlib.pyplot as plt

\texttt{Ages = [22, 25, 24, 28, 30, 24, 29, 27, 21, 23]

\texttt{binsize = [20, 22, 24, 26, 28, 30]

\texttt{plt.\textunderscore\textunderscore\textunderscore\textunderscore\textunderscore\textunderscore\textunderscore (Ages, bins=binsize, edgecolor = 'black', label = 'Participants') \# Statement-1

\texttt{\textunderscore\textunderscore\textunderscore\textunderscore\textunderscore\textunderscore\textunderscore.xlabel('Age') \# Statement-2

\texttt{plt.ylabel('Number of Participants')

\texttt{plt.title("Age Distribution")

\texttt{plt.\textunderscore\textunderscore\textunderscore\textunderscore\textunderscore\textunderscore\textunderscore \# Statement-3

\texttt{\textunderscore\textunderscore\textunderscore\textunderscore\textunderscore\textunderscore\textunderscore \# Statement-4

Correct Answer: This is a multi-part descriptive question.
View Solution



Step 1: Understanding the Concept:

This question requires knowledge of the \texttt{matplotlib.pyplot library in Python, specifically how to plot histograms, label axes, add legends, and display the final figure.

Step 2: Final Answer:

The sub-parts below provide the specific code for each statement.
Quick Tip: In Matplotlib, always remember to use the alias (usually \texttt{plt}) consistently for all function calls like \texttt{xlabel}, \texttt{ylabel}, and \texttt{show()}.


Question 49:

Write the suitable code for the blank space in the line marked as Statement-1 which plots the histogram.

  • (A) plot
  • (B) bar
  • (C) hist
  • (D) scatter
Correct Answer: hist
View Solution



Step 1: Understanding the Concept:

A histogram is a representation of the distribution of numerical data. In Matplotlib, the specific function to create this is \texttt{hist().

Step 2: Key Formula or Approach:

The syntax is \texttt{plt.hist(x, bins=None, ...).

Step 3: Detailed Explanation:

The code provided gives the data (\texttt{Ages) and the bin edges (\texttt{binsize).

To generate the visual representation of these frequency distributions, we must use the \texttt{hist method of the \texttt{pyplot object.

Step 4: Final Answer:

The blank should be filled with hist.
Quick Tip: While \texttt{bar()} creates a bar chart for categorical data, \texttt{hist()} automatically bins continuous data into intervals to show frequency.


Question 50:

Fill in the blank in Statement-2 to use the correct alias of the required module to set the label on x axis.

Correct Answer: plt
View Solution



Step 1: Understanding the Concept:

In Python, when a module is imported with an alias (using \texttt{as), that alias must be used to access its functions.

Step 3: Detailed Explanation:

The code starts with \texttt{import matplotlib.pyplot as plt.

Therefore, any function belonging to \texttt{pyplot, such as \texttt{xlabel(), must be prefixed with the alias \texttt{plt.

Step 4: Final Answer:

The blank should be filled with plt.
Quick Tip: Using \texttt{plt} is a standard convention in the data science community for \texttt{matplotlib.pyplot}.


Question 51:

Fill in the blank in Statement-3 with the correct Python code to display the legend on the graph.

Correct Answer: legend()
View Solution



Step 1: Understanding the Concept:

A legend is used to describe the elements of the graph. In Statement-1, a \texttt{label='Participants' was defined.

Step 3: Detailed Explanation:

To actually render that label in a box on the plot, the \texttt{legend() function must be called.

The command \texttt{plt.legend() tells Matplotlib to look for any labeled plots and create the descriptive box.

Step 4: Final Answer:

The blank should be filled with legend().
Quick Tip: The legend will only appear if you have provided a \texttt{label} argument in the plotting function (like \texttt{hist} or \texttt{plot}).


Question 52:

Fill in the blank in Statement-4 with the appropriate Python code to display the graph.

Correct Answer: (B) plt.show()
View Solution



Step 1: Understanding the Concept:

After setting up the plot, labels, and title, the graph is stored in memory. To open a window and view it, a display command is required.

Step 3: Detailed Explanation:

The function \texttt{show() is used to display all figures and block until the figures have been closed.

It is the standard final command in a plotting script.

Step 4: Final Answer:

The statement should be plt.show().
Quick Tip: In Jupyter notebooks, plots might show up automatically, but in standalone Python scripts, \texttt{plt.show()} is mandatory.


Question 53:

Display last 3 characters of guest name in upper case.

Correct Answer: SELECT UPPER(RIGHT(GuestName, 3)) FROM Guest;
View Solution



Step 1: Understanding the Concept:

To extract parts of a string and change its case, we combine string manipulation functions.

Step 2: Key Formula or Approach:

1. \texttt{RIGHT(str, n): extracts \( n \) characters from the right.

2. \texttt{UPPER(str): converts string to capital letters.

Step 3: Detailed Explanation:

The target column is \texttt{GuestName.

First, we apply \texttt{RIGHT(GuestName, 3) to get the last three letters.

Then, we wrap it in \texttt{UPPER() to ensure they are capitalized.

Step 4: Final Answer:

\texttt{SELECT UPPER(RIGHT(GuestName, 3)) FROM Guest;
Quick Tip: You can also use \texttt{SUBSTR(GuestName, -3)} in many SQL versions to achieve the same result as \texttt{RIGHT(GuestName, 3)}.


Question 54:

Display the name of the guest along with the day name of check-in date.

Correct Answer: SELECT GuestName, DAYNAME(CheckInDate) FROM Guest;
View Solution



Step 1: Understanding the Concept:

SQL provides functions to extract the day of the week (like Monday, Tuesday) from a date column.

Step 2: Key Formula or Approach:

The function \texttt{DAYNAME(date) returns the name of the day for a given date.

Step 3: Detailed Explanation:

We need to select two columns: \texttt{GuestName and the calculated day name from \texttt{CheckInDate.

The query selects the name and then uses \texttt{DAYNAME() on the date column.

Step 4: Final Answer:

\texttt{SELECT GuestName, DAYNAME(CheckInDate) FROM Guest;
Quick Tip: Be careful not to confuse \texttt{DAYNAME()} with \texttt{DAY()}, which returns the numeric day of the month (1-31).


Question 55:

Display the remainder when charges are divided by 1000.

Correct Answer: SELECT MOD(Charges, 1000) FROM Guest;
View Solution



Step 1: Understanding the Concept:

The remainder of a division is found using the Modulo operation in SQL.

Step 2: Key Formula or Approach:

The function is \texttt{MOD(N, M), where \( N \) is the dividend and \( M \) is the divisor.

Step 3: Detailed Explanation:

Here, the column \texttt{Charges is the dividend and 1000 is the divisor.

The query calculates the remainder for each row in the table.

Step 4: Final Answer:

\texttt{SELECT MOD(Charges, 1000) FROM Guest;
Quick Tip: In SQL, you can also use the % operator: \texttt{SELECT Charges % 1000 FROM Guest;}.


Question 56:

Extract and display three characters, starting from the second character, of each guest name.

Correct Answer: SELECT SUBSTR(GuestName, 2, 3) FROM Guest;
View Solution



Step 1: Understanding the Concept:

To extract a middle portion of a string, we use the substring function.

Step 2: Key Formula or Approach:

\texttt{SUBSTR(string, start_position, length)

Note: SQL indexing starts at 1.

Step 3: Detailed Explanation:

The starting position is 2 (second character).

The length to extract is 3 characters.

Applying this to the \texttt{GuestName field gives the required result.

Step 4: Final Answer:

\texttt{SELECT SUBSTR(GuestName, 2, 3) FROM Guest;
Quick Tip: The functions \texttt{SUBSTR()}, \texttt{SUBSTRING()}, and \texttt{MID()} perform the same action in MySQL.


Question 57:

SELECT CUSTOMERNAME FROM ORDERS WHERE DISCOUNT IS NOT NULL;

Correct Answer:
Hemant
Neha
Keshav
View Solution



Step 1: Understanding the Concept:

The \texttt{IS NOT NULL condition filters out any records where the specified column contains no data (NULL).

Step 3: Detailed Explanation:

Looking at the \texttt{DISCOUNT column:

1. Order 101: 10 (Not NULL) \(\rightarrow\) Include Hemant

2. Order 102: 15 (Not NULL) \(\rightarrow\) Include Neha

3. Order 103: 5 (Not NULL) \(\rightarrow\) Include Keshav

4. Order 104: NULL \(\rightarrow\) Exclude Sandhya

Step 4: Final Answer:

\begin{tabular{|l|
\hline
CUSTOMERNAME
\hline
Hemant

Neha

Keshav
\hline
\end{tabular
Quick Tip: NULL is different from 0. \texttt{IS NOT NULL} treats any number (even 0) as a valid value and only filters the actual "NULL" marker.


Question 58:

SELECT CUSTOMERNAME, DISCOUNT FROM ORDERS WHERE DISCOUNT BETWEEN 5 AND 10;

Correct Answer:
Hemant 10
Keshav 5
View Solution



Step 1: Understanding the Concept:

The \texttt{BETWEEN operator is inclusive of the boundary values.

Step 3: Detailed Explanation:

The range is \( 5 \le DISCOUNT \le 10 \).

1. Hemant: 10 (Matches)

2. Neha: 15 (Out of range)

3. Keshav: 5 (Matches)

4. Sandhya: NULL (Does not match)

Step 4: Final Answer:

\begin{tabular{|l|c|
\hline
CUSTOMERNAME & DISCOUNT
\hline
Hemant & 10

Keshav & 5
\hline
\end{tabular
Quick Tip: Always remember that \texttt{BETWEEN a AND b} is the same as \texttt{>= a AND <= b}.


Question 59:

SELECT MONTHNAME(ORDERDATE) FROM ORDERS WHERE ORDERDATE IS NOT NULL;

Correct Answer:
March
January
December
View Solution



Step 1: Understanding the Concept:

The \texttt{MONTHNAME() function identifies the month part of a date and returns its full English name.

Step 3: Detailed Explanation:

1. 2024-03-01 \(\rightarrow\) 03 \(\rightarrow\) March

2. NULL \(\rightarrow\) Excluded by \texttt{WHERE clause

3. 2024-01-20 \(\rightarrow\) 01 \(\rightarrow\) January

4. 2023-12-25 \(\rightarrow\) 12 \(\rightarrow\) December

Step 4: Final Answer:

\begin{tabular{|l|
\hline
MONTHNAME(ORDERDATE)
\hline
March

January

December
\hline
\end{tabular
Quick Tip: Functions like \texttt{MONTH()} return numbers (1-12), while \texttt{MONTHNAME()} returns the string name.


Question 60:

SELECT ORDERID, DAY(ORDERDATE) FROM ORDERS;

Correct Answer:
101 1
102 NULL
103 20
104 25
View Solution



Step 1: Understanding the Concept:

The \texttt{DAY() function extracts the day-of-month (1-31) from a date. If the input is NULL, the result is NULL.

Step 3: Detailed Explanation:

No filter is applied, so all rows appear:

1. 101: 2024-03-01 \(\rightarrow\) 1

2. 102: NULL \(\rightarrow\) NULL

3. 103: 2024-01-20 \(\rightarrow\) 20

4. 104: 2023-12-25 \(\rightarrow\) 25

Step 4: Final Answer:

\begin{tabular{|c|c|
\hline
ORDERID & DAY(ORDERDATE)
\hline
101 & 1

102 & NULL

103 & 20

104 & 25
\hline
\end{tabular
Quick Tip: In output tables, if a calculation involves a NULL value, the result column will usually display NULL unless handled with an \texttt{IFNULL} or \texttt{COALESCE} function.


Question 61:

Identify the most suitable department to install the main server in the Mysuru office. Justify your answer with a valid reason.

Correct Answer: Research Department.
View Solution




Step 1: Understanding the Concept:

In a network, the server should be placed in a location that minimizes network traffic and provides maximum efficiency.


Step 2: Key Approach:

The "80/20 Rule" or the "Maximum Capacity Rule" suggests placing the server in the building or department that has the highest number of computers.


Step 3: Detailed Explanation:

Based on the data provided:

1. Human Resources has 30 computers.

2. Research has 80 computers.

3. Design has 50 computers.

4. Technical Support has 20 computers.

The Research department has the maximum number of computers (80).

Placing the server here reduces the overall cabling cost and minimizes data congestion, as most requests will originate from this location.


Step 4: Final Answer:

The main server should be installed in the Research department because it has the maximum number of computers.
Quick Tip: For server location questions, always choose the building with the highest number of nodes (computers) to ensure efficient data flow.


Question 62:

Create a cable layout design to establish Wired network connectivity between the departments in the Mysuru Office.

Correct Answer: Star Topology (connected through the Research department).
View Solution




Step 1: Understanding the Concept:

A cable layout should be designed to use the minimum amount of cable while ensuring a reliable connection between all departments.


Step 2: Key Approach:
A star topology is often preferred where all other departments are connected to the department containing the server (Research).


Step 3: Detailed Explanation:

Using Research as the central hub:

1. Research to Human Resources: 55m

2. Research to Design: 40m

3. Research to Technical Support: 80m

Total cable required = \(55 + 40 + 80 = 175\) metres.

This layout is efficient as it uses the server location as a central point and minimizes total distance compared to other configurations.


Step 4: Final Answer:

The best layout is to connect Human Resources, Design, and Technical Support directly to the Research department (Star Topology).
Quick Tip: Always connect the other blocks to the server block to create a star topology for the most reliable wired design.


Question 63:

Suggest the appropriate network device to connect multiple computers within the Research department.

Correct Answer: Switch (or Hub).
View Solution




Step 1: Understanding the Concept:

To create a local area network (LAN) within a single room or building, a central connection point is needed for all computers.


Step 2: Detailed Explanation:

A Switch is the most appropriate device for this purpose.

It receives data packets from one computer and forwards them only to the intended destination computer within the same network.

While a Hub can also be used, a Switch is "intelligent" and more efficient as it reduces unnecessary traffic (broadcasts).


Step 3: Final Answer:

A Switch should be used to connect the 80 computers within the Research department.
Quick Tip: A Switch is preferred over a Hub because it is an intelligent device that manages traffic more effectively by using MAC addresses.


Question 64:

What type of network (LAN, MAN, WAN) would best connect the Mysuru and Chennai office ?

Correct Answer: WAN (Wide Area Network).
View Solution




Step 1: Understanding the Concept:

Networks are categorized based on their geographical span: LAN (local), MAN (metropolitan/city), and WAN (wide area/inter-city).


Step 2: Detailed Explanation:

The distance between Mysuru and Chennai is given as 350 kilometres.

- LAN typically covers distances up to 1-2 km (within a building).

- MAN typically covers a city-wide area (up to 50 km).

- WAN is used for connecting devices across cities, countries, or continents.

Since these offices are in different cities separated by a significant distance, they must be connected via a Wide Area Network.


Step 3: Final Answer:

The network type is WAN.
Quick Tip: If the distance is in kilometers (inter-city), it is almost always a WAN. If it is within a single city, it is a MAN.


Question 65:

Which device should be used if the signal strength weakens while transmitting data between the Human Resources and Technical Support departments due to the long distance between them ?

Correct Answer: Repeater.
View Solution




Step 1: Understanding the Concept:

Signal attenuation occurs when a signal travels long distances, causing it to lose strength and clarity.


Step 2: Detailed Explanation:

The distance between Human Resources and Technical Support is 140 metres.

Standard Ethernet cables (like Cat5/Cat6) typically have a maximum effective range of 100 metres before signal degradation starts.

A Repeater is a device that receives a weak signal, regenerates it to its original strength, and retransmits it.


Step 3: Final Answer:

A Repeater should be used to amplify and regenerate the signals.
Quick Tip: Whenever you see "signal weakens" or "long distance" within a local network context, the answer is usually a Repeater.


Question 66:

Write Python code to create and display the given DataFrame using the Dictionary of Series method.

Correct Answer:
\texttt{import pandas as pd}
\texttt{S1 = pd.Series(['Ananya', 'Karan', 'Simran', 'Rahul', 'Priya'])}
\texttt{S2 = pd.Series(['B.Sc.', 'B.Tech', 'MCA', 'BCA', 'BA'])}
\texttt{S3 = pd.Series([62000, 67000, 64000, 70000, 69000])}
\texttt{dict = \{'Name': S1, 'Course': S2, 'Amount': S3\}}
\texttt{Scholarship = pd.DataFrame(dict)}
\texttt{print(Scholarship)}
View Solution




Step 1: Understanding the Concept:

A DataFrame can be created using a dictionary where the keys are column names and the values are Pandas Series objects containing the data.


Step 2: Detailed Explanation:

- First, we import the pandas library.

- We create three separate Series: one for Names, one for Courses, and one for Amounts.

- We group these into a dictionary \texttt{dict.

- Finally, we pass this dictionary to the \texttt{pd.DataFrame() constructor.


Step 3: Final Answer:

The code creates three series and combines them into a DataFrame via a dictionary.
Quick Tip: Using "Dictionary of Series" is useful when your data sources are already structured as series or lists with common indices.


Question 67:

Rename row indexes to ['a', 'b', 'c', 'd', 'e'].

Correct Answer: \texttt{Scholarship.index = ['a', 'b', 'c', 'd', 'e']}
View Solution




Step 1: Understanding the Concept:

The \texttt{.index attribute of a DataFrame allows us to access or modify the row labels (indices).


Step 2: Detailed Explanation:

By default, the indices are \texttt{[0, 1, 2, 3, 4].

To change them, we assign a new list of the same length to \texttt{Scholarship.index.


Step 3: Final Answer:

\texttt{Scholarship.index = ['a', 'b', 'c', 'd', 'e']
Quick Tip: Alternatively, you can use \texttt{df.rename(index=\{0:'a', 1:'b', ...\})}, but direct assignment to \texttt{.index} is simpler for full replacements.


Question 68:

Write Python statement to remove the last row of the given DataFrame.

Correct Answer: \texttt{Scholarship.drop(Scholarship.tail(1).index, inplace=True)}
View Solution




Step 1: Understanding the Concept:

The \texttt{drop() method is used to remove rows or columns. To remove the last row, we first need to identify its index.


Step 2: Detailed Explanation:

- \texttt{Scholarship.tail(1) selects the last row of the DataFrame.

- \texttt{.index extracts the index label of that row.

- \texttt{Scholarship.drop(...) removes that specific index.

Alternatively, using integer location: \texttt{Scholarship.drop(Scholarship.index[-1], inplace=True).


Step 3: Final Answer:

Use \texttt{Scholarship.drop(Scholarship.index[-1]) to remove the final entry.
Quick Tip: Remember to use \texttt{inplace=True} if you want the change to be saved directly to the original DataFrame without re-assigning it.


Question 69:

Write suitable SQL query to: Display only the date part from the date/time expression '2026-01-01 10:10:10'.

Correct Answer: \texttt{SELECT DATE('2026-01-01 10:10:10');}
View Solution




Step 1: Understanding the Concept:

The \texttt{DATE() function in SQL extracts the date part from a given date or datetime expression.


Step 2: Detailed Explanation:

The input is \texttt{'2026-01-01 10:10:10'.

The date portion is \texttt{'2026-01-01'.

Applying \texttt{DATE() strips the time component (\texttt{10:10:10).


Step 3: Final Answer:

\texttt{SELECT DATE('2026-01-01 10:10:10');
Quick Tip: Use \texttt{TIME()} to extract only the time part and \texttt{DATE()} for only the date.


Question 70:

Write suitable SQL query to: Convert all customer names from the Cust_Name column to lowercase in the Customer table.

Correct Answer: \texttt{SELECT LOWER(Cust\_Name) FROM Customer;}
View Solution




Step 1: Understanding the Concept:

Text manipulation in SQL is done using functions like \texttt{LOWER() or \texttt{LCASE() for lowercase and \texttt{UPPER() or \texttt{UCASE() for uppercase.


Step 2: Detailed Explanation:

To display the names in lowercase, we apply the \texttt{LOWER() function to the column \texttt{Cust_Name.


Step 3: Final Answer:

\texttt{SELECT LOWER(Cust_Name) FROM Customer;
Quick Tip: SQL is generally case-insensitive for keywords, but data within the database is case-sensitive. String functions help standardize it.


Question 71:

Write suitable SQL query to: Extract the first 4 characters from the City_Name column in Location table.

Correct Answer: \texttt{SELECT LEFT(City\_Name, 4) FROM Location;}
View Solution




Step 1: Understanding the Concept:

Substring extraction is used to retrieve a specific part of a string.


Step 2: Detailed Explanation:

- The \texttt{LEFT(string, n) function returns the leftmost \texttt{n characters from the string.

- Alternatively, \texttt{SUBSTR(City_Name, 1, 4) or \texttt{MID(City_Name, 1, 4) can be used.


Step 3: Final Answer:

\texttt{SELECT LEFT(City_Name, 4) FROM Location;
Quick Tip: In \texttt{SUBSTR(str, start, length)}, indexing starts from 1 in SQL.


Question 72:

Write suitable SQL query to: Display the name of the city from the CITY column in EVENT table, after removing leading spaces.

Correct Answer: \texttt{SELECT LTRIM(CITY) FROM EVENT;}
View Solution




Step 1: Understanding the Concept:

Trimming functions are used to remove unwanted whitespace characters from the beginning or end of strings.


Step 2: Detailed Explanation:

- \texttt{LTRIM() removes spaces from the Left (leading).

- \texttt{RTRIM() removes spaces from the Right (trailing).

- \texttt{TRIM() removes both.


Step 3: Final Answer:

\texttt{SELECT LTRIM(CITY) FROM EVENT;
Quick Tip: Always use \texttt{LTRIM} specifically if the question only mentions "leading spaces".


Question 73:

Write suitable SQL query to: To find the average salary from Salary column in Employees table.

Correct Answer: \texttt{SELECT AVG(Salary) FROM Employees;}
View Solution




Step 1: Understanding the Concept:

Aggregate functions like \texttt{SUM, \texttt{AVG, \texttt{COUNT, \texttt{MAX, and \texttt{MIN perform calculations on a set of values and return a single value.


Step 2: Detailed Explanation:

The \texttt{AVG() function calculates the arithmetic mean of the numeric values in a column.


Step 3: Final Answer:

\texttt{SELECT AVG(Salary) FROM Employees;
Quick Tip: Aggregate functions like \texttt{AVG} automatically ignore NULL values during calculation.


Question 74:

Write suitable SQL query for the following: To display the value of \(17^2\).

Correct Answer: \texttt{SELECT POWER(17, 2);}
View Solution




Step 1: Understanding the Concept:

Mathematical functions in SQL allow for numerical calculations directly in a query.


Step 2: Detailed Explanation:

- \texttt{POWER(base, exponent) calculates the result of the base raised to the power of the exponent.

- Alternatively, \texttt{SELECT 17 * 17; would also yield the correct result.


Step 3: Final Answer:

\texttt{SELECT POWER(17, 2);
Quick Tip: In some versions of SQL, \texttt{POW(17, 2)} is a shorter synonym for \texttt{POWER(17, 2)}.


Question 75:

Write suitable SQL query for the following: To display the day part of the dates in the Hire_Date column of the Employee table.

Correct Answer: \texttt{SELECT DAY(Hire\_Date) FROM Employee;}
View Solution




Step 1: Understanding the Concept:

The \texttt{DAY() function is a date function used to extract the day of the month (1-31) from a date.


Step 2: Detailed Explanation:

By applying \texttt{DAY(Hire_Date), the query retrieves just the numeric day portion for every record in the table.


Step 3: Final Answer:

\texttt{SELECT DAY(Hire_Date) FROM Employee;
Quick Tip: Use \texttt{DAYNAME()} if you want the name of the day (e.g., 'Monday') instead of the number.


Question 76:

Write suitable SQL query for the following: To display the maximum value of the Bill_Amount column in the Bill table.

Correct Answer: \texttt{SELECT MAX(Bill\_Amount) FROM Bill;}
View Solution




Step 1: Understanding the Concept:

The \texttt{MAX() aggregate function is used to find the highest value in a given column.


Step 2: Detailed Explanation:

It scans the entire \texttt{Bill_Amount column and returns the single largest value found.


Step 3: Final Answer:

\texttt{SELECT MAX(Bill_Amount) FROM Bill;
Quick Tip: \texttt{MAX()} works on strings (alphabetical order) and dates (latest date) as well as numbers.


Question 77:

Write suitable SQL query for the following: To remove leading and trailing spaces from the Location column in the Branch table.

Correct Answer: \texttt{SELECT TRIM(Location) FROM Branch;}
View Solution




Step 1: Understanding the Concept:

Cleaning data involves removing whitespace that might interfere with comparisons or display.


Step 2: Detailed Explanation:

The \texttt{TRIM() function handles both leading (start) and trailing (end) spaces simultaneously.


Step 3: Final Answer:

\texttt{SELECT TRIM(Location) FROM Branch;
Quick Tip: Leading spaces = \texttt{LTRIM}, Trailing spaces = \texttt{RTRIM}, Both = \texttt{TRIM}.


Question 78:

Write suitable SQL query for the following: To display total salary from tot_sal column in Employees table.

Correct Answer: \texttt{SELECT SUM(tot\_sal) FROM Employees;}
View Solution




Step 1: Understanding the Concept:

The summation of a column's values is achieved using the \texttt{SUM() aggregate function.


Step 2: Detailed Explanation:

The function adds together all the values in the \texttt{tot_sal column for every row that matches the query criteria (in this case, all rows).


Step 3: Final Answer:

\texttt{SELECT SUM(tot_sal) FROM Employees;
Quick Tip: Always use \texttt{SUM} for totals and \texttt{COUNT} for finding the number of items.

*The article might have information for the previous academic years, please refer the official website of the exam.

Ask your question

Subscribe To Our News Letter

Get Latest Notification Of Colleges, Exams and News

© 2026 Patronum Web Private Limited