Académique Documents
Professionnel Documents
Culture Documents
10th Class
Important Short Questions
Chapter # 1
Problem Solving
Chapter # 2
Chapter # 3
Control Structure
Chapter # 4
Arrays
Chapter # 5
Subprogram
and
Handling
Chapter # 6
Graphics in BASIC
Chapter # 7
Microsoft WORD
Designed by:
Muhammad Bilal
Seek Knowledge Academy
File
Chapter # 1
Problem Solving
Q#1. What is Analysis Phase?
Ans: In this phase, a technique divide and conquer is used to solve big and complex
problem. In this phase, a problem is divided into smaller pieces, and each sub problem is
Solved independently and then solution of all sub problems is combined to get solution of
original problem. This process is also called top down design.
Example:
10 Cls
20 Input Enter Radius of circle, r
Enter r = 5
30 A= 3.14 * r * r
A= 3.14*5*5 => 78.5
40 Print Area = , A
Area = 78.5
50 end
Q#6. What is Algorithm?
Ans:
Algorithm was invented by a Mathematician Mohammad Bin Musa
Alkhawarizmi. It is a step by step procedure to solve a particular task.
Algorithm steps must be well defined clear and effective. Every algorithm must follow
these steps.
Get data (Input)
Perform Calculations (Processing)
Provide Result (Output)
Q#7. What is flow chart? What are different symbols of flow chart?
Ans: The graphical or pictorial representation of an algorithm is called flow chart. It
consists of many symbols.
Terminator symbol
It is oval shape which is used for start and stop of flow chart
Input/Output symbol
It is parallelogram shape which is used for taking input from
user or displaying output to user.
Processing symbol
It is rectangle shape which shows calculations or processing.
Decision symbol
It is diamond shape which is used for decision making.
Connector symbol
It is small circle shape which is used to connect flow from different sides.
Flow Lines
It is arrow shape which shows the direction of flow of the algorithm.
Chapter # 2
Data types, I/O statements
Q#1. What are modes of BASIC?
Ans: GW BASIC operates in two Modes
1. Direct Mode
2. Indirect Mode
Direct Mode:
InDirect Mode:
Ans: Reserved words are also called Keywords. They have predefined meanings
in BASIC. They can only be used for the purpose for which they are developed.
They cant be used for other purposes like as name of variables.
Examples:
IF, ELSE, FOR, NEXT, DIM, THEN, WHILE, WEND
GOTO, GO SUB, LET
Example:
SAVE C:\Sum.BAS => Compressed binary format
SAVE C:\Factorial.BAS, a => ASCII format
SAVE C:\ Matrix.BAS, p => Encoded binary format
Q#7. What are I/O statements in BASIC? Give examples.
Ans: I/O statements mean input and output statements.
Input Statement:
A statement which is used to give input to the program is called
input statement.
Example:
Examples of Input statement are
READ/DATA Statement
INPUT Statement
Output Statement:
A statement which is used to display output of the program is
called Output statement.
Example:
Examples of Output statement are
PRINT Statement
PRINT USING Statement
Character
Data Type
Example
Size in memory
$
%
!
#
String
Integer
Single precision
Double precision
Name$
Marks%
Avg!
Area#
String length
2 Byte
4 Byte
8 Byte
Chapter # 3
Control Structure
Q#1. What is control structure? What are its types?
Ans: Control structure is used to control the flow of execution of a program.
There are 3 types of control structure in BASIC.
1) Sequence control structure
2) Selection control structure
3) Repetition control structure
Sequence Control Structure:
In this structure, code is executed in the same order
in which it is written. No line is skipped. It is mostly used structure.
9
In this transfer, control moves from one point to other specific point by skipping
one or more lines without any condition.
Example:
GOTO Statement
Conditional control transfer:
In this transfer, control moves from one point to other specific point by skipping
one or more lines depending on a certain condition.
Example:
ON GOTO Statement
IF-THEN-ELSE Statement
Syntax:
IF Condition THEN Statement
OR
IF Condition THEN Line number
Example:
70
80
100
10
10 cls
20 Input Enter 1st Number =, A
30 Input Enter 2nd Number =, B
40 IF A>B THEN PRINT First number is greater ELSE PRINT
Second number is greater
50 end
Example:
10
20
30
40
50
60
70
80
90
cls
REM this program prints asterisks
FOR I =1 to 5 step1
FOR J= 1 to J
Print *
Next J
PRINT
Next I
end
11
Chapter # 4
Arrays
Q#1. What is Array? What are its types?
Ans: An array is a collection of variables of same data type which are placed
contiguously (closely) to each other in memory.
Each array has a name and each array consist of elements which can be accessed
with the help of index value. Array is also called subscripted variable because it
store variables of same data type. We can access individual elements of array with
the help of subscript / index. By default index starts from zero. But it can be
started from 1 as well.
Types:
Array has two types
1-Dimensional Array (1-D)
2-Dimensional Array (2-D)
Syntax:
DIM arrayname (size)
Explanation:
DIM is key word used to declare array. Array name is valid
name similar to variable name. Size is the total number of elements which
are contained in array. It is a positive integer value.
Example:
DIM Marks (5)
Name of array is Marks and its size is 5.index from 0-4
Marks (0) Marks (1) Marks (2) Marks (3) Marks (4)
75
80
91
65
55
12
Syntax:
DIM arrayname (Row, Column)
Explanation:
DIM is key word used to declare array. Array name is valid
name similar to variable name. Row is the size of rows and Column is size
of columns contained in array. These are positive integer values. It has 2
indices Row 0-4 and Column 0-3
Example:
DIM Arr (5, 4)
Name of array is Arr and its size is 5x4=20 elements.
Arr(0, 0)
Arr(0, 1)
Arr(0,2)
Arr(0, 3)
10
Arr(1, 0)
33
Arr(1,1)
46
Arr(1, 2)
50
Arr(1, 3)
80
Arr(2, 0)
87
Arr(2, 1)
67
Arr(2, 2)
34
Arr(2, 3)
56
Arr(3, 0)
76
Arr(3, 1)
90
Arr(3, 2)
23
Arr(3, 3)
11
Arr(4, 0)
34
Arr(4, 1)
55
Arr(4, 2)
44
Arr(4, 3)
36
25
66
78
Syntax:
DIM subscripted var 1, subscripted var 2, subscripted var 3
Example:
DIM A (20), B (20), C (20)
DIM X (2, 3), Y (3, 5), Z (5, 7)
13
Ans:
Variable:
Unsubscripted variable (Simple variable) is a variable which can
store only single value.
Its value is used directly with out index/subscript.
It can occupy space any where in memory.
Array:
Subscripted variable (Array) is a variable which can store
multiple values of same data type.
Its value is used with the help of index/subscript.
Its elements occupy consecutive space in memory.
Ans:
10
11
12
13
14
15
16
17
18
19
20
21
CLS
DIM A(10)
SUM=0
FOR I =1 to 10 step 1
INPUT Enter value, A(I)
NEXT I
PRINT
FOR J=1 TO 10 step 1
SUM=SUM+A(J)
NEXT J
PRINT SUM = , SUM
END
14
Chapter # 5
Subprogram and File Handling
Q#1. What is subprogram? What are its types?
Ans:
A main program is sub divided into small and manageable pieces which are called
subprogram.
It is a set of instructions which perform specific action/task. It can be reused any
number of times in a program. It is called by its name and it returns a value to the
position where it is called. It has two types.
Built-in functions
User defined functions
Built-in functions:
These are intrinsic functions which are developed by programmers
of BASIC language. These can be used by just writing their name (function call) and
providing parameters to these functions.
Example:
FIX (n), ABS(x), DATE$, LEFT$, VAL(X$) etc
User defined functions:
These are functions which are developed by user it self for
performing different tasks. Each function do specific task and return value.
These are also called procedures.
Example:
DEF FNX(Y) = (Y*Y + 1) / Y
Syntax:
FIX(x)
x is any fractional number.
Example:
PRINT FIX (-7.098)
OUTPUT:
-7
15
16
Function:
Q#7. What is file handling? What are necessary things for file handling?
Ans: Computer store textual data on files.
A file is a collection of related records.
File handling means to use GW BASIC to read data from or write data to a
text file.
For file handling we must know
1) Open existing file/Create new file.
2) Write data on file.
3) Read data from file.
4) Close file.
17
Chapter # 6
Graphics in BASIC
Q#1. What is SCREEN statement? Give syntax with example.
Ans:
This statement is used to select a screen mode appropriate for particular
Video hardware configuration. Mode numbers are from 0, 1, 2, 7, 8, 9, 10.
Syntax:
SCREEN [mode]
Example:
SCREEN 0 => text mode
SCREEN 1 => medium resolution color mode
SCREEN 2 => high resolution color mode
Syntax:
PALETTE [attribute, color]
Palette can be Even ( 0 ) or Odd ( 1 ).
Attribute is associated with actual display color.
This statement only works for the systems which are equipped with EGA.
Example:
Screen 1
Color 2,1
odd palette
Palette 2,4 magenta (2) is replaced with red(4).
18
Example:
COLOR 1,3,2
COLOR 2,1
COLOR 3,2
19
Chapter # 7
Microsoft WORD
Q#1. Write 5 features of MS Word.
Ans:
20
Page Numbers
Author Name
Full path
Current date and time etc.