Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 11

Chapter # 1Problem 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 isSolved independently and then
solution of all sub problems is combined to get solution of original
problem. This process is also called top down design.

Q#2.
What is debugging? What are different types of errors?

Ans:
debugging is a process of finding and removing errors from a
program. There are3 different types of
errors.1 ) S y n t a x e r r o r 2 ) R u n t i m e e r r o r 3 ) L o g i c a l
error
Syntax error

occurs when program violates grammatical rules (syntax) of


programminglanguage. Example: PINT, 5 = A etc
Runtime error

occurs when program performs illegal operation. This error occurs


when program is executing. When this error occurs, program stops exe
cution and showmessage. Example: Divide a number by Zero,
Memory overflow
Logical error

occurs when there is mistake in the logic of the program.


In this
case program runs but wrong out put is obtained. Interpreter does not
report any error message. Example: Area of circle A=2**R

Q#3.
What is Runtime Error? Give Example.

Ans:
Run time errors occur when program performs illegal ope
ration. This error occurs when program is executing. When this
error occurs, program stops execution andshow message.
Example: Divide a number by Zero, Memory overflow

Q#4.
What is Logical Error? Give Example.

Ans:
Logical errors occur when there is mistake in the logic of the program.
In this
case program runs but wrong out put is obtained. Interpreter does not r
eport any error message. Example: Area of circle => A=2**R

Q#5.
What is Desk checking? Give Example.

Ans:
Desk checking is a process of carefully observing the working of an
algorithm onthe paper for some sample data. Algorithm is
provided a variable set of input for whichoutput is checked
and algorithm is verified for correctness.
2

Example:
1 0 C l s 2 0 I n p u t

E n t e r
R a d
i u s
o f
c i r c l e ,
r E n t e r
r

=
3
n

5 3
0
A
=
*
r
*
.
1
4
*
5
7
8
.
5
4
t

A
r
,
A
A
r
8
.
5
50 end

3
r
*
0
e
e

.
A
5

4
=
=

P
a
a

r
=
=

>
i

Q#6.
What is Algorithm?

Ans:
Algorithm was invented by a Mathematician Moh
a m m a d B i n M u s a 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 followthese 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. Itconsists 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 fromuser 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.3

Q#8.

What are advantages of flow chart?

Ans:
These are advantages of flow charts
It is used to describe logic of program effectively and clearly.
It is used for maintenance of program.
It is a guide for the development of program.
It is helpful during debugging process.

Q#9.
What are limitations of flow chart?

Ans:
These are Disadvantages of flow charts
It is difficult to draw flow chart of complex problems.
If modifications are required then flow chart is to be redrawn.

Chapter # 2Data
types, I/O
statements
Q#1.
What are modes of BASIC?

Ans:
GW BASIC operates in two
Modes1 . D i r e c t M o d e 2 . I n d i r e c t M o d e

Direct Mode:

Commands do not preceded by Line numbers.

Commands are executed as they are typed.

Commands are lost after execution.

It is used for debugging and quick computations.


InDirect Mode:

Commands are preceded by Line numbers.

Commands are not executed as they are typed.

Commands are not lost after execution.

It is used for typing a program in BASIC.

Q#2. W
rite steps to SAVE a file in BASIC.

Ans:
After writing program, It must be stored on hard disk for later
retrieval.Following are steps to save file in BASIC.
Press F4 key OR type SAVE command.
Type the full path with valid file name and extension.4

Press Enter key. File will be saved on specified location.

Q#3. W
rite steps to LOAD a file in BASIC.

Ans:
Before executing a program, It must be loaded from hard disk to
the RAM.Following are steps to Load file in BASIC.
Press F3 key OR type LOAD command.
Type the full path with valid file name and extension.
Press Enter key. File will be loaded in memory.

Q#4.
What are reserved words in BASIC? Give Examples.

Ans:
Reserved words are also called Keywords. They have predefined
meaningsin 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, WENDGOTO, GO


SUB, LET

Q#5.
What is a variable? Write 5 rules for naming variables.

Ans:
It is a quantity whose value may change during the
execution of the program. It is name of the memory location. It is
used to store input data or resultsof computations.
Rules for variable Declaration

Variable name cant be more than 40 characters long.


First character of name must be alphabet.

Reserved words cant be used as variable name.


Blank spaces are not allowed in name.
Name can contain alphabets, digits, and special characters.

Q#6.
What is SAVE command? Give syntax with example.

Ans:
This Command is used to store file on disk for later use.

Syntax:SAVE
path with filename, [a]

SAVE
path with filename, [p]

Explanation:
By default file is saved in compressed binary format.If [a] is used then
file is stored in ASCII format. If [p] is used then file is stored
inencoded binary format (protected).5

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


calledinput 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 iscalled Output statement.
Example:

Examples of Output statement are

PRINT Statement

PRINT USING Statement

Q#8.
What are type declaration characters in BASIC?

Ans:
In BASIC, type declaration characters are used to represent
data type of aspecific variable.

C h a r a c t e r D a t a
T y p e E x a m p l e

S i
y

z e

$
g
S

S
N
t
l
%
g
r

t
a
r
e

h
e
a
2
e
e
i
4
D
r
A
y

o
o
e
r
t

i n

r
m
i
n

c
e
e

g
t
t
M
%
t
g

e
v
t
l
s

n
g

e
k
B

g
e

!
#

e
i

o r

n
r
s
y
n

r
A
y
b

p
n
B
u

p
o

n
B

Chapter # 3Control
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 structure2)Selection control
structure6

You might also like