Sikshya Plus Get appGet the app free
Class 10 · Computer Science

Modular Programming – Class 10 Computer Science Notes and Solutions

Complete solutions and answers for “Modular Programming”, a chapter in Class 10 Computer Science (SEE exam preparation). This page covers The lesson in short, Section A: Modular Concepts, SUB, and FUNCTION Procedures, Section B: Solved Modular QBASIC Programs and Section C: Textbook Review Questions & Answers.

  • Free, no login needed
  • 4 min read
  • Updated 20 November 2026

Chapter at a glance

Complete textbook solutions and programming notes for Class 10 Computer Science Unit 11 Modular Programming, covering modular concepts, SUB vs FUNCTION procedures, formal vs actual arguments, local vs global variables, and solved modular QBASIC scripts.

  • Modular Programming Architecture and Benefits
  • SUB Procedures vs FUNCTION Procedures
  • Formal Parameters vs Actual Arguments
  • Variable Scope: Local vs Shared/Global
  • Solved Programs: Area, Prime Check, String Reversal

Exam focus: Writing complete modular QBASIC programs using both SUB and FUNCTION, explaining differences between SUB and FUNCTION, and defining variable scope.

Key formulas and definitions

  • SUB syntax: DECLARE SUB name(params) ... CALL name(args)
  • FUNCTION syntax: DECLARE FUNCTION name(params) ... name = value
On this page (10 sections)
  1. The lesson in short
  2. Section A: Modular Concepts, SUB, and FUNCTION Procedures
  3. ComparisonSUB Procedure vs FUNCTION Procedure
  4. Variables & ScopeParameter Types and Variable Scopes
  5. Section B: Solved Modular QBASIC Programs
  6. SUB Program 1Program 1: Area of Rectangle using SUB Procedure
  7. FUNCTION Program 2Program 2: Check Prime Number using FUNCTION Procedure
  8. SUB Program 3Program 3: Reverse a String using SUB Procedure
  9. Section C: Textbook Review Questions & Answers
  10. Review Q&AComprehension & Conceptual Q&A

Solutions and answers

Class 10 Computer Science · Unit 11: Modular Programming

The lesson in short

Modular programming is a structured software design technique that decomposes a large, complex computer program into smaller, independent, manageable, and reusable functional blocks termed modules or subprograms.

By segmenting code into dedicated procedures, modular architecture enhances readability, simplifies debugging, facilitates collaborative teamwork, eliminates redundant logic, and promotes code reusability.

This chapter covers modular concepts, subprograms in QBASIC (SUB procedures vs FUNCTION procedures), parameter passing mechanisms, variable scope (local vs global), and complete solved programming exercises aligned with the CDC Grade 10 syllabus.

Section A: Modular Concepts, SUB, and FUNCTION Procedures

  • Top-Down Decomposition: Decomposes a major software challenge into specialized sub-tasks that can be tackled independently.
  • Reusability: A procedure written once (e.g., checking prime numbers) can be invoked repeatedly across different parts of the application.
  • Simplified Debugging and Maintenance: Bugs are isolated within specific modular routines without risking unintended side effects in other procedures.
  • Parallel Team Development: Multiple software engineers can write, test, and document separate modules concurrently.

ComparisonSUB Procedure vs FUNCTION Procedure

ParameterSUB ProcedureFUNCTION Procedure
Return ValueDoes not return a value to the calling module by defaultAlways calculates and returns a single value to the calling expression
Invocation MethodCalled via an explicit `CALL` statement (or bare procedure name)Called directly within an expression or assignment: `ans = Func(args)`
Declaration Keyword`DECLARE SUB SubName (params)``DECLARE FUNCTION FuncName (params)`
Definition Syntax`SUB SubName (params) ... END SUB``FUNCTION FuncName (params) ... FuncName = result ... END FUNCTION`
Typical ApplicationsDisplaying menus, printing tables, sorting arrays, updating filesMathematical calculations, area evaluation, finding greatest numbers

Variables & ScopeParameter Types and Variable Scopes

Formal Parameters: Variables declared in the SUB or FUNCTION header that receive incoming data (e.g., `SUB Calc(a, b)`).

Actual Parameters: The concrete variables or literal values passed to the procedure during invocation (e.g., `CALL Calc(x, 10)`).

Local Variables: Variables declared inside a procedure that exist only during its execution; inaccessible to the main module.

Global Variables (SHARED / COMMON SHARED): Variables accessible across all modules and subprograms without needing to pass them as parameters.

Section B: Solved Modular QBASIC Programs

SUB Program 1Program 1: Area of Rectangle using SUB Procedure

Write a modular QBASIC program to calculate the area of a rectangle using a SUB procedure.

DECLARE SUB Area (l!, b!)

CLS

INPUT "Enter Length: ", len!

INPUT "Enter Breadth: ", br!

CALL Area(len!, br!)

END

SUB Area (l!, b!)

a! = l! * b!

PRINT "Area of the rectangle = "; a!

END SUB

FUNCTION Program 2Program 2: Check Prime Number using FUNCTION Procedure

Write a modular QBASIC program to check whether a given integer is Prime using a FUNCTION procedure.

DECLARE FUNCTION IsPrime$ (n%)

CLS

INPUT "Enter a number greater than 1: ", num%

res$ = IsPrime$(num%)

PRINT num%; " is "; res$

END

FUNCTION IsPrime$ (n%)

IF n% <= 1 THEN

IsPrime$ = "Neither Prime Nor Composite"

EXIT FUNCTION

END IF

count% = 0

FOR i% = 1 TO n%

IF n% MOD i% = 0 THEN count% = count% + 1

NEXT i%

IF count% = 2 THEN

IsPrime$ = "Prime"

ELSE

IsPrime$ = "Composite"

END IF

END FUNCTION

SUB Program 3Program 3: Reverse a String using SUB Procedure

Write a modular QBASIC program to input a string and print it in reverse using a SUB procedure.

DECLARE SUB ReverseString (s$)

CLS

INPUT "Enter a string / word: ", text$

CALL ReverseString(text$)

END

SUB ReverseString (s$)

rev$ = ""

FOR i% = LEN(s$) TO 1 STEP -1

rev$ = rev$ + MID$(s$, i%, 1)

NEXT i%

PRINT "Reversed String = "; rev$

END SUB

Section C: Textbook Review Questions & Answers

Review Q&AComprehension & Conceptual Q&A

1. What is modular programming? Mention four prominent advantages.

Modular programming is a software design technique where a large computer program is divided into separate, smaller, independent subprograms or sub-routines (called modules) that perform specific tasks.

Four prominent advantages:

1. Reusability: Code routines can be called multiple times without duplicate typing.

2. Easy Debugging: Logical errors are confined to single procedures, speeding up fault finding.

3. Enhanced Readability: The main program remains clean, high-level, and easy to understand.

4. Team Collaboration: Enables multiple developers to write different modules simultaneously.

2. Differentiate between actual arguments and formal parameters with an example.

Formal parameters are variables specified in the header of a SUB or FUNCTION procedure definition that receive incoming data (e.g., `l` and `b` in `SUB Area(l, b)`). Actual arguments are the concrete values, variables, or expressions passed to the procedure in the calling statement (e.g., `x` and `y` in `CALL Area(x, y)`). Actual arguments provide the real data that formal parameters accept during execution.

Frequently asked questions

What is Modular Programming about?

Complete textbook solutions and programming notes for Class 10 Computer Science Unit 11 Modular Programming, covering modular concepts, SUB vs FUNCTION procedures, formal vs actual arguments, local vs global variables, and solved modular QBASIC scripts.

Which topics are covered in Modular Programming?

Class 10 Computer Science “Modular Programming” covers: Modular Programming Architecture and Benefits; SUB Procedures vs FUNCTION Procedures; Formal Parameters vs Actual Arguments; Variable Scope: Local vs Shared/Global; Solved Programs: Area, Prime Check, String Reversal.

What should I focus on in Modular Programming for the exam?

Writing complete modular QBASIC programs using both SUB and FUNCTION, explaining differences between SUB and FUNCTION, and defining variable scope.

What are the key formulas or definitions in Modular Programming?

SUB syntax: DECLARE SUB name(params) ... CALL name(args); FUNCTION syntax: DECLARE FUNCTION name(params) ... name = value.

Where can I read the Class 10 Computer Science “Modular Programming” solutions?

Right on this page. They are free and you do not need to sign up. For chapter quizzes and the AI tutor, install the Sikshya Plus app.

Study tips

Free for Class 9 to 12

Do not just read it. Practice it.

You have read the solutions for Modular Programming. Now test yourself, ask the AI tutor and keep your streak going.

Sikshya Plus chapter quiz screen with class, subject and difficulty options
Sikshya AI personal tutor chat inside the app
Sikshya Plus AI tools screen: question assistant, summarizer, translator, grammar checker
Chapter list with Past Q, materials, posts and books tabs
  • AI quizzes for this chapterTest yourself with instant feedback and explanations after every answer.
  • AI tutor, free, 24/7Stuck on a question? Ask in your own words and get a step-by-step explanation.
  • 14 AI tools in one appSummarizer, grammar checker, flashcards, essay help, math solver and more.
  • Past questions and notesPast papers and your own notes organized chapter by chapter.
Download free on Google Play Scan with your phone to install