10th Class Computer Science Notes in English by Cstechz PDF
10th Class Computer Science Notes in English by Cstechz PDF
10th Class Computer Science Notes in English by Cstechz PDF
(C) Execution Error: - When the computer displays error massage at run time or execution time, even
though the program neither contains syntax nor logical error, then such type of errors is called
execution errors.
Ch Shahbaz
Page 1
Example: - Get three numbers, add Its and 2nd values and divided their sum by the 3rd value. The
result is then display on the serene.
10 Input A, B, C
20 D= (A+B)/C
30 PRINT D
40 END
When this program is run, it asks for values and then displays the output as:
? 10, 20, 30
1OK.
This works quite fine. However, if we enter 0 values for C means want to divide the sum of A and B by
0 then the computer displays the following errors message:
? 10,20,0
Division by zero
OK.
Ch Shahbaz
Page 2
Page 3
Page 4
Ch Shahbaz
Page 5
Page 6
Ch Shahbaz
Page 7
Ch Shahbaz
Page 8
Chapter- 5 "Subprograms"
Subprograms:- A subprogram is a set of statements which are written once in the program and used
or called many times in different places of program.
Basic language offers two types of sub programs.
1:-subroutnes subprograms
2:-functions Subprograms
Functions Subprograms: - Functions are those sub programs which are used to replace simple
process such as calculating the square of a number, finding out the natural logarithm of a number and
so on.
Subroutines subprograms: - Subprogram which are used to do complex programming operations like
calculating the roots of a quadratic equation, solving a matrix and soon.
What is the purpose of intrinsic functions?
Why do we use them? Explain with suitable examples the different types of intrinsic functions.
Purpose of intrinsic: - They perform the most basic operations
like calculating the square root, sine, cosine, language of angles and so on.
Why do we use them: - When we want to solve the most basic operations like calculating the square
root, sine, cosine, tanguage of angles and so on then we use intrinsic functions.
Types of intrinsic functions: - Then are categorized follows:1. Numeric function: - The number of built-in functions which
can be used for mathematical calculations. These functions
return a number as their results.
They are: Trigonometric functions:Functions purpose
Sin(X) Calculates the sine of X.
Cos(X) Calculates the cosine of X.
Tan(X) Calculates the tangent of X.
Atn(X) Calculates the tangent inverse (arctangent) of X.
Arithmetic functions:Functions purpose
SQR(X) Calculates the square root of a given number.
LOG(X) Calculates the natural logarithm of X.
EXP(X) Calculates the exponential value of X.
2. String Functions:- The number of built-in functions
which can be used for manipulations of string data.
These functions return string and numeric values as their result.
They are:Functions purpose
LEFT$(Sring,n) Selects the left most n characters of the given string.
If n is greater then the number of characters
Contained in the string, the entire string will be printed.
RIGHT$(String,n) Selects the right most n character of the given string.
3. String$ functions:- This string functions is used to repeatedly print out a character specified by the
given ASCII number to the function STRING$. This functions has the following general form:
STRING$(N,M).
Exp:- 60 PRINT STRING$(3,67)
4. Time$ functions:- The TIME$ is a built-in functions in
BASIC which is related with system time. It is used to show
the current time or used to set the new time of the system.
Exp:- 10 PRINTTIME$ and
20 TIME$ =16:00:00
5. Date$ functions:- Like time$ functions Date$ functions is
used to display the current date, or set the new date of the system.
The general syntax as:Line DATE$.
Exp:- 10 DATE$ =03-07-2001
6. ASC functions:- It is the inverse of CHR$ function,
which returns corresponding character for a given ASCII value,
because it returns the ASCII code for a given character.
Its general form is : ASC(X$)
10 PRINT ASC (ABC).
7. LEN Function:- This function is used to print the total
number of characters contained in the string. It has the general from like.
LEN(X$)LEN () Will print 0 where
LEN (Nafid ullah khan).
Ch Shahbaz
Page 9
8. VAL function:-This function is used to return to return the numeric value of the given string argument
in a string of numbers enclosed in the double quotation. It must be noted that the string must be the
combination of number. Its general form.
VAL(X$)
Exp:- A$= 852772
9. OCT$ function:- This functions is used to calculate the equivalent of a decimal number in the octal
number system. The general form:
OCT$(Decimal Number).
10. HEX$ function:- That is used to calculate the Hexadecimal equivalent of a number which is in the
decimal number system. The general form:
HEX$(Decimal Number).
Ch Shahbaz
Page 10
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:
Un is used to move up n points or pixels.
Dn for moving down by n points or pixels.
Fn for moving left n points or pixels.
R for moving right n points or pixels.
En for moving diagonally down and right by n points i.e., pixels.
Gn for moving diagonally down and left by n points i.e., pixels.
Hn for moving diagonally up and left by n points or pixels.
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
Ch Shahbaz
Page 11
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.
Page 12
Zoom: - This option is used to display current file according your own percent.
Q NO 5:- Write the purpose of the following?
(1) Replace: - In the help of this option we replace one text to another.
(2) Footnotes: - In the help of this option we write comments in the end of the documents.
(3) Style: - In the help of this option we change the font in different style.
(4) Filed: - In the help of this option we select any filed for us.
BASIC STATEMENT
LET STATEMENT: - It is one of the most fundamental and most important statements of BASIC
language. This statement is also called as assignment statement, because it is used to assign a
numeric or string value to a variable. LET statement has the following general form:
Line# LET Variable = [constant]
[Variable]
[Expression]
Exp:Let A$=NAFID Let X = 8
Let B$=YULIA Let Y = X+2
Let B$ = A$ Let X = X+Y
Let A$ = B$ PrintResult = ;Z
PRINT A$,B$ End
END
PRINT STATEMENT:- Print statement is used to display the data on the screen. It can be used to
display message, value of variables and to print the answers of arithmetic expression. The PRINT
statement has the following form:
Line # PRINT [OR?] [Constant]
[Variable]
[Expression]
Exp:To Print Blank lines:10 PrintNAFID ULAH
20 Print
30 PrintYULIA
40 Run
To Print Constants: Printsoma
10 Print 9 PrintHell! How are you?
20 Print -100 PrintWellcome to show
30 Print 3.14159 Print **************
40 Print 1.23E+2 Run
50 Run
LPRINT STATEMENT: - It is used for printer output. It is used to print output data on the printer rather
than on the screen. It has the following general form:
Line# LPRINT {Constant, Variable, and/ Expression}
Exp:
20 LPRINT X; Y; Z
PRINT USING STATEMENT:- It is used for formatted that is allows printed output to be formatted.
Both numeric and string data can be rounded as well as +,-,$ Signs can easily be inserted in the
output result. Syntax:
Line# PRINT USING Format string; List-of-expressions
10 Print using####; 44
REM STATEMENT: - REM Statement is used to include comments/remarks in BASIC program. This
statement consists of statement number followed by the keyword REM, followed by any remarks. It
has the following general form:
1. Line # REM [OR,] Any Comments.
Exp:
10 This is a comment line.
END STATEMENT:- END statement is used to terminate the execution of the program. It can be given
anywhere in the BASIC program physically but logically it must be the very last statement of the
program. Though the END statement is optional to use, but it is a good programming practice to
include the END statement in all BASIC programs. The END statement has the following format:
LINE# END
LOOP: A loop is an instruction or group of instruction that the computer executes repeatedly to a
specified number of time or until some terminating satisfied
Or
Repetition of statement
1:
Ch Shahbaz
Page 13
10 For I=2 to 20
20 Print I
30 next
10 For I = 2 to 20 step 2
20 print I
30 next
BASIC COMMANDS OF BASIC LANGUAGE
Auto Commands (Alt+A):Auto Commands are used to generate the line number automatically.
Syntax: - Auto (Enter).
Syntax: - Auto 2 (Enter).
Syntax: - Auto 100 (Enter).
Syntax: - Auto 10, 50 (Enter).
Syntax: - Auto 100,100 (Enter).
To End Page Break: - Clt+Break.
List Commands (List). (F1)
Its produce the entire list of the program on the screen.
Syntax: - List (Enter).
Syntax: - List 40 (Enter).
Syntax: - List 100-200 (Enter).
Syntax: - List -80 (Enter).
Syntax: - List 80 (Enter).
Renum Commands:The Renum commands are used to renumber the program statements numbers.
Syntax: - Renum (Enter).
Files Commands:To display all Basic Files.
Syntax: - Files (Enter).
Kill Commands:It is used to delete Basic files permanents.
Syntax: - Kill File name.bac (Enter)
Key Commands:It is used to change the name of the file.
Syntax:- Nameold file nameAS new file name (Enter)
Reference
http://www.cstechz.com/gw-basic-urdu-part-5-10-class/
http://www.cstechz.com/gw-basic-urdu-part-4-10-class/
http://www.cstechz.com/gw-basic-urdu-part-2-10-class/
http://www.cstechz.com/gw-basic-urdu-part-1-10-class/
http://www.cstechz.com/gw-basic-urdu-part-3-10-class/
https://www.youtube.com/watch?v=MFp2d1WBeZg
Ch Shahbaz
Page 14