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

Programming in QBASIC – Class 10 Computer Science Notes and Solutions

Complete solutions and answers for “Programming in QBASIC”, a chapter in Class 10 Computer Science (SEE exam preparation). This page covers The lesson in short, Section A: QBASIC Fundamentals, Variables, and Control Flow, Section B: Standard Solved QBASIC Programs and Section C: String Handling in QBASIC.

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

Chapter at a glance

Complete textbook solutions and programming guide for Class 10 Computer Science Unit 9 Programming in QBASIC, covering variable suffixes, control flow (IF, SELECT CASE, loops), built-in string functions, and full solved programs for prime numbers, palindromes, and Fibonacci series.

  • QBASIC Variable Suffixes: $, %, &, !, #
  • Conditional Branching: IF...THEN...ELSE, SELECT CASE
  • Looping Constructs: FOR...NEXT, WHILE...WEND, DO...LOOP
  • String Functions: LEN, LEFT$, RIGHT$, MID$, UCASE$
  • Classic Algorithms: Palindromes, Primes, Factorials

Exam focus: Writing complete bug-free QBASIC programs for palindrome numbers, prime checking, multiplication tables, and string manipulations using MID$ and LEN.

Key formulas and definitions

  • Integer Modulo: n MOD 10 extracts last digit; n \ 10 removes last digit
On this page (12 sections)
  1. The lesson in short
  2. Section A: QBASIC Fundamentals, Variables, and Control Flow
  3. VariablesVariable Naming Rules and Type Declaration Suffixes
  4. Control FlowBranching and Iterative Control Statements
  5. Section B: Standard Solved QBASIC Programs
  6. Program 1Program 1: Generate the Multiplication Table of a Number
  7. Program 2Program 2: Reverse a Number and Check for Palindrome
  8. Program 3Program 3: Check Prime Number
  9. Program 4Program 4: Generate the Fibonacci Series up to 10 Terms
  10. Section C: String Handling in QBASIC
  11. String FunctionsBuilt-in String Functions
  12. String ProgramProgram: Reverse a Given Word and Check Palindrome String

Solutions and answers

Class 10 Computer Science · Unit 9: Programming in QBASIC

The lesson in short

QBASIC (Quick Beginners All-purpose Symbolic Instruction Code) is a classic structured, procedural programming language developed by Microsoft for teaching algorithmic problem-solving.

Featuring an integrated development environment with a syntax-checking editor and interpreter, QBASIC provides an accessible entry point to computational logic and imperative programming.

This chapter covers QBASIC language elements (character set, constants, variables, operators), standard control structures (IF...THEN, SELECT CASE, FOR...NEXT, WHILE...WEND, DO...LOOP), array handling, and complete solved programs aligned with the CDC Grade 10 curriculum.

Section A: QBASIC Fundamentals, Variables, and Control Flow

VariablesVariable Naming Rules and Type Declaration Suffixes

Variable TypeDeclaration SuffixStorage SizeExample Valid Identifiers
String Variable$ (Dollar sign)Up to 32,767 charactersName$, Address$, City$
Integer Variable% (Percent sign)2 bytes (-32,768 to 32,767)Roll%, Age%, Count%
Long Integer& (Ampersand)4 bytes (-2.14 billion to +2.14 billion)Population&, Distance&
Single Precision! (Exclamation, default)4 bytes (7 digits of precision)Marks!, Avg!, Rate!
Double Precision# (Hash sign)8 bytes (15-16 digits of precision)GrossSalary#, TotalAmount#

Control FlowBranching and Iterative Control Statements

StatementSyntax PatternOperating Purpose
IF...THEN...ELSEIF condition THEN [statements] ELSE [statements]Two-way conditional decision branching based on boolean evaluation
SELECT CASESELECT CASE test_expression CASE val1: ... CASE ELSE: ... END SELECTMulti-way selective branching cleanly replacing multiple nested IFs
FOR...NEXTFOR counter = start TO end STEP increment [statements] NEXT counterDeterministic count-controlled loop for repeating code a fixed number of times
WHILE...WENDWHILE condition [statements] WENDPre-tested condition loop executing statements as long as condition evaluates True
DO...LOOPDO WHILE condition ... LOOP or DO ... LOOP UNTIL conditionVersatile pre-test or post-test loop supporting WHILE and UNTIL clauses

Section B: Standard Solved QBASIC Programs

Program 1Program 1: Generate the Multiplication Table of a Number

Write a QBASIC program to display the multiplication table of an input number up to 10.

CLS

INPUT "Enter an integer: ", n%

PRINT "Multiplication Table for"; n%

PRINT "-------------------------"

FOR i% = 1 TO 10

PRINT n%; " x "; i%; " = "; n% * i%

NEXT i%

END

Program 2Program 2: Reverse a Number and Check for Palindrome

Write a QBASIC program to reverse a positive integer and determine if it is a Palindrome.

CLS

INPUT "Enter a positive integer: ", n&

temp& = n&

rev& = 0

WHILE temp& > 0

rem% = temp& MOD 10

rev& = rev& * 10 + rem%

temp& = temp& \ 10

WEND

PRINT "Reversed Number = "; rev&

IF n& = rev& THEN

PRINT n&; " is a Palindrome Number."

ELSE

PRINT n&; " is NOT a Palindrome Number."

END IF

END

Program 3Program 3: Check Prime Number

Write a QBASIC program to check whether a given integer is Prime or Composite.

CLS

INPUT "Enter an integer greater than 1: ", num%

IF num% <= 1 THEN

PRINT "Number must be greater than 1."

END

END IF

count% = 0

FOR i% = 1 TO num%

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

NEXT i%

IF count% = 2 THEN

PRINT num%; " is a Prime Number."

ELSE

PRINT num%; " is a Composite Number."

END IF

END

Program 4Program 4: Generate the Fibonacci Series up to 10 Terms

Write a QBASIC program to generate the first 10 terms of the Fibonacci sequence: 0, 1, 1, 2, 3, 5, 8, ...

CLS

a% = 0

b% = 1

PRINT "First 10 terms of Fibonacci Series:"

PRINT a%; b%;

FOR i% = 3 TO 10

c% = a% + b%

PRINT c%;

a% = b%

b% = c%

NEXT i%

PRINT

END

Section C: String Handling in QBASIC

String FunctionsBuilt-in String Functions

FunctionSyntaxReturned OutputExample Call
LENLEN(str$)Returns total count of characters in stringLEN("NEPAL") -> 5
LEFT$LEFT$(str$, n)Extracts n characters from leftmost sideLEFT$("KATHMANDU", 4) -> "KATH"
RIGHT$RIGHT$(str$, n)Extracts n characters from rightmost sideRIGHT$("KATHMANDU", 5) -> "MANDU"
MID$MID$(str$, pos, n)Extracts n characters starting at character position posMID$("POKHARA", 2, 3) -> "OKH"
UCASE$ / LCASE$UCASE$(str$)Converts all letters to uppercase or lowercaseUCASE$("nepal") -> "NEPAL"

String ProgramProgram: Reverse a Given Word and Check Palindrome String

Write a program to input a word and check if it is a palindrome string (e.g. MADAM).

CLS

INPUT "Enter a word: ", w$

w$ = UCASE$(w$)

rev$ = ""

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

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

NEXT i%

PRINT "Reversed word = "; rev$

IF w$ = rev$ THEN

PRINT "The word is a Palindrome String."

ELSE

PRINT "The word is NOT a Palindrome String."

END IF

END

Frequently asked questions

What is Programming in QBASIC about?

Complete textbook solutions and programming guide for Class 10 Computer Science Unit 9 Programming in QBASIC, covering variable suffixes, control flow (IF, SELECT CASE, loops), built-in string functions, and full solved programs for prime numbers, palindromes, and Fibonacci series.

Which topics are covered in Programming in QBASIC?

Class 10 Computer Science “Programming in QBASIC” covers: QBASIC Variable Suffixes: $, %, &, !, #; Conditional Branching: IF...THEN...ELSE, SELECT CASE; Looping Constructs: FOR...NEXT, WHILE...WEND, DO...LOOP; String Functions: LEN, LEFT$, RIGHT$, MID$, UCASE$; Classic Algorithms: Palindromes, Primes, Factorials.

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

Writing complete bug-free QBASIC programs for palindrome numbers, prime checking, multiplication tables, and string manipulations using MID$ and LEN.

What are the key formulas or definitions in Programming in QBASIC?

Integer Modulo: n MOD 10 extracts last digit; n \ 10 removes last digit.

Where can I read the Class 10 Computer Science “Programming in QBASIC” 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 Programming in QBASIC. 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