Professional Documents
Culture Documents
Chapter # 1problem Solving: Q#1. Ans
Chapter # 1problem Solving: Q#1. Ans
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
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
Q#8.
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:
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
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:
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
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
Q#7.
What are I/O statements in BASIC? Give examples.
Ans:
I/O statements mean input and output statements.
Input Statement:
READ/DATA Statement
INPUT Statement
Output Statement:
PRINT 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