Aimify IP Material
Class 12 · Practice sample paper

Class XII Informatics Practices (065): Practice Sample Paper 2025-26

Time: 3 hoursMaximum marks: 70Original Aimify paper in the CBSE pattern

General instructions

  1. This question paper contains 37 questions in five sections, A to E. All questions are compulsory.
  2. Section A has 21 questions of 1 mark each (multiple choice, including 2 Assertion-Reason questions).
  3. Section B has 7 very short answer questions of 2 marks each.
  4. Section C has 4 short answer questions of 3 marks each.
  5. Section D has 2 case-based questions of 4 marks each.
  6. Section E has 3 long answer questions of 5 marks each.
  7. There is no overall choice. Internal choices are given in some questions; attempt only one of the alternatives in such questions.
  8. All programming questions are to be answered in Python (pandas and Matplotlib) only. All SQL queries are to be written for MySQL.
Blueprint (unit-wise marks)
UnitMarks
Unit 1: Data Handling using Pandas and Data Visualization25
Unit 2: Database Query using SQL25
Unit 3: Introduction to Computer Networks10
Unit 4: Societal Impacts10
Total70

Section A

Questions 1 to 21 carry 1 mark each. Questions 20 and 21 are Assertion-Reason questions.

  1. 1 markPandas & Visualization

    Which statement creates a Series with the index ['a', 'b', 'c'] in which every value is 7? (Assume import pandas as pd.)

    1. pd.Series(7, index=['a', 'b', 'c'])
    2. pd.Series([7], ['a', 'b', 'c'], 3)
    3. pd.Series(index=7, data=['a', 'b', 'c'])
    4. pd.Series('a', 'b', 'c', 7)
    Marking scheme

    (a) pd.Series(7, index=['a', 'b', 'c'])

  2. 1 markPandas & Visualization

    What will be the output of the following code?

    Python
    import pandas as pd
    s = pd.Series([10, 20, 30, 40])
    print(s[s > 15].size)
    1. 2
    2. 4
    3. 1
    4. 3
    Marking scheme

    (d) 3

    s > 15 is True for 20, 30 and 40, so the filtered Series has 3 elements.

  3. 1 markPandas & Visualization

    Which attribute of a DataFrame df gives the number of rows and the number of columns?

    1. df.size
    2. df.ndim
    3. df.shape
    4. df.count
    Marking scheme

    (c) df.shape

  4. 1 markPandas & Visualization

    Which statement deletes the column Fine from the DataFrame df and returns the result?

    1. df.drop('Fine', axis=0)
    2. df.remove('Fine')
    3. df.delete(columns='Fine')
    4. df.drop(columns='Fine')
    Marking scheme

    (d) df.drop(columns='Fine')

  5. 1 markPandas & Visualization

    Which Matplotlib function draws a histogram?

    1. plt.bar()
    2. plt.hist()
    3. plt.plot()
    4. plt.histogram()
    Marking scheme

    (b) plt.hist()

  6. 1 markSQL

    What is the output of SELECT ROUND(476.582, -1);?

    1. 476.6
    2. 470
    3. 480
    4. 476.58
    Marking scheme

    (c) 480

    A negative position rounds to the left of the decimal point: to the nearest ten.

  7. 1 markSQL

    What is the output of SELECT INSTR('INFORMATICS', 'MAT');?

    1. 5
    2. 6
    3. 7
    4. 0
    Marking scheme

    (b) 6

  8. 1 markSQL

    Which function returns the name of the weekday, such as 'Monday', for a given date?

    1. DAY()
    2. MONTHNAME()
    3. DAYNAME()
    4. DATE()
    Marking scheme

    (c) DAYNAME()

  9. 1 markSQL

    The table EMP has 12 rows. The column Commission is NULL in 5 of them. What will SELECT COUNT(Commission) FROM EMP; return?

    1. 12
    2. 5
    3. 7
    4. 17
    Marking scheme

    (c) 7

  10. 1 markSQL

    Which clause is used to apply a condition on groups formed by GROUP BY?

    1. WHERE
    2. HAVING
    3. ORDER BY
    4. DISTINCT
    Marking scheme

    (b) HAVING

  11. 1 markSQL

    If neither ASC nor DESC is written, ORDER BY sorts the rows in:

    1. ascending order
    2. descending order
    3. the order of insertion
    4. random order
    Marking scheme

    (a) ascending order

  12. 1 markSQL

    What is the output of SELECT UPPER(LEFT('kolkata', 3));?

    1. kol
    2. KOL
    3. ATA
    4. KOLKATA
    Marking scheme

    (b) KOL

  13. 1 markSQL

    In an equi-join of two tables, rows are matched using which operator on the common column?

    1. >
    2. LIKE
    3. BETWEEN
    4. =
    Marking scheme

    (d) =

  14. 1 markNetworks

    Which device connects two networks that use different protocols?

    1. Hub
    2. Repeater
    3. Gateway
    4. Switch
    Marking scheme

    (c) Gateway

  15. 1 markNetworks

    A cable TV network spread across a city is an example of a:

    1. PAN
    2. LAN
    3. MAN
    4. WAN
    Marking scheme

    (c) MAN

  16. 1 markNetworks

    A small text file that a website stores on the user's computer to remember the user's preferences is called a:

    1. plug-in
    2. cookie
    3. add-on
    4. web page
    Marking scheme

    (b) cookie

  17. 1 markSocietal Impacts

    The posts, comments and photos that a person knowingly shares online form their:

    1. passive digital footprint
    2. active digital footprint
    3. copyright
    4. digital licence
    Marking scheme

    (b) active digital footprint

  18. 1 markSocietal Impacts

    Which of the following is an example of Free and Open Source Software (FOSS)?

    1. Microsoft Windows
    2. Adobe Photoshop
    3. LibreOffice
    4. WhatsApp
    Marking scheme

    (c) LibreOffice

  19. 1 markSocietal Impacts

    Sending fake emails that look as if they come from a bank, to trick people into revealing their passwords, is called:

    1. phishing
    2. plagiarism
    3. cyber bullying
    4. e-waste
    Marking scheme

    (a) phishing

  20. 1 markPandas & Visualization

    Assertion (A): For a DataFrame df with row labels R1 to R5, df.loc['R1':'R3'] includes the row R3.

    Reason (R): In label-based slicing with loc, the end label is included in the result.

    1. Both A and R are true, and R 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.
    Marking scheme

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

    With iloc (positions), the end would be excluded.

  21. 1 markSQL

    Assertion (A): SELECT AVG(Marks) FROM STUDENT; ignores the rows in which Marks is NULL.

    Reason (R): COUNT(*) also ignores the rows that contain NULL values.

    1. Both A and R are true, and R 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.
    Marking scheme

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

    Aggregate functions on a column skip NULLs, but COUNT(*) counts every row.

Section B

Questions 22 to 28 are very short answer questions carrying 2 marks each. Questions 22 and 24 have an internal choice.

  1. 2 marksPandas & Visualization

    Write two differences between a Series and a DataFrame.

    Marking scheme

    Any two (1 mark each):

    • A Series is one-dimensional; a DataFrame is two-dimensional (rows and columns).
    • A Series holds data of a single type; different columns of a DataFrame can have different types.
    • A Series is value-mutable but size-immutable; a DataFrame is both value-mutable and size-mutable (columns and rows can be added or deleted).
    • A Series has only a row index; a DataFrame has a row index and column labels.
    OR

    What is the use of the head() and tail() functions? Write a statement to display the last 3 rows of a DataFrame df.

    Marking scheme
    • head(n) returns the first n rows and tail(n) returns the last n rows; n is 5 by default. (1 mark)
    • print(df.tail(3)) (1 mark)
  2. 2 marksPandas & Visualization

    Write the output of the following code:

    Python
    import pandas as pd
    s1 = pd.Series([5, 10, 15], index=['x', 'y', 'z'])
    s2 = pd.Series([1, 2, 3], index=['y', 'z', 'w'])
    print(s1 + s2)
    Marking scheme

    Labels are matched; labels present in only one Series give NaN, and the result is sorted by label. ½ mark for each correct line (4 lines); deduct ½ if the dtype line is missing.

    Python
    import pandas as pd
    s1 = pd.Series([5, 10, 15], index=['x', 'y', 'z'])
    s2 = pd.Series([1, 2, 3], index=['y', 'z', 'w'])
    print(s1 + s2)
    Output
    w     NaN
    x     NaN
    y    11.0
    z    17.0
    dtype: float64
  3. 2 marksSQL

    Differentiate between the WHERE and HAVING clauses with an example of each.

    Marking scheme
    • WHERE applies a condition to individual rows before grouping, e.g. SELECT * FROM EMPLOYEE WHERE Salary > 600000;
    • HAVING applies a condition to groups after GROUP BY and can use aggregate functions, e.g. SELECT Dept, AVG(Salary) FROM EMPLOYEE GROUP BY Dept HAVING COUNT(*) > 1;

    1 mark for the difference, ½ mark for each example.

    OR

    Differentiate between COUNT(*) and COUNT(column_name) with an example.

    Marking scheme
    • COUNT(*) counts all the rows, including those with NULL values.
    • COUNT(column) counts only the rows in which that column is not NULL.
    • Example: if 3 of 10 students have no Marks, COUNT(*) gives 10 and COUNT(Marks) gives 7.

    1 mark for the difference, 1 mark for the example.

  4. 2 marksSQL

    Write the output of the following SQL statements:

    1. SELECT MID('INFORMATICS PRACTICES', 3, 4);
    2. SELECT POWER(3, 3) - MOD(17, 5);
    3. SELECT MONTHNAME('2025-03-21');
    4. SELECT DAY('2025-03-21');
    Marking scheme
    1. FORM 2. 25 (27 - 2) 3. March 4. 21

    ½ mark for each correct output. Verified run:

    MySQL
    SELECT MID('INFORMATICS PRACTICES', 3, 4);
    SELECT POWER(3, 3) - MOD(17, 5);
    SELECT MONTHNAME('2025-03-21');
    SELECT DAY('2025-03-21');
    Output
    +------------------------------------+
    | MID('INFORMATICS PRACTICES', 3, 4) |
    +------------------------------------+
    | FORM                               |
    +------------------------------------+
    1 row in set
    
    +--------------------------+
    | POWER(3, 3) - MOD(17, 5) |
    +--------------------------+
    |                       25 |
    +--------------------------+
    1 row in set
    
    +-------------------------+
    | MONTHNAME('2025-03-21') |
    +-------------------------+
    | March                   |
    +-------------------------+
    1 row in set
    
    +-------------------+
    | DAY('2025-03-21') |
    +-------------------+
    |                21 |
    +-------------------+
    1 row in set
  5. 2 marksNetworks

    Write two differences between a hub and a switch.

    Marking scheme

    Any two (1 mark each):

    • A hub sends incoming data to all the devices connected to it; a switch sends data only to the device it is meant for, using MAC addresses.
    • A hub creates more unnecessary traffic and collisions; a switch reduces traffic, so the network is faster.
    • A hub is a simple (passive/less intelligent) device; a switch is an intelligent device that learns the addresses of connected devices.
  6. 2 marksSocietal Impacts

    What is e-waste? Write two ways in which e-waste can be managed properly.

    Marking scheme
    • E-waste is discarded electronic and electrical equipment, such as old mobile phones, computers, batteries and chargers. (1 mark)
    • Any two ways (½ mark each): give it to authorised e-waste collection or recycling centres; return old devices through the manufacturer's take-back scheme; repair, reuse or donate working devices; reduce purchases by upgrading instead of replacing.
  7. 2 marksSocietal Impacts

    What is plagiarism? Write two ways in which students can avoid plagiarism while preparing their IP project.

    Marking scheme
    • Plagiarism is presenting someone else's work, words, ideas or code as one's own without giving them credit. (1 mark)
    • Any two ways (½ mark each): cite every source of data, images and code used; write explanations in your own words; use quotation marks for copied text; use only material whose licence allows reuse and acknowledge it.

Section C

Questions 29 to 32 are short answer questions carrying 3 marks each. Question 30 has an internal choice.

  1. 3 marksPandas & Visualization

    A city corporation has the following data about its four zones:

    • North: population 245000, area 18.5 sq km
    • South: population 310000, area 22.0 sq km
    • East: population 128000, area 15.2 sq km
    • West: population 196000, area 9.8 sq km

    Write a Python program to:

    1. create a DataFrame from a list of dictionaries holding this data,
    2. add a column Density (population divided by area, rounded to 1 decimal place), and
    3. display the zones whose density is more than 14000 persons per sq km.
    Marking scheme

    1 mark for each part.

    Python
    import pandas as pd
    
    data = [{"Zone": "North", "Population": 245000, "Area": 18.5},
            {"Zone": "South", "Population": 310000, "Area": 22.0},
            {"Zone": "East", "Population": 128000, "Area": 15.2},
            {"Zone": "West", "Population": 196000, "Area": 9.8}]
    df = pd.DataFrame(data)
    df["Density"] = (df["Population"] / df["Area"]).round(1)
    print(df)
    print(df[df["Density"] > 14000])
    Output
        Zone  Population  Area  Density
    0  North      245000  18.5  13243.2
    1  South      310000  22.0  14090.9
    2   East      128000  15.2   8421.1
    3   West      196000   9.8  20000.0
        Zone  Population  Area  Density
    1  South      310000  22.0  14090.9
    3   West      196000   9.8  20000.0
  2. 3 marksPandas & Visualization

    The number of Class XII students who chose each elective is: IP 48, Economics 36, Psychology 22, Fine Arts 15, PE 30. Write Python code to draw a bar chart of this data with the title "Students in Each Elective" and suitable axis labels, and save the chart as electives.png.

    Marking scheme

    ½ mark for importing pyplot, ½ mark for the lists, 1 mark for plt.bar(), ½ mark for title and labels, ½ mark for savefig(). The chart shows five teal bars, the tallest for IP (48) and the shortest for Fine Arts (15).

    Python
    import matplotlib.pyplot as plt
    
    electives = ["IP", "Economics", "Psychology", "Fine Arts", "PE"]
    students = [48, 36, 22, 15, 30]
    plt.bar(electives, students, color="teal")
    plt.title("Students in Each Elective")
    plt.xlabel("Elective")
    plt.ylabel("Number of students")
    plt.savefig("electives.png")
    plt.show()
    OR

    A canteen sold the following cups of tea and coffee in five weeks: Tea 320, 410, 380, 450, 500 and Coffee 210, 260, 300, 280, 350 (weeks W1 to W5). Write Python code to plot both on one line chart with markers, a title, axis labels and a legend.

    Marking scheme

    ½ mark for the import, ½ mark for the data, 1 mark for two plot() calls with labels, ½ mark for title and axis labels, ½ mark for legend(). Two rising lines are drawn; Tea stays above Coffee in every week.

    Python
    import matplotlib.pyplot as plt
    
    weeks = ["W1", "W2", "W3", "W4", "W5"]
    tea = [320, 410, 380, 450, 500]
    coffee = [210, 260, 300, 280, 350]
    plt.plot(weeks, tea, marker="o", label="Tea")
    plt.plot(weeks, coffee, marker="s", label="Coffee")
    plt.title("Weekly Sales of a Canteen")
    plt.xlabel("Week")
    plt.ylabel("Cups sold")
    plt.legend()
    plt.show()
  3. 3 marksSQL

    Consider the table PRODUCT given below and write the output of the following queries:

    1. SELECT Category, COUNT(*), SUM(Qty) FROM PRODUCT GROUP BY Category;
    2. SELECT UPPER(PName), ROUND(Price / 3, 1) FROM PRODUCT WHERE Price > 1000;
    3. SELECT PName, MONTHNAME(MfgDate) FROM PRODUCT WHERE YEAR(MfgDate) = 2024;
    PCodePNameCategoryPriceQtyMfgDate
    P01Steel BottleKitchen450402024-11-05
    P02Desk LampElectrical1299152025-01-18
    P03Lunch BoxKitchen380552024-08-22
    P04Extension CordElectrical649302025-03-02
    P05Room HeaterElectrical245082024-10-14
    P06Pressure CookerKitchen1875122025-02-27
    Marking scheme

    1 mark for each correct output (column headings need not be exact; ½ mark if one row is wrong).

    MySQL
    SELECT Category, COUNT(*), SUM(Qty) FROM PRODUCT GROUP BY Category;
    SELECT UPPER(PName), ROUND(Price / 3, 1) FROM PRODUCT WHERE Price > 1000;
    SELECT PName, MONTHNAME(MfgDate) FROM PRODUCT WHERE YEAR(MfgDate) = 2024;
    Output
    +------------+----------+----------+
    | Category   | COUNT(*) | SUM(Qty) |
    +------------+----------+----------+
    | Electrical |        3 |       53 |
    | Kitchen    |        3 |      107 |
    +------------+----------+----------+
    2 rows in set
    
    +-----------------+---------------------+
    | UPPER(PName)    | ROUND(Price / 3, 1) |
    +-----------------+---------------------+
    | DESK LAMP       |               433.0 |
    | ROOM HEATER     |               816.7 |
    | PRESSURE COOKER |               625.0 |
    +-----------------+---------------------+
    3 rows in set
    
    +--------------+--------------------+
    | PName        | MONTHNAME(MfgDate) |
    +--------------+--------------------+
    | Steel Bottle | November           |
    | Lunch Box    | August             |
    | Room Heater  | October            |
    +--------------+--------------------+
    3 rows in set
  4. 3 marksSocietal Impacts

    Tanvi, a Class XI student, keeps receiving insulting messages about her appearance on a social media group, and an embarrassing edited photo of her has been shared there.

    1. Name the cybercrime she is facing.
    2. Name the Indian law that deals with cybercrime.
    3. Write two steps Tanvi should take.
    Marking scheme
    1. Cyber bullying (harassing, insulting or humiliating someone using digital platforms). (1 mark)
    2. The Information Technology Act, 2000 (IT Act). (1 mark)
    3. Any two (½ mark each): do not reply to the bullies; take screenshots and keep the evidence; report and block the accounts on the platform; tell her parents or teachers; report the matter at the national cybercrime portal (cybercrime.gov.in) or the cyber police.

Section D

Questions 33 and 34 are case-based questions carrying 4 marks each.

  1. 4 marksPandas & Visualization

    The DataFrame lib stores the issue record of a school library (row labels L1 to L5):

    Answer the following:

    1. Write a statement to display the rows of the books issued more than 50 times.
    2. Write a statement to add a column PerCopy that gives the number of issues per copy (Issued divided by Copies).
    3. After part 2, what will print(lib.shape) and print(lib.iloc[1:3, 2:4]) display?
    4. Write a statement to save lib to the file library.csv without the row labels.
    TitleGenreIssuedCopies
    L1Ruskin Bond StoriesFiction6410
    L2Wings of FireBiography486
    L3PanchatantraFiction7212
    L4Physics Made EasyAcademic358
    L5GitanjaliPoetry214
    Marking scheme

    1 mark for each part (in part 3, ½ mark for each output). The statements run in order give:

    Python
    import pandas as pd
    
    lib = pd.DataFrame({"Title": ["Ruskin Bond Stories", "Wings of Fire", "Panchatantra",
                                  "Physics Made Easy", "Gitanjali"],
                        "Genre": ["Fiction", "Biography", "Fiction", "Academic", "Poetry"],
                        "Issued": [64, 48, 72, 35, 21],
                        "Copies": [10, 6, 12, 8, 4]},
                       index=["L1", "L2", "L3", "L4", "L5"])
    
    print(lib[lib["Issued"] > 50])                      # (i)
    lib["PerCopy"] = lib["Issued"] / lib["Copies"]      # (ii)
    print(lib.shape)                                    # (iii)
    print(lib.iloc[1:3, 2:4])
    lib.to_csv("library.csv", index=False)              # (iv)
    Output
                      Title    Genre  Issued  Copies
    L1  Ruskin Bond Stories  Fiction      64      10
    L3         Panchatantra  Fiction      72      12
    (5, 5)
        Issued  Copies
    L2      48       6
    L3      72      12
  2. 4 marksSQL

    A hospital stores data in two tables, DOCTOR(DocID, DName, Dept) and APPOINTMENT(AppID, DocID, Patient, Fee, ADate), shown below. Write SQL queries for the following:

    1. Display the name of each patient with the name of the doctor they consulted.
    2. Display each department with the total fee collected in it.
    3. Display the DocID and number of appointments of the doctors who have more than one appointment.
    4. Display the patient name and date of the appointments in March, in order of date.

    Table DOCTOR: 1 Dr. Neha Arora (ENT); 2 Dr. Sameer Khan (Cardiology); 3 Dr. Priya Menon (ENT); 4 Dr. Rakesh Bhalla (Orthopaedics).

    AppIDDocIDPatientFeeADate
    9012Kiran Joshi8002025-03-04
    9021Asif Ali5002025-02-26
    9032Meera Pillai8002025-03-11
    9044Tenzin Norbu6502025-03-15
    9053Rupa Sen5002025-04-02
    9062Gopal Rao8002025-04-09
    9071Harsh Vardhan5002025-03-21
    Marking scheme

    1 mark for each correct query. Outputs are shown for checking. (Dr. Rakesh Bhalla's department appears in part 2 because he has an appointment; a doctor with none would not appear in an equi-join.)

    MySQL
    SELECT A.Patient, D.DName
    FROM APPOINTMENT A, DOCTOR D
    WHERE A.DocID = D.DocID;
    SELECT D.Dept, SUM(A.Fee) AS TotalFee
    FROM APPOINTMENT A, DOCTOR D
    WHERE A.DocID = D.DocID
    GROUP BY D.Dept;
    SELECT DocID, COUNT(*) AS Visits
    FROM APPOINTMENT
    GROUP BY DocID
    HAVING COUNT(*) > 1;
    SELECT Patient, ADate FROM APPOINTMENT
    WHERE MONTH(ADate) = 3
    ORDER BY ADate;
    Output
    +---------------+-------------------+
    | Patient       | DName             |
    +---------------+-------------------+
    | Kiran Joshi   | Dr. Sameer Khan   |
    | Asif Ali      | Dr. Neha Arora    |
    | Meera Pillai  | Dr. Sameer Khan   |
    | Tenzin Norbu  | Dr. Rakesh Bhalla |
    | Rupa Sen      | Dr. Priya Menon   |
    | Gopal Rao     | Dr. Sameer Khan   |
    | Harsh Vardhan | Dr. Neha Arora    |
    +---------------+-------------------+
    7 rows in set
    
    +--------------+----------+
    | Dept         | TotalFee |
    +--------------+----------+
    | Cardiology   |     2400 |
    | ENT          |     1500 |
    | Orthopaedics |      650 |
    +--------------+----------+
    3 rows in set
    
    +-------+--------+
    | DocID | Visits |
    +-------+--------+
    |     1 |      2 |
    |     2 |      3 |
    +-------+--------+
    2 rows in set
    
    +---------------+------------+
    | Patient       | ADate      |
    +---------------+------------+
    | Kiran Joshi   | 2025-03-04 |
    | Meera Pillai  | 2025-03-11 |
    | Tenzin Norbu  | 2025-03-15 |
    | Harsh Vardhan | 2025-03-21 |
    +---------------+------------+
    4 rows in set

Section E

Questions 35 to 37 are long answer questions carrying 5 marks each. Question 35 has an internal choice.

  1. 5 marksPandas & Visualization

    The sales (in lakh rupees) of six sales representatives in two quarters are:

    • S1: Aman, North, Q1 52, Q2 49
    • S2: Bela, South, Q1 61, Q2 70
    • S3: Chirag, North, Q1 47, Q2 55
    • S4: Disha, East, Q1 58, Q2 62
    • S5: Eshwar, South, Q1 44, Q2 51
    • S6: Farida, East, Q1 66, Q2 59

    Write Python statements to:

    1. create a DataFrame sales with columns Rep, Region, Q1 and Q2 and row labels S1 to S6;
    2. add a column Total (Q1 + Q2);
    3. display the Rep and Total of the representatives whose total is more than 115;
    4. display the region-wise sum of Q1 and Q2;
    5. display the Rep and Region of rows S2 to S4 using loc.
    Marking scheme

    1 mark for each part. Output of the statements run in order:

    Python
    import pandas as pd
    
    sales = pd.DataFrame({"Rep": ["Aman", "Bela", "Chirag", "Disha", "Eshwar", "Farida"],
                          "Region": ["North", "South", "North", "East", "South", "East"],
                          "Q1": [52, 61, 47, 58, 44, 66],
                          "Q2": [49, 70, 55, 62, 51, 59]},
                         index=["S1", "S2", "S3", "S4", "S5", "S6"])    # (i)
    sales["Total"] = sales["Q1"] + sales["Q2"]                         # (ii)
    print(sales.loc[sales["Total"] > 115, ["Rep", "Total"]])           # (iii)
    print(sales.groupby("Region")[["Q1", "Q2"]].sum())                 # (iv)
    print(sales.loc["S2":"S4", ["Rep", "Region"]])                     # (v)
    Output
           Rep  Total
    S2    Bela    131
    S4   Disha    120
    S6  Farida    125
             Q1   Q2
    Region          
    East    124  121
    North    99  104
    South   105  121
           Rep Region
    S2    Bela  South
    S3  Chirag  North
    S4   Disha   East
    OR

    The maximum temperatures (in degrees Celsius) of a city for a week are Mon 39.5, Tue 41.2, Wed 42.8, Thu 40.1, Fri 38.7, Sat 43.0 and Sun 41.6. Write Python statements to:

    1. create a Series temp with the days as the index;
    2. display the days with temperature above 41;
    3. display the temperatures of the last three days;
    4. display all the temperatures in Fahrenheit (F = C x 9 / 5 + 32);
    5. display the average temperature rounded to one decimal place.
    Marking scheme

    1 mark for each part. Output of the statements run in order:

    Python
    import pandas as pd
    
    temp = pd.Series([39.5, 41.2, 42.8, 40.1, 38.7, 43.0, 41.6],
                     index=["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"])   # (i)
    print(temp[temp > 41])                  # (ii)
    print(temp.tail(3))                     # (iii)
    print(temp * 9 / 5 + 32)                # (iv)
    print(round(temp.mean(), 1))            # (v)
    Output
    Tue    41.2
    Wed    42.8
    Sat    43.0
    Sun    41.6
    dtype: float64
    Fri    38.7
    Sat    43.0
    Sun    41.6
    dtype: float64
    Mon    103.10
    Tue    106.16
    Wed    109.04
    Thu    104.18
    Fri    101.66
    Sat    109.40
    Sun    106.88
    dtype: float64
    41.0
  2. 5 marksSQL

    Consider the table EMPLOYEE given below (Salary is the yearly salary in rupees). Write SQL queries for the following:

    1. Display, in capital letters, the names of the employees who joined in 2023.
    2. Display each department and its average salary, only for departments having more than one employee.
    3. Display the name of each employee and the first three letters of their city.
    4. Display the name and monthly salary (Salary / 12) of each employee, rounded to 2 decimal places.
    5. Display the name and the weekday of joining of the IT employees, in order of date of joining.
    EmpIDNameDeptSalaryDOJCity
    1Ankit SaxenaIT7200002022-07-11Noida
    2Bina ThapaHR5400002023-02-01Dehradun
    3Cyril D'SouzaIT8600002021-09-15Mangaluru
    4Divya KulkarniFinance6100002023-08-21Nashik
    5Ejaz AhmedIT6550002023-11-06Srinagar
    6Fiona LoboHR4980002024-01-15Panaji
    Marking scheme

    1 mark for each correct query. Outputs are shown for checking.

    MySQL
    SELECT UPPER(Name) FROM EMPLOYEE WHERE YEAR(DOJ) = 2023;
    SELECT Dept, AVG(Salary) FROM EMPLOYEE
    GROUP BY Dept HAVING COUNT(*) > 1;
    SELECT Name, LEFT(City, 3) FROM EMPLOYEE;
    SELECT Name, ROUND(Salary / 12, 2) AS Monthly FROM EMPLOYEE;
    SELECT Name, DAYNAME(DOJ) FROM EMPLOYEE
    WHERE Dept = 'IT' ORDER BY DOJ;
    Output
    +----------------+
    | UPPER(Name)    |
    +----------------+
    | BINA THAPA     |
    | DIVYA KULKARNI |
    | EJAZ AHMED     |
    +----------------+
    3 rows in set
    
    +------+-------------+
    | Dept | AVG(Salary) |
    +------+-------------+
    | HR   | 519000.0000 |
    | IT   | 745000.0000 |
    +------+-------------+
    2 rows in set
    
    +----------------+---------------+
    | Name           | LEFT(City, 3) |
    +----------------+---------------+
    | Ankit Saxena   | Noi           |
    | Bina Thapa     | Deh           |
    | Cyril D'Souza  | Man           |
    | Divya Kulkarni | Nas           |
    | Ejaz Ahmed     | Sri           |
    | Fiona Lobo     | Pan           |
    +----------------+---------------+
    6 rows in set
    
    +----------------+----------+
    | Name           | Monthly  |
    +----------------+----------+
    | Ankit Saxena   | 60000.00 |
    | Bina Thapa     | 45000.00 |
    | Cyril D'Souza  | 71666.67 |
    | Divya Kulkarni | 50833.33 |
    | Ejaz Ahmed     | 54583.33 |
    | Fiona Lobo     | 41500.00 |
    +----------------+----------+
    6 rows in set
    
    +---------------+--------------+
    | Name          | DAYNAME(DOJ) |
    +---------------+--------------+
    | Cyril D'Souza | Wednesday    |
    | Ankit Saxena  | Monday       |
    | Ejaz Ahmed    | Monday       |
    +---------------+--------------+
    3 rows in set
  3. 5 marksNetworks

    Gyan Path Vidyalaya in Dehradun is setting up a computer network in its campus, which has four blocks: Admin, Senior, Junior and Lab. The number of computers in each block is: Admin 25, Senior 60, Junior 40 and Lab 110. The distances between the blocks are given in the table.

    1. Suggest the most suitable block to place the server, with a reason.
    2. Suggest the best cable layout (topology) to connect the blocks, and describe it.
    3. Where should repeaters be placed in your layout? Why?
    4. Which device should be used to connect all the computers inside each block?
    5. The school wants to link this campus network with its head office in Mumbai. What type of network will this form?
    FromToDistance (m)
    AdminSenior90
    AdminJunior140
    AdminLab70
    SeniorJunior60
    SeniorLab120
    JuniorLab150
    Marking scheme
    1. Lab, because it has the largest number of computers (110), so most traffic stays within the block (80-20 rule). (1 mark)
    2. A star layout with the Lab block at the centre: separate cables from Lab to Admin (70 m), Lab to Senior (120 m) and Lab to Junior (150 m). (1 mark; ½ mark if a reasonable layout is drawn without the server block at the centre)
    3. On the Lab-Senior and Lab-Junior links, because these cables are longer than about 100 m and the signal weakens over such distances; a repeater regenerates it. (1 mark)
    4. A switch (a hub is acceptable for ½ mark). (1 mark)
    5. A WAN (Wide Area Network), since Dehradun and Mumbai are in different cities. (1 mark)