Follow Us
माध्यम चुनें / Select Medium:
Eng (English) Beng (বাংলা) Hindi (हिन्दी)
WBB • कक्षा 7 • Computer Science • अध्याय 5
अनुमानित समय: 45 Mins
प्रगति: अध्ययनरत

Microsoft Access

Welcome to the definitive study guide for "Programming Language", prescribed as Chapter 1 under the official West Bengal Board of Secondary Education (WBBSE) Class 7 Computer Science curriculum. This chapter establishes the core conceptual foundations of computational thinking, hardware communication, and software development. Students will explore how human thought translates into computer instructions across four generations of computer languages—from the raw binary switches of First Generation Machine Language (1GL) and symbolic mnemonics of Second Generation Assembly Language (2GL), to human-readable Third Generation High-Level Languages (3GLs like QBASIC, C, and Python) and declarative Fourth Generation Languages (4GLs like SQL). Special emphasis is placed on the precise operations of Language Processors (Assemblers, Interpreters, and Compilers), highlighting crucial differences in error reporting and execution speeds. Practical programming fluency is cultivated through a complete, hands-on mastery of Microsoft QBASIC—including workspace navigation, character sets, numeric and string variables ($), arithmetic and logical operator precedence, formatted input/output (CLS, REM, INPUT, LET, PRINT with commas and semicolons), and structured control logic (IF...THEN...ELSE and FOR...NEXT loops). Complete with illustrated concept diagrams, step-by-step solved textbook programs, examiner trap warnings, and diagnostic assessments, this guide ensures 100% curriculum mastery for both school examinations and practical computer lab evaluations.

💻 From Electronic Switches to Human Logic: How We Talk to Computers

Have you ever wondered how a box of electronic circuits and silicon chips can understand words like PRINT, calculate math problems in microseconds, and play video games?

Deep inside the Central Processing Unit (CPU), computers understand only one fundamental physical reality: electrical pulses that are either ON (1) or OFF (0). In the earliest days of computing, scientists had to manually punch thousands of cryptic 0s and 1s on paper cards to give instructions. One single misplaced zero could ruin an entire day of calculations!

The invention of Programming Languages transformed this tedious process into an art form. Today, human programmers write clear, English-like statements, and intelligent language translators instantly convert them into lightning-fast machine code. In this chapter, we open the door to computer science by learning the language of machines, exploring how compilers and interpreters work, and writing our first real computer programs in QBASIC!

यह अध्याय क्यों महत्वपूर्ण है

Welcome to the definitive study guide for "Programming Language", prescribed as Chapter 1 under the official West Bengal Board of Secondary Education (WBBSE) Class 7 Computer Science curriculum. This chapter establishes the core conceptual foundations of computational thinking, hardware communication, and software development. Students will explore how human thought translates into computer instructions across four generations of computer languages—from the raw binary switches of First Generation Machine Language (1GL) and symbolic mnemonics of Second Generation Assembly Language (2GL), to human-readable Third Generation High-Level Languages (3GLs like QBASIC, C, and Python) and declarative Fourth Generation Languages (4GLs like SQL). Special emphasis is placed on the precise operations of Language Processors (Assemblers, Interpreters, and Compilers), highlighting crucial differences in error reporting and execution speeds. Practical programming fluency is cultivated through a complete, hands-on mastery of Microsoft QBASIC—including workspace navigation, character sets, numeric and string variables ($), arithmetic and logical operator precedence, formatted input/output (CLS, REM, INPUT, LET, PRINT with commas and semicolons), and structured control logic (IF...THEN...ELSE and FOR...NEXT loops). Complete with illustrated concept diagrams, step-by-step solved textbook programs, examiner trap warnings, and diagnostic assessments, this guide ensures 100% curriculum mastery for both school examinations and practical computer lab evaluations.

अध्ययन से पूर्व (आवश्यक ज्ञान)

  • Basic awareness of computer system components (Input Devices, Output Devices, CPU, and RAM).
  • Fundamental arithmetic skills (Addition, Subtraction, Multiplication, Division, and Order of Operations).
  • Familiarity with standard QWERTY keyboard typing and alphanumeric characters.
  • Elementary logical reasoning and problem-solving curiosity.

इस अध्याय के लक्ष्य

  • Trace the generational evolution of programming languages from 1GL Machine Code and 2GL Assembly to 3GL High-Level and 4GL Languages.
  • Articulate the exact functional differences between Assemblers, Interpreters, and Compilers with respect to execution speed and error reporting.
  • Master the rules for declaring and naming Numeric Variables and String Variables ($) in QBASIC.
  • Write and debug well-structured QBASIC programs using CLS, REM, INPUT, LET, PRINT, and END.
  • Implement conditional branching (IF...THEN...ELSE...END IF) and iterative looping (FOR...NEXT) to solve mathematical and real-world problems.
  • Identify and rectify common syntax errors, operator confusion (/, \, MOD), and punctuation traps (, vs ;).

अध्याय रूपरेखा एवं प्रगति

1 1. Computer Languages & Generationa...
2 2. Language Processors & Translator...
3 3. Introduction to QBASIC – Environ...
4 4. Core QBASIC Statements, Operator...
5 5. Control Structures, Decision Log...

सम्पूर्ण सैद्धांतिक एवं वैचारिक अध्ययन

1. Computer Languages & Generational Evolution (1GL to 4GL)

Step 1: Fundamental Concepts – Program, Programming & Programmer

A Computer Program is a precise, ordered sequence of instructions written in a specific computer language that directs the computer hardware to perform a defined task or solve a computational problem. The creative and logical process of designing, writing, testing, and debugging these instructions is called Programming (or coding). The individual who writes and implements these instructions is called a Programmer.

Because computer processors (CPUs) consist of millions of microscopic electronic switches (transistors) that operate strictly through two physical voltage states (ON = 1, OFF = 0), human programmers require formal communication systems—known as Programming Languages—to bridge human thought and electronic hardware.

Step 2: First Generation Language (1GL) – Machine Language

Machine Language is the fundamental, native language of a computer system. It is written exclusively using binary digits: 0 and 1 (binary code). For example, an instruction to add two numbers might appear as a cryptic binary string like 01001100 00010001.

  • Key Advantages: Fastest possible execution speed, zero translation overhead (directly executed by CPU registers), and extremely efficient hardware utilization.
  • Severe Limitations: Highly machine-dependent (a program written for one CPU architecture will not run on another), nearly impossible for humans to memorize long binary strings, excruciatingly difficult to debug, and prone to typing errors.
Step 3: Second Generation Language (2GL) – Assembly Language

To overcome the immense difficulty of binary code, computer scientists created Assembly Language. Instead of numeric 0s and 1s, Assembly language substitutes short, memorable English abbreviations called Mnemonics (e.g., ADD for addition, SUB for subtraction, MOV for moving data between registers, JMP for jump, and HLT for halt).

Because the CPU still only understands binary signals, Assembly language requires a dedicated system software translator called an Assembler to convert mnemonic code into machine language. Although vastly easier than binary, Assembly language remains low-level and machine-dependent, requiring deep knowledge of specific CPU hardware registers.

Step 4: Third Generation Language (3GL) – High-Level Languages (HLL)

High-Level Languages (HLL) revolutionized computing by using everyday English words (such as PRINT, INPUT, IF, THEN, GOTO) and familiar mathematical operators (+, -, *, /). High-level languages are machine-independent (portable)—a program written in a high-level language can run on virtually any computer hardware equipped with the appropriate language translator.

  • Historical Milestones: FORTRAN (Formula Translation, 1957 by John Backus) was the world's first high-level language, designed for scientific calculations; COBOL (Common Business-Oriented Language, 1959 by Grace Hopper) was created for business applications; BASIC (Beginners All-purpose Symbolic Instruction Code, 1964 by Kemeny & Kurtz) was built for teaching novices. Modern 3GLs include C, C++, Java, and Python.
Step 5: Fourth Generation (4GL) and Fifth Generation (5GL) Languages

Fourth Generation Languages (4GL) are non-procedural languages designed to maximize programming speed and human productivity. In a procedural language (like C or BASIC), the programmer must specify how to accomplish a task step-by-step. In a 4GL, the programmer simply specifies what result is desired, and the system figures out how to retrieve it. The most prominent example of a 4GL is SQL (Structured Query Language), used worldwide to query relational databases.

Fifth Generation Languages (5GL) incorporate artificial intelligence and constraint-based programming, where problems are solved using natural language queries and logical constraints rather than coded algorithms (e.g., Prolog, Mercury).

2. Language Processors & Translators (System Software)

Step 6: The Vital Role of Language Processors – Source Code vs. Object Code

Computer hardware can never directly execute instructions written in English or Assembly mnemonics. Therefore, special system software called Language Processors (Translators) are indispensable in computing.

  • Source Code (Source Program): The original program written by the programmer in a high-level language (like QBASIC or C) or assembly language. It is easily readable by humans but incomprehensible to the CPU.
  • Object Code (Object Program / Machine Code): The translated binary version (0s and 1s) generated by the language processor that the CPU can directly execute.
Step 7: The Assembler

An Assembler is a language processor that translates a program written in Assembly Language into machine language. Each assembly mnemonic corresponds closely to a single machine code instruction. Once assembled, the resulting object code can be run directly on that specific computer processor.

Step 8: The Interpreter – Line-by-Line Translation & Execution

An Interpreter is a language processor that translates high-level source code into machine code one line at a time. As soon as it translates a single line, the CPU executes it immediately before the interpreter reads the next line.

  • Debugging Advantage: If a syntax error occurs on line 5, the interpreter halts execution immediately and points out the exact error. This makes interpreters ideal for students and beginners learning to code.
  • Execution Characteristic: An interpreter does not generate a standalone executable file (like a .exe file). If you run the program 100 times, the interpreter must re-translate each line 100 times, making execution relatively slower. QBASIC and Python use interpreter engines.
Step 9: The Compiler – Whole-Program Compilation

A Compiler is a language processor that reads and translates the entire high-level source code file all at once before any execution takes place. It performs thorough lexical analysis, syntax checking, and semantic validation across all lines.

  • Output Generation: If no errors exist, the compiler generates a permanent, standalone Object File (.OBJ) or Executable File (.EXE).
  • Error Reporting: If errors are found, the compiler produces a comprehensive diagnostic error report listing all errors and warning lines together at the end of the scan.
  • Speed Advantage: Once compiled, the program runs at maximum hardware speed without needing the compiler present. Languages like C and C++ rely on compilers.
Step 10: Master Comparison Matrix – Compiler vs. Interpreter
Feature / ParameterCompilerInterpreter
Translation StrategyTranslates the entire program source code at onceTranslates and executes the program line-by-line
Execution SpeedVery Fast (translation done once prior to execution)Slower (must translate statements each time program runs)
Error ReportingDisplays all syntax errors together after scanning the whole codeStops immediately at the very first line containing an error
Intermediate Object CodeGenerates a permanent object/executable file (.exe)Does not create an independent object file
Memory RequirementRequires more memory to store full symbol tables and object codeRequires less memory as only current line is processed
Ideal PurposeProduction software, high-performance applications (C, C++)Learning, educational environments, rapid scripting (QBASIC, Python)

3. Introduction to QBASIC – Environment, Constants & Variables

Step 11: What is QBASIC? History & Integrated Development Environment

QBASIC stands for Quick Beginners All-purpose Symbolic Instruction Code. It is an integrated development environment (IDE) and interpreter developed by Microsoft based on the classic BASIC language created in 1964 by John G. Kemeny and Thomas E. Kurtz at Dartmouth College. QBASIC provides a friendly, structured environment featuring a text editor for writing code, instant syntax checking upon pressing Enter, an output display screen, and convenient shortcut keys (such as F5 to Run a program and Shift + F5 to restart execution).

Step 12: Character Set & Data Constants in QBASIC

The Character Set of QBASIC comprises alphabetic letters (A–Z, a–z), decimal digits (0–9), and special arithmetic/punctuation symbols (+ - * / = < > ( ) , ; : $ % # ").

A Constant is a fixed data value that remains unchanged throughout program execution. QBASIC supports two categories of constants:

  • Numeric Constants: Positive or negative real numbers, integers, or decimals (e.g., 100, -45.5, 0, 3.14159). They are used in mathematical calculations and never enclosed in quotes.
  • String Constants: Any sequence of letters, digits, spaces, or symbols enclosed within double quotation marks (e.g., "TargetExams", "Kolkata - 700001", "Class 7"). Quotation marks define the string boundaries and are not printed on the screen.
Step 13: Variables – Named Memory Locations

In computer programming, a Variable is a named location in the computer's memory (RAM) allocated to store a data value. Unlike constants, the contents stored inside a variable can change or be modified multiple times as program execution proceeds.

Think of a variable as a labeled box: the label on the box is the Variable Name, and the item kept inside the box is the Variable Value. For instance, executing LET MARKS = 85 places the integer 85 into the memory container named MARKS. If we later execute LET MARKS = 92, the previous value 85 is overwritten by 92.

Step 14: Numeric Variables vs. String Variables

QBASIC strictly categorizes variables based on the type of data they are designed to store:

  • Numeric Variables: Designed exclusively to hold numbers upon which mathematical operations can be performed (e.g., AGE, SALARY, TOTAL, X). Attempting to assign text to a numeric variable triggers a Type Mismatch error.
  • String Variables: Designed to store alphanumeric text strings. In QBASIC, a string variable name must always terminate with a dollar sign ($) (e.g., NAME$, CITY$, SUBJECT$, GRADE$). For example: LET NAME$ = "Sourav Ganguly".
Step 15: Critical Rules for Naming Variables in QBASIC

To ensure valid syntax, variable names in QBASIC must strictly adhere to these fundamental rules:

  1. A variable name must begin with an alphabetic letter (A–Z). It cannot begin with a number or symbol (e.g., NUM1 is valid; 1NUM is invalid).
  2. A variable name can consist of letters, digits, and an optional type-declaration suffix character (like $ for strings).
  3. No blank spaces or special punctuation characters (such as -, @, #, .) are allowed within the name (e.g., ROLL_NO or ROLLNO is valid; ROLL NO is invalid).
  4. A variable name cannot be a Reserved Keyword (such as PRINT, INPUT, CLS, LET, END) because QBASIC reserves these words for commands.
  5. Variable names can be up to 40 characters in length and are case-insensitive (Marks and MARKS refer to the exact same variable).

4. Core QBASIC Statements, Operators & I/O Mechanisms

Step 16: CLS & REM – Essential Program Setup

CLS (Clear Screen): Clears all previous text, graphics, and prompts from the output screen. It is standard industry practice to make CLS the very first executable line of every QBASIC program so the user sees a pristine, uncluttered display screen.

REM (Remark): Used to insert explanatory notes, documentation, author credits, and comments inside source code. The interpreter ignores everything written after REM on that line during execution. An apostrophe (') can be used as a convenient shorthand for REM. Example:
CLS
REM Program to Calculate Area of Rectangle
' Author: Class 7 Student

Step 17: LET – The Assignment Statement

The LET statement assigns a constant value, another variable's contents, or the evaluated result of a mathematical expression to a designated variable.

Syntax: LET <variable_name> = <value or expression>
Examples:

  • LET R = 7 (Stores 7 in numeric variable R)
  • LET PI = 3.14159 (Stores decimal value in PI)
  • LET AREA = PI * R * R (Computes $\pi r^2$ and stores the product in AREA)
  • LET GREETING$ = "Welcome to Computer Science!"
In modern QBASIC, the keyword LET is optional—writing A = 10 functions identically to LET A = 10.

Step 18: INPUT – Interactive Runtime Data Ingestion

The INPUT statement allows a running program to pause, prompt the user via the keyboard, and store the user's keystroke response into one or more specified variables.

Syntax: INPUT "Optional Prompt Message"; <variable>
Examples:

  • INPUT "Enter your name: "; STUDENT$ $\rightarrow$ Displays the prompt string followed by a question mark, pauses execution, and stores user input into STUDENT$.
  • INPUT "Enter length and breadth: "; L, B $\rightarrow$ Allows inputting multiple numeric values separated by a comma.
Step 19: PRINT – Formatted Screen Output & Punctuation Rules

The PRINT statement displays text strings, variable contents, and calculated values on the output monitor. QBASIC provides two crucial punctuation separators that control on-screen layout:

  • Comma (,) – Tabular Print Zones: QBASIC divides the screen horizontally into standard print zones of 14 characters each. When items in a PRINT statement are separated by commas, each item begins at the next 14-column zone tab. Example: PRINT "Roll", "Name", "Marks" displays headers in neat, tabular columns.
  • Semicolon (;) – Compact Inline Display: Separating items with a semicolon suppresses wide spacing, printing the next item immediately after the preceding item with only a single space between numbers. Example: PRINT "Total Score = "; SCORE prints Total Score = 95 compactly on one line.
  • A blank PRINT statement outputs an empty line, useful for creating visual paragraph spacing.
Step 20: Operators & Precedence Rules in QBASIC

An Operator is a special symbol that directs the computer to perform specific arithmetic, comparison, or logical calculations upon values (operands).

Operator CategorySymbolsFunction & MeaningExample Expression
Arithmetic^, *, /, \, MOD, +, -Exponentiation, Multiplication, Real Division, Integer Division, Modulus (Remainder), Addition, Subtraction17 \ 3 = 5
17 MOD 3 = 2
Relational=, <>, <, >, <=, >=Equal to, Not equal to, Less than, Greater than, Less than or equal to, Greater than or equal toIF AGE >= 18
LogicalAND, OR, NOTCombines multiple conditions (AND = all true, OR = at least one true, NOT = negation)IF (M >= 40) AND (ATT >= 75)

Evaluation Hierarchy (Precedence): Parentheses () $\rightarrow$ Exponentiation ^ $\rightarrow$ Multiplication & Division * / $\rightarrow$ Integer Division \ $\rightarrow$ Modulus MOD $\rightarrow$ Addition & Subtraction + - $\rightarrow$ Relational Operators $\rightarrow$ Logical Operators (NOT $\rightarrow$ AND $\rightarrow$ OR).

5. Control Structures, Decision Logic & Loop Iteration

Step 21: Sequential Flow vs. Branching & Looping

By default, computer programs follow a Sequential Flow—statements execute line-by-line in exact chronological order from top to bottom. However, solving real-world challenges requires two additional fundamental control structures:

  1. Selection (Conditional Branching): Executing specific blocks of code only when certain conditions evaluate to TRUE (e.g., granting a discount only if total bill exceeds ₹1000).
  2. Iteration (Looping): Repeating a sequence of instructions multiple times until a terminating condition is met (e.g., printing numbers 1 to 100).
Step 22: Conditional Branching – IF...THEN...ELSE...END IF

The IF...THEN...ELSE statement tests a relational or logical condition. If the condition is true, the statements under THEN are executed; if false, the statements under ELSE are executed.

Block Syntax:

IF <condition> THEN
    [statements to execute if true]
ELSE
    [statements to execute if false]
END IF
Multiple alternative conditions can be evaluated using ELSEIF, as in: IF MARKS >= 80 THEN PRINT "Grade A" ELSEIF MARKS >= 60 THEN PRINT "Grade B" ELSE PRINT "Grade C" END IF.

Step 23: Iterative Looping – The FOR...NEXT Structure

The FOR...NEXT loop is an entry-controlled counter loop used to repeat a block of code a specified number of times.

Syntax:

FOR counter = start_value TO end_value [STEP increment]
    [loop body statements]
NEXT counter
  • Counter Variable: A numeric variable that automatically tracks the current iteration.
  • STEP Clause: Optional. Specifies the step value by which the counter increases (or decreases) on each cycle. If omitted, default step is +1. Using STEP 2 skips odd numbers; using STEP -1 creates a countdown loop.
Step 24: Practical Problem Solving – Structured Program Construction

A properly structured QBASIC program follows the universal IPO (Input $\rightarrow$ Process $\rightarrow$ Output) paradigm:

  1. Header & Setup: CLS and REM documentation.
  2. Input Stage: INPUT statements to acquire dynamic user data.
  3. Processing Stage: LET statements and mathematical/logical operations.
  4. Output Stage: PRINT statements presenting human-readable results.
  5. Termination: END to gracefully halt the interpreter.
Step 25: Program Termination & Good Coding Hygiene

The END statement marks the physical and logical completion of a QBASIC program. It halts program execution and returns control to the QBASIC editor window.

Good Coding Habits for Class 7 Exams: Always indent statements inside IF blocks and FOR loops for readability; choose meaningful variable names (like RADIUS rather than just R); provide friendly prompt messages in INPUT; and write brief explanatory REM comments explaining what the program accomplishes.

प्रोग्रामिंग सिंटेक्स, स्टेटमेंट्स एवं भाषा अनुवादक नियम

Hierarchy of Programming Languages (1GL to 4GL)
1GL (Machine: 0 & 1) < 2GL (Assembly: Mnemonics) < 3GL (High-Level: English) < 4GL (SQL: Non-Procedural)
Lower level = faster hardware execution; Higher level = greater human readability and machine portability.
Language Translators Formula Matrix
$$\text{Assembly} \xrightarrow{\text{Assembler}} \text{Machine Code} \quad | \quad \text{High-Level} \xrightarrow{\text{Interpreter/Compiler}} \text{Machine Code}$$
Interpreter: Line-by-line immediate execution. Compiler: Entire file compiled at once into permanent object code.
QBASIC Variable Declaration & Types
\text{Numeric: } A, \text{SUM}, \text{X} \quad | \quad \text{String: } \text{NAME}\$, \text{CITY}\$, \text{GRADE}\$
String variables MUST end with a dollar sign ($). Strings store text enclosed in double quotation marks ("...").
Arithmetic Operator Precedence Hierarchy
$$() \rightarrow \text{^ (Power)} \rightarrow (*, /) \rightarrow \backslash \text{ (Int Div)} \rightarrow \text{MOD (Remainder)} \rightarrow (+, -)$$
Integer division (\) discards fractions: 17 \ 3 = 5. Modulus (MOD) returns remainder: 17 MOD 3 = 2.
PRINT Statement Output Spacing Rules
$$\text{Comma (,) } \rightarrow \text{14-char Print Zones (Tabular)} \quad | \quad \text{Semicolon (;) } \rightarrow \text{Compact Adjacent Display}$$
PRINT "A", "B" prints spaced across columns. PRINT "A"; "B" prints AB directly adjacent.
Control Structures Syntax Architecture
$$\text{IF } \langle \text{Cond} \rangle \text{ THEN } \dots \text{ ELSE } \dots \text{ END IF} \quad | \quad \text{FOR } i = 1 \text{ TO } N \text{ [STEP } s\text{]} \dots \text{ NEXT } i$$
Always close multi-line block IF with END IF. Always pair every FOR statement with a matching NEXT.

अवधारणात्मक हल उदाहरण एवं अनुप्रयोग (Solved Examples)

उदाहरण 1
Write a QBASIC program to accept two numbers from the user, calculate their sum and average, and display the formatted results.
विस्तृत समाधान / उत्तर:

Complete Verified QBASIC Code:

CLS
REM Program to Calculate Sum and Average of Two Numbers
INPUT "Enter first number: "; N1
INPUT "Enter second number: "; N2
LET TOTAL = N1 + N2
LET AVG = TOTAL / 2
PRINT "------------------------------"
PRINT "The Sum is: "; TOTAL
PRINT "The Average is: "; AVG
END

Dry Run / Sample Output:
If user inputs 30 and 50:
The Sum is: 80
The Average is: 40

उदाहरण 2
Write a QBASIC program to calculate and display the Area and Perimeter of a rectangle where length and breadth are entered by the user.
विस्तृत समाधान / उत्तर:

Mathematical Formulas: $Area = Length \times Breadth$, $Perimeter = 2 \times (Length + Breadth)$

CLS
REM Program to Calculate Rectangle Area and Perimeter
INPUT "Enter Length of Rectangle: "; L
INPUT "Enter Breadth of Rectangle: "; B
LET AREA = L * B
LET PERI = 2 * (L + B)
PRINT "================================"
PRINT "Area of Rectangle = "; AREA; " sq units"
PRINT "Perimeter of Rectangle = "; PERI; " units"
END

Explanation: CLS cleans the console. INPUT takes values into numeric variables L and B. LET computes both formulas following operator precedence. PRINT cleanly displays results with units.

उदाहरण 3
Write a QBASIC program to calculate Simple Interest ($SI$) and Total Amount ($A$) given Principal, Rate of Interest, and Time in years.
विस्तृत समाधान / उत्तर:

Mathematical Formula: $SI = \frac{P \times R \times T}{100}, \quad Amount = P + SI$

CLS
REM Program to Calculate Simple Interest
INPUT "Enter Principal Amount (in Rs): "; P
INPUT "Enter Annual Rate of Interest (%): "; R
INPUT "Enter Time Period (in years): "; T
LET SI = (P * R * T) / 100
LET AMT = P + SI
PRINT "--------------------------------"
PRINT "Simple Interest = Rs. "; SI
PRINT "Total Maturity Amount = Rs. "; AMT
END

Sample Run: For $P = 5000$, $R = 8$, $T = 3$:
$SI = (5000 \times 8 \times 3) / 100 = 1200$. Maturity Amount $= 5000 + 1200 = Rs. 6200$.

उदाहरण 4
Write a QBASIC program to convert temperature from Celsius ($^\circ C$) to Fahrenheit ($^\circ F$).
विस्तृत समाधान / उत्तर:

Formula: $F = \left(\frac{9 \times C}{5}\right) + 32$

CLS
REM Temperature Conversion from Celsius to Fahrenheit
INPUT "Enter Temperature in Celsius: "; C
LET F = (C * 9 / 5) + 32
PRINT C; " degrees Celsius is equal to "; F; " degrees Fahrenheit"
END

Verification: If input $C = 100$, output displays: 100 degrees Celsius is equal to 212 degrees Fahrenheit.

उदाहरण 5
Write a QBASIC program to accept an integer from the user and determine whether it is Even or Odd using the MOD operator and IF...THEN...ELSE.
विस्तृत समाधान / उत्तर:

Logic: Any integer divisible by 2 with remainder 0 ($NUM \text{ MOD } 2 = 0$) is Even; otherwise, it is Odd.

CLS
REM Check Even or Odd Number
INPUT "Enter any integer: "; NUM
IF NUM MOD 2 = 0 THEN
    PRINT NUM; " is an EVEN number."
ELSE
    PRINT NUM; " is an ODD number."
END IF
END

Explanation: NUM MOD 2 calculates the integer remainder upon division by 2. The IF condition evaluates the equality and branches execution to the correct PRINT block.

उदाहरण 6
Write a program to accept a student's marks in an examination (out of 100) and display whether the student has "PASSED WITH DISTINCTION" (marks >= 75), "PASSED" (marks >= 40), or "FAILED" (marks < 40).
विस्तृत समाधान / उत्तर:
CLS
INPUT "Enter Student Name: "; STNAME$
INPUT "Enter Marks Obtained (0-100): "; MARKS
PRINT "Result for: "; STNAME$
IF MARKS >= 75 THEN
    PRINT "STATUS: PASSED WITH DISTINCTION! Congratulations!"
ELSEIF MARKS >= 40 THEN
    PRINT "STATUS: PASSED. Good effort."
ELSE
    PRINT "STATUS: FAILED. Needs improvement."
END IF
END

Key Concept: Demonstrates multi-way conditional branching using IF...ELSEIF...ELSE...END IF and stores student name in a string variable STNAME$.

उदाहरण 7
Write a QBASIC program to generate and display the multiplication table of any user-entered number up to 10 using a FOR...NEXT loop.
विस्तृत समाधान / उत्तर:
CLS
REM Program to Print Multiplication Table
INPUT "Enter a number for its multiplication table: "; N
PRINT "--- Multiplication Table of "; N; " ---"
FOR I = 1 TO 10
    LET PROD = N * I
    PRINT N; " x "; I; " = "; PROD
NEXT I
END

Trace: The loop initializes counter variable I = 1. On each iteration, it prints N x I = PROD and advances I by 1 via NEXT I until I = 10, completing 10 cycles smoothly.

सामान्य गलतियाँ एवं परीक्षक के जाल (Examiner Traps)

सामान्य भ्रम / गलत उत्तर

Omitting the dollar sign ($) when declaring or assigning string variables (e.g., LET NAME = "Debashis").

सही वैज्ञानिक तथ्य

In QBASIC, variables storing text strings MUST end with a dollar sign (LET NAME$ = "Debashis"). Assigning text to a numeric variable causes an immediate Type Mismatch error.

सामान्य भ्रम / गलत उत्तर

Believing that an Interpreter generates a permanent standalone .exe executable file.

सही वैज्ञानिक तथ्य

An Interpreter translates and executes code line-by-line in memory without producing an object file (.OBJ) or executable file (.EXE). Only a Compiler produces a permanent standalone executable.

सामान्य भ्रम / गलत उत्तर

Confusing the Comma (,) and Semicolon (;) punctuation separators in PRINT statements.

सही वैज्ञानिक तथ्य

A comma (,) moves the cursor to the next 14-character print zone (creating wide tabular columns). A semicolon (;) prints items immediately adjacent to each other with minimal inline spacing.

सामान्य भ्रम / गलत उत्तर

Confusing Real Division (/), Integer Division (\), and Modulus (MOD).

सही वैज्ञानिक तथ्य

In QBASIC: 17 / 4 yields 4.25 (Real Division); 17 \ 4 yields 4 (Integer Division, fraction truncated); and 17 MOD 4 yields 1 (Remainder).

सामान्य भ्रम / गलत उत्तर

Starting a variable name with a number or including spaces (e.g., 1ST_NUM = 10 or STUDENT NAME$ = "Ananya").

सही वैज्ञानिक तथ्य

Variable names must always begin with an alphabetic letter (A-Z) and cannot contain embedded blank spaces. Valid alternatives: NUM1 or STUDENT_NAME$.

सामान्य भ्रम / गलत उत्तर

Forgetting the END IF statement when writing a multi-line block IF statement.

सही वैज्ञानिक तथ्य

Whenever an IF statement spans multiple lines with THEN and ELSE clauses, it MUST terminate with END IF; otherwise, a Block IF without END IF syntax error is triggered.

सामान्य भ्रम / गलत उत्तर

Writing strings without double quotes in PRINT statements (e.g., PRINT HELLO instead of PRINT "HELLO").

सही वैज्ञानिक तथ्य

Without quotation marks, QBASIC treats HELLO as a numeric variable with default value 0 and prints 0. Text literals must always be enclosed in double quotes ("...").

Programming Language – Structural Hierarchy & Execution Workflow (Concept Map)

Programming Language – WBBSE Class 7 Computer Science Hierarchy, Language Processors, QBASIC Syntax & Logic Building 1. Language Hierarchy (1GL to 4GL) 1GL Machine Code: Pure binary (0 & 1), direct hardware execution 2GL Assembly: Symbolic Mnemonics (ADD, SUB, MOV) & Assembler 3GL High-Level: English keywords (QBASIC, C, Python), portable 4GL Non-Procedural: Declarative data queries (SQL) 2. Language Translators (System Software) Assembler: Converts Assembly mnemonics to Machine code Interpreter: Translates & executes line-by-line (QBASIC) Compiler: Converts entire program at once into Object code Source Code (Human-readable) vs Object Code (Binary 0/1) 3. Core QBASIC Statements & Syntax CLS: Clears output screen before program execution INPUT: Prompts user and stores data in variable (A, NAME$) LET: Assigns value or computational expression to variable PRINT: Outputs text/variables (',' = zones, ';' = compact) 4. Program Control Flow & Logic Sequential Flow: Step-by-step top-to-bottom execution Decision Logic: IF <condition> THEN ... ELSE ... END IF Iterative Looping: FOR var = start TO end STEP n ... NEXT Termination: END statement cleanly stops program execution

अध्याय का सार संक्षेप एवं 10 मुख्य निष्कर्ष

मुख्य बिंदु 1
A Computer Program is a sequence of instructions; Programming is the process of writing them; and a Programmer is the author.
मुख्य बिंदु 2
1GL (Machine Language) uses binary code (0 and 1) and executes directly on CPU hardware without translation.
मुख्य बिंदु 3
2GL (Assembly Language) uses mnemonic codes (ADD, SUB, MOV) and requires an Assembler to produce machine code.
मुख्य बिंदु 4
3GL (High-Level Languages) like QBASIC, C, and Python use English-like words, are machine-independent (portable), and require translators.
मुख्य बिंदु 5
An Interpreter translates and executes code line-by-line (e.g., QBASIC); a Compiler translates the whole program at once into an executable file (e.g., C/C++).
मुख्य बिंदु 6
In QBASIC, numeric variables store numbers (e.g., AGE, SUM), while string variables store text and MUST terminate with a dollar sign ($) (e.g., NAME$).
मुख्य बिंदु 7
The CLS statement clears the screen; REM inserts comments; INPUT prompts user interaction; LET assigns values; PRINT displays output; and END terminates.
मुख्य बिंदु 8
The comma (,) in PRINT creates 14-column tabular zones; the semicolon (;) prints items adjacent to each other.
मुख्य बिंदु 9
QBASIC control structures include Sequential flow, Conditional decision making (IF...THEN...ELSE...END IF), and Iterative looping (FOR...NEXT).

स्व-मूल्यांकन अभ्यास (Check Your Understanding)

मूल वैचारिक स्पष्टता की जांच के लिए नैदानिक प्रश्न। पहले स्वयं हल करें, फिर उत्तर देखें।

1
What is the key difference between Machine Language (1GL) and High-Level Language (3GL) regarding machine dependency?
उत्तर एवं व्याख्या देखें
उत्तर:

Machine Language is machine-dependent (tied directly to a specific processor architecture and not portable), whereas High-Level Languages are machine-independent (portable) and can run on different computers with an appropriate compiler or interpreter.


2
Why is an Assembler classified as system software, and what is its specific translation role?
उत्तर एवं व्याख्या देखें
उत्तर:

An Assembler is classified as system software because it directly interfaces with system hardware to translate Assembly Language mnemonics (like ADD, SUB, MOV) into binary machine code (0s and 1s) that the CPU can execute.


3
How does an Interpreter differ from a Compiler in how it reports syntax errors to the programmer?
उत्तर एवं व्याख्या देखें
उत्तर:

An Interpreter halts execution immediately at the very first line containing a syntax error, allowing instant line-by-line debugging. A Compiler scans the entire source code and displays a consolidated diagnostic list of all errors across the entire program at once.


4
What is the output of the following QBASIC statements: PRINT 20 \ 6 and PRINT 20 MOD 6?
उत्तर एवं व्याख्या देखें
उत्तर:

20 \ 6 outputs 3 (Integer division, truncated whole quotient). 20 MOD 6 outputs 2 (Modulus, remainder of division: $20 = 3 \times 6 + 2$).


5
Identify which of the following variable names are INVALID in QBASIC and state why: (A) TOTAL_MARKS, (B) 2NDNUMBER, (C) NAME, (D) ROLL NO.
उत्तर एवं व्याख्या देखें
उत्तर:

(B) 2NDNUMBER is invalid because variable names cannot begin with a digit. (D) ROLL NO is invalid because variable names cannot contain spaces. (A) TOTAL_MARKS is valid. (C) NAME is a valid numeric variable, but cannot store text without a $ suffix.


अध्याय का अध्ययन पूर्ण हुआ?
अभ्यास के लिए तैयार?

ऑनलाइन CBT टेस्ट देकर तैयारी का मूल्यांकन करें

झारखण्ड बोर्ड परीक्षा पैटर्न पर आधारित बहुविकल्पीय प्रश्नों का ऑनलाइन टेस्ट दें। तुरंत परिणाम, समय विश्लेषण और प्रत्येक प्रश्न का विस्तृत हल प्राप्त करें।