Skip to content
Exercises · Q15

Q.Conduct a class census by preparing a questionnaire. The questionnaire should contain a minimum of five questions. Questions should relate to students, their family members, their class performance, their health etc. Each student is required to fill up the questionnaire. Compile the information in numerical terms (in terms of percentage). Present the information through a bar, scatter–diagram. (NCERT Geography class IX, Page 60)

Odisha ChseTextbookSubjective· 4mImportance★★★★★
82% · 36/44 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

This solution outlines how to conduct a class census by designing a questionnaire, collecting simulated data, compiling it into percentages, and then visualizing this information using Python with Matplotlib and Seaborn to create a bar chart and a scatter diagram.

To conduct a class census and present the findings visually, we first need to define what information we want to collect. This involves designing a questionnaire with relevant questions. Once data is collected, it needs to be processed, typically by converting raw counts into percentages for easier comparison and understanding. Finally, data visualization tools are used to create graphical representations that highlight patterns and insights.

1. Designing the Questionnaire

The goal is to gather diverse information about students, their families, academic performance, and health. The questions should be clear, unambiguous, and designed to elicit quantifiable responses. Here's a sample questionnaire with more than five questions, covering the specified areas:


Class Census Questionnaire

Please provide accurate information. Your responses will be kept confidential and used only for statistical analysis.

  1. Student Information:
    • What is your current age (in years)? _____
  2. Family Information:
    • How many members are there in your immediate family (parents, siblings, and yourself)? _____
  3. Class Performance:
    • What was your percentage score in the last Mathematics unit test? _____ %
  4. Health Information:
    • On average, how many hours do you sleep per night? _____ hours
  5. Extracurricular Activities:
    • Which of the following extracurricular activities do you participate in most frequently? (Please tick one)
      • Sports
      • Music/Dance
      • Art/Craft
      • Debating/Quizzing
      • None
  6. Study Habits:
    • On average, how many hours do you spend studying daily outside of school hours? _____ hours

2. Data Collection and Compilation

After distributing the questionnaire, each student fills it out. The responses are then compiled into a structured format, such as a spreadsheet or a database. For demonstration purposes, we will simulate data for 15 students using a Pandas DataFrame in Python.

The next step is to compile this information numerically, specifically in terms of percentages. This involves calculating the proportion of students falling into different categories or ranges for each question.

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

# Set a style for the plots for better aesthetics
sns.set_style("whitegrid")

# Simulate data for 15 students based on the questionnaire
data = {
    'Student_ID': range(1, 16),
    'Age': [16, 17, 16, 17, 16, 18, 17, 16, 17, 16, 18, 17, 16, 17, 16],
    'Family_Members': [4, 5, 3, 4, 4, 6, 3, 5, 4, 3, 5, 4, 4, 3, 5],
    'Math_Score': [75, 88, 62, 91, 78, 55, 85, 70, 95, 68, 80, 72, 83, 60, 90],
    'Sleep_Hours': [7, 6, 8, 7, 7, 5, 8, 6, 7, 8, 6, 7, 7, 6, 8],
    'Extracurricular': ['Sports', 'Music/Dance', 'None', 'Debating/Quizzing', 'Sports',
                        'None', 'Art/Craft', 'Sports', 'Music/Dance', 'Debating/Quizzing',
                        'Art/Craft', 'Sports', 'Music/Dance', 'None', 'Debating/Quizzing'],
    'Study_Hours_Daily': [3, 4, 2, 5, 3, 1, 4, 2, 5, 3, 4, 2, 3, 1, 4]
}

df = pd.DataFrame(data)

print("Simulated Class Census Data:")
print(df)
print("\n" + "="*50 + "\n")

# Compile information in numerical terms (percentages)
print("Compiled Information (Percentages):")

# Percentage of students in each extracurricular activity
extracurricular_counts = df['Extracurricular'].value_counts()
extracurricular_percentages = (extracurricular_counts / len(df)) * 100
print("\nPercentage of students in each Extracurricular Activity:")
print(extracurricular_percentages.to_string()) # .to_string() for better display
print("\n" + "="*50 + "\n")

# Percentage of students by Age group (example for numerical data)
age_bins = [15, 16, 17, 18, 19] # Define age groups
age_labels = ['16 years', '17 years', '18 years']
df['Age_Group'] = pd.cut(df['Age'], bins=age_bins, labels=age_labels, right=False)
age_group_counts = df['Age_Group'].value_counts().sort_index()
age_group_percentages = (age_group_counts / len(df)) * 100
print("Percentage of students by Age Group:")
print(age_group_percentages.to_string())
print("\n" + "="*50 + "\n")

# Percentage of students by Sleep Hours (example for numerical data)
sleep_bins = [4, 6, 7, 8, 9] # Define sleep hour groups
sleep_labels = ['< 6 hours', '6-7 hours', '7-8 hours', '> 8 hours']
df['Sleep_Group'] = pd.cut(df['Sleep_Hours'], bins=sleep_bins, labels=sleep_labels, right=False)
sleep_group_counts = df['Sleep_Group'].value_counts().sort_index()
sleep_group_percentages = (sleep_group_counts / len(df)) * 100
print("Percentage of students by Sleep Hours Group:")
print(sleep_group_percentages.to_string())
print("\n" + "="*50 + "\n")
Simulated Class Census Data:
    Student_ID  Age  Family_Members  Math_Score  Sleep_Hours    Extracurricular  Study_Hours_Daily
0            1   16               4          75            7             Sports                  3
1            2   17               5          88            6        Music/Dance                  4
2            3   16               3          62            8               None                  2
3            4   17               4          91            7  Debating/Quizzing                  5
4            5   16               4          78            7             Sports                  3
5            6   18               6          55            5               None                  1
6            7   17               3          85            8        Art/Craft                  4
7            8   16               5          70            6             Sports                  2
8            9   17               4          95            7        Music/Dance                  5
9           10   16               3          68            8  Debating/Quizzing                  3
10          11   18               5          80            6        Art/Craft                  4
11          12   17               4          72            7             Sports                  2
12          13   16               4          83            7        Music/Dance                  3
13          14   17               3          60            6               None                  1
14          15   16               5          90            8  Debating/Quizzing                  4

==================================================

Compiled Information (Percentages):

Percentage of students in each Extracurricular Activity:
Extracurricular
Sports               26.666667
Debating/Quizzing    26.666667
Music/Dance          20.000000
None                 20.000000
Art/Craft            13.333333

==================================================

Percentage of students by Age Group:
Age_Group
16 years    46.666667
17 years    40.000000
18 years    13.333333

==================================================

Percentage of students by Sleep Hours Group:
Sleep_Group
< 6 hours     6.666667
6-7 hours    33.333333
7-8 hours    46.666667
> 8 hours    13.333333

==================================================

Explanation of Key Lines:

  • import pandas as pd, import matplotlib.pyplot as plt, import seaborn as sns: These lines import the necessary libraries for data manipulation (Pandas) and plotting (Matplotlib, Seaborn).
  • sns.set_style("whitegrid"): This sets a predefined aesthetic style for the plots, making them visually appealing.
  • data = {...} and df = pd.DataFrame(data): This creates a dictionary of lists, which is then converted into a Pandas DataFrame. A DataFrame is a tabular data structure, ideal for storing and manipulating census data.
  • df['Extracurricular'].value_counts(): This method counts the occurrences of each unique value in the 'Extracurricular' column.
  • (extracurricular_counts / len(df)) * 100: This calculates the percentage for each category by dividing its count by the total number of students (len(df)) and multiplying by 100.
  • pd.cut(df['Age'], bins=age_bins, labels=age_labels, right=False): This function is used to segment numerical data (like 'Age' or 'Sleep_Hours') into discrete bins or intervals. bins defines the boundaries, labels provides names for these bins, and right=False means the interval includes the left boundary but not the right. This is crucial for converting continuous numerical data into categories suitable for percentage calculation and bar charts.

3. Presenting Information through Diagrams

Data visualization helps in understanding the compiled information quickly. We will use a bar chart for categorical data (Extracurricular Activities) and a scatter diagram for showing the relationship between two numerical variables (e.g., Math Score vs. Study Hours).

# --- Bar Chart: Percentage of students in each Extracurricular Activity ---
plt.figure(figsize=(10, 6)) # Set the figure size for better readability
sns.barplot(x=extracurricular_percentages.index, y=extracurricular_percentages.values, palette='viridis')

# Add labels and title
plt.title('Percentage of Students by Extracurricular Activity', fontsize=16)
plt.xlabel('Extracurricular Activity', fontsize=12)
plt.ylabel('Percentage (%)', fontsize=12)
plt.xticks(rotation=45, ha='right') # Rotate x-axis labels for better fit
plt.ylim(0, 100) # Ensure y-axis goes up to 100%

# Add percentage values on top of bars
for index, value in enumerate(extracurricular_percentages.values):
    plt.text(index, value + 1, f'{value:.1f}%', ha='center', va='bottom')

plt.tight_layout() # Adjust layout to prevent labels from overlapping
plt.show()

# --- Scatter Diagram: Math Score vs. Study Hours Daily ---
plt.figure(figsize=(10, 6))
sns.scatterplot(x='Study_Hours_Daily', y='Math_Score', data=df, hue='Age', size='Family_Members', sizes=(50, 500), palette='coolwarm', legend='full')

# Add labels and title
plt.title('Relationship between Math Score and Daily Study Hours', fontsize=16)
plt.xlabel('Daily Study Hours (excluding school)', fontsize=12)
plt.ylabel('Mathematics Test Score (%)', fontsize=12)

# Add annotations for individual points (optional, for detailed analysis)
# for i, row in df.iterrows():
#     plt.text(row['Study_Hours_Daily'] + 0.1, row['Math_Score'], f"ID:{row['Student_ID']}", fontsize=9)

plt.grid(True, linestyle='--', alpha=0.7) # Add a grid for easier reading
plt.tight_layout()
plt.show()

Description of Plots: …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.