Escolar Documentos
Profissional Documentos
Cultura Documentos
03009688161
10th Class Computer Science Notes
CHAPTER NO- 1 "Problem Solving"
What is meant by problem solving? What steps are involved in problem solving? Describe briefly.
Problem solving: - whenever we are writing a computer program, our purpose is to solve a problem
computationally. So the basic purpose of computer programming is solution of our daily life problems of different
areas. This process of programming is called problem solving. Problem solving is not just type a program and
then checking its output but it is a process in which multiple steps are involved. These steps are following:1. Define the problem:- First of all, problem is defined. What is purpose of program? What are inputs and outputs?
2. Solve the problem: - In second step, problem is solved theoretical on paper. Then program is written in general
English that is called Algorithm.
3. Drawing flowchart: - The flowchart is practical form of Algorithm, which is made with geometrical symbols.
4. Program coding: - In this step program is written on computer in appropriate computer language. After writing
the program. It is saved in computer.
5. Testing and debugging: - As program coding is completed then it is run, tested and corrected. This process
called testing and debugging.
6. Documentation: - In this process, comments and notes about working of program are written. They will help in
future to editing the program.
Define algorithm. Write down an algorithm to find the largest amongst three number a, b, c.
Algorithm:- The step by step procedure for solving a special problem is called algorithm.
An algorithm to find out greater number:1. Read any three numbers A, B, C.
2. If A is greater then B and A is greater then C, then print greater number A as a
3. If B is greater then A and B is greater then C, then print greater number B as a
4. If C is greater then A and C is greater then B, then print greater number C as a
What for we use flowcharts? Write down the standard flowchart symbols.
FLOWCHART:- A geometrical representation of the solution of a problem or algorithm of a program is called
flowchart.
It helps the programmers to understand the program algorithm.
It is very easy to translate a flow chart into program.
With a flow chart the document process can be done easily.
Symbols of flow chart:- These are different geometrical symbols that are used in drawing flowcharts. There are
many symbols used in flow chart but most easy and commonly used are:
1. Terminal symbol: - The terminal symbol is used to show the starting and finishing of a process.
Start/Stop.
2. Input output symbol: - The input output symbol use to input the data as well as the output of the result.
Read As, B
3. Processing symbol: - This symbol is used to show the processing.
Sum = A+B
4. Decision symbol: - This symbol is used to make decision.
Yes/No True/False
5. Arrows keys: - These are used to show the order is to be carried out arrows connect with complete diagram.
6. ON-Page connector: - If a flowchart is divided into many parts on the same page, the On-page connector
symbol is used to connect one part of the flowchart with another one.
7. OFF-Page connector:- Some time when an algorithm is large and complicated, the flowchart is drawn on more
than one page. In order to connect one part of the flowchart on one page with another part on another page, an
off-page connector symbol is used.
Some of the most frequently used BASIC Reserved words are given below.
ABC AND ASC ATN AUTO BEEP
CHRS CINT CIRLCE CLOSE COS DATA
DATES DEF DELETE END DIM ELSE
FILES FIX FN FOR GOSUB GOTO
IF INKEY$ INPUT KILL LIST LOAD
NEW MOD NEXT PRINT READ REM
RETURN RUN SAVE SQR STEP STOP
SWAP SYSTEM THEN TO WRITE etc.
Modes of Operations:- In BAISC there are two types of Modes are used:Direct Mode:- The direct Mode instruction are executed directly, to perform the desired task, as and when entered
without the need for using RUN command. After each direct command the screen display OK prompt.
Indirect Mode: - Each statement begins with a statement number; we call it Indirect Mode of operation. In this
case all the statement is stored in the memory and is executed only when RUN command is display.
Difference between:? Constant and Variable: - Constant is a value that can not be changed, while variable, unlike constant, change
their value during the execution of program.
? Numeric variable and String variable: - A numeric variable is used to hold only numeric constants. For
example: - A, XYZ, Ali etc. A string variable is used to hold characters. These characters may be alphabets,
number, or special symbols. For example NAME$, ADDRESS$, A1$.
? Commands and statements:- Commands is the name of action while a statement ask computer to do some
work. Each statement can be consists of one or more lines.
? Input statement and Red and Data statement:- Input statement is used to accept input data from keyboard and
assigns this to a variable. This input data may be a numeric value or character string.
Syntax: - [line no] Input {prompt} [variable] {variable}.
Example: - 15 INPUT A$, PH_NO
Read and data statement: - READ statement is used to assign numeric values
or character strings to variables. These numeric values or character strings are provided by DATA statement. For
each variable of READ statement there should be one value of same type in DATA statement.
Syntax: - [line no] READ [variable] {arable}
. [Line no] READ [variable] {arable}
Example:- 30 READ CITY$
40 DATA KAMOKE
Example:10 a = 0
20 a = a+1
30 print a
40 goto 20
50 end
Conditional transfer of control statements: - Those statements which transfer control to other part of the program
based on same condition are known as conditional transfer of control statements e.g. IF/THEN/ELS.
Example:10 cls
20 input marks
30 if marks>33then 50
40 if marks<33then 70
50 print you are pass
60 goto 80
70 print you are fail
80 end
Q NO 2:-What is nested loop? What rules must be followed when using nested loops?
Nested Loops:- By nested loops we means one loop within another loop.
Actually, sometimes we need to perform repetitive tasks within a loop. In such a situation we use Nested loops. Its
structure looks like.
10 FORK =1 TO 10
20
30
40 FORX = 1 TO 20
50
60
70 NEXTX
80
90
100 NEXTK
110 END
The rules for written single loops apply to nested loops. Other rules are;
1. Each nested loop must begin with its own FOR-TO statement and end with its own NEXT statement.
2. An outer loop and an inner lop cannot have the same index variable.
3. Each inner (nested) loop must be completely embedded with in the outer loop i.e; the loops cannot overlap.
4. Control can be transferred from an inner loop to a statement in an outer loop or to a statement out side of the
entire nest. However, control cannot be transferred to a statement with in a nest from a point out side the nest.
Q NO 3:-What is the difference between?
Loop: - a loop is a set of statement which is executed repeatedly.
Nested loop: - By nested loops we mean one loop within another loop.
Conditional transfer of control statements: - Those statements which transfer control to other part of the program
based on same condition are known as conditional transfer of control statements e.g. IF/THEN/ELS.
Unconditional transfer of control statements: - Those statements which do not need any condition to jumps form
one part of the program to another e.g., GOTO, ON, GOTO.
IF/THEN/ELSE and ON/GOTO statements: - It is similar to the IF-THEN statement, with an added power to
CHAPTER 6 Graphics
What is meant by computer graphics? What do you know about different modes of graphics in BASIC?
Explain.
Computer graphics: - Graphics is that area of computer programming which is highly in use these days. It is that
type of programming in which we draw text or pictures i.e., shape and images on the screen of the computer.
Types of Graphics: - There are three modes of drawing Graphics.
1. Text Mode: - It is the first mode of drawing graphics and it refers to drawing number, letter and special
characters (like $, % and so on) in the graphics form like high lighting, make them blinking or to convert them into
invisible form.
In text mode these characters are displayed in terms of 25 rows x 40 columns or 25 rows x 80 columns on the
screen of the computer monitor.
2. Medium-Resolution Graphics Mode:- In this mode of Graphics, the display is divide into a matrix consisting of
320 columns and 200 rows of pixels. This graphical mode works with 4 columns. The columns are numbered from
0 to 319 and the rows from 0 to 199.
3. High-resolution graphics Mode: - High-Resolution graphics Mode contains more pixels than the medium
resolution mode. In this mode the screen is divided into 640 columns and 200 rows which make a matrix of 640 x
200 pixels. This high resolution is used to facilitate more precise and clear drawing of graphics.
Why do we use CIRCLE statement? Explain with suitable example.
Some time we need to make a circle. In order to draw a circle, we use the CRICLE statements. This statement
has the following general form:
Line# CRICLE(X, Y), radius [colour].
Where (x,y) is the position of the point that is located at the center of the circle and radius is the radius of the
circle. The colour value is optional and is used to colour the circle with specific colour selected according to the
graphic mode and the available colour palette. An example may be:
20 CIRCLES (110,150), 70
Which is used to draw a circle of radius equal to 10 and having the pixel located at?
(110,150) as its center.
Example: - This program is used to draw a circle one with in another by using CRICLE statements, as following:
10 CLS
20 SCREEN 1
30 FOR = 60 TO 10 STEP 10
40 CRICLE (100,50);I
50 NEXT I
60 END
Write the purpose and complete syntax of DRAW statements. What types of shapes you can draw with
this statement? Give two examples.
This statement is used to draw lines and other shapes on the screen of the monitor. This statement is used in both
the resolution graphics modes, which are the medium resolution and high resolution graphics mode.
The general form of DRAW statements is:
Line # DRAW string
Where string may be enclosed in quotes and its contain commands to create a shape on the screen. This string
may be using one of the following commands:
When one of these commands is executed, a line is drawing n from the starting position which has been specified.
Thus this drawing utility of BASIC language is used to specify the number of points or pixels and the specific
direction in which the line is to be drawn.
By DRAW statements we draw the following shapes:This program is used to draw a square.
10 CLS
20 SCREEN 1
30 DRAWU40L50D40R50
Program 2:- This program is written to draw a rectangle.
10 CLS
20 SCREEN 1
30 DRAW U40R70D40L70
What is the role of SCREEN statements? Write down its different modes and their effect on the graphic quality.
SCREEN statement:- SCREEN statement insert effect on the graphic quality.
It must be notified that the statement SCRREN 1 is used to select an appropriate screen mode i.e., Medium
Resolution graphics mode. The general form of the SCREEN statement is:
Line # SCREEN Mode.
There are three modes of SCREEN statement:1. Mode = 0:- If mode = 0 that is, SCREEN 0, then text is selected.
2. Mode = 1:- If mode = 1 that is, SCREEN 1, then Medium Resolution mode of graphic will be set.
3. Mode = 2:- If mode = 2 that is, SCREEN 2, then High Resolution mode of graphic will be set.