Grade 10
Modular Programming
February 17, 2026 · 4 Programs

📚 Modular Programming Important Question SEE

Q1. Write a program in Q-BASIC to accept the length, breadth, and height of the room. Create a subprogram to calculate the volume, and a function to find the area of the room. 

Q2. Write a program in Q-BASIC to accept three numbers. Create a subprogram to find the smallest, and a function to find the largest number among them.                  

Q3. Write a program in Q-BASIC to accept the radius of a circle and create a subprogram to calculate the area, and a function to find the circumference of a circle.        

Q4. Write a program in Q-BASIC to accept three strings, create a subprogram to find the longest string, and a function to find the shortest string.

Question no 1 Solution

Rem Write a program in Q-BASIC to accept the length, breadth, and height of the room. Create a subprogram to calculate the volume, and a function to find the area of the room.
Cls
Input "Enter the value of length:", l
Input "Enter the value of breadth:", b
Input "Enter the value of height:", h

Call area(l, b, h)
Print "Volume of a room is:", volume(l, b)

Sub area (l, b, h)
    a = l * b
    Print "Area of a circle is:", a
End Sub

Function volume (l, b)
    volume = l * b * h
End Function

Question no 2 Solution

Rem Write a program in Q-BASIC to accept the length, breadth, and height of the room. Create a subprogram to calculate the volume, and a function to find the area of the room.
Cls
Input "Enter the number 1", n1
Input "Enter the number 2", n2
Input "Enter the number 3", n3
Call smallest(n1, n2, n3)
num = largest(n1, n2, n3)
Print "Smallest number is:"; num
 
Sub smallest (n1, n2, n3)
    If n1 > n2 And n1 > n3 Then
        Print n1; "is geater"
    ElseIf n2 > n1 And n2 > n3 Then
        Print n2; "is greater."
    Else
        Print n3; "is greater."
    End If
End Sub
 
Function largest (n1, n2, n3)
    If n1 < n2 And n1 < n3 Then
        largest = n1
    ElseIf n2 < n1 And n2 < n3 Then
        largest = n2
    Else
        largest = n3
    End If
End Function

Question no 3 Solution

REM Write a program in Q-BASIC to accept the radius of a circle and create a subprogram to calculate the area, and a function to find the circumference of a circle.
Cls
Input "Enter the Radius", r
Call area(r)
Print "Circumference of a circle is :", cir(r)
 
Sub area (r)
    aoc = 3.14 * r * r
    Print "Area of circle:", aoc
End Sub
 
Function cir (r)
    cir = 2 * 3.14 * r
End Function

Solution Q4 Solution

REM Write a program in Q-BASIC to accept three strings, create a subprogram to find the longest string, and a function to find the shortest string.
Cls
Input "Enter the string 1", a$
Input "Enter the String 2", b$
Input "Enter the String 3", c$

short$ = shortest$(a$, b$, c$)
Print short$; "is the shortest string"
Call longest(a$, b$, c$)


Sub longest (a$, b$, c$)
    If Len(a$) > Len(b$) And Len(a$) > Len(c$) Then
        Print a$; "is the longest string"
    ElseIf Len(b$) > Len(a$) And Len(b$) > Len(c$) Then
        Print b$; "is the longest string"
    Else
        Print c$; "is the longest string"
    End If
End Sub


Function shortest$ (a$, b$, c$)
    If Len(a$) < Len(b$) And Len(a$) < Len(c$) Then
        shortest$ = a$
    ElseIf Len(b$) < Len(a$) And Len(b$) < Len(c$) Then
        shortest$ = b$
    Else
        shortest$ = c$
    End If
End Function