Sunteți pe pagina 1din 20

Notes for Class 10th

- 41 -

AL-MUSTAFA PUBLIC SCHOOL AND COLLEGE GILGIT

Computer notes

For class 10th (CHAPTERS)

Published By: Muhammad Jalil Instructor Al-Mustafa Public School and College Gilgit.

Prepared by MUHAMMAD JALIL AL-MUSTAFA PUBLIC SCHOOL AND COLLEGE GILGIT

Notes for Class 10th

- 42 -

DATA AND DATA PROCESSING


Data and types of data
Data is the plural of Datum, which means raw facts. It is a representation of facts, concept or instructions in a formalized manner suitable for communication, interpretation or processing by human or automatic means. Data usually represents some aspects of the physical world around us, such as a list of names, addresses, date and time or bank statements. In other words data is a collection of symbols or information which is provided to the computer. There are two types of data. 1. Numeric data 2. Alphabetic data 3. String data / Alphanumeric data 1. Numeric data: Numeric data is used to represent some special characters. This contain 0 to 9 numbers, a decimal point, + - * / sign and alphabets A or B. The numeric data is further divided into two types. 1. Integer data 2. Real data 2. Alphabetic data: This form of data consist of Alphabets of English and some special symbols For example *, &, @, #, $, etc. 3. String data: String data is used to represents letters of alphabets A to Z or a to z, numbers 0 to 9 and special characters such as !, @, #, $ etc. Define data processing cycle in detail. There are three main steps involved in data processing cycle. 1. Input 2. Processing 3. Output Input Processing Output 1. Input: The source data entering to the system is called input. Input data captured by keyboard or other direct input device. Input would be different types. Such as commercial, scientific, statistical, etc. 2. Processing: The orderly planned instruction in the system is called processing. One or more operations to be performed in the processing. Such as classifying, calculating, sorting and summarizing etc. 3. Output: The results of processing step are called the output. The processing data transfer one location to another, for further processing until information reaches the final user. Differentiate between data and information.
Prepared by MUHAMMAD JALIL AL-MUSTAFA PUBLIC SCHOOL AND COLLEGE GILGIT

Notes for Class 10th


1. Data:

- 43 -

Data is the plural of word datum, which means raw facts. The collection of facts and figures is called data e.g. name, address, date and cost etc. 2. Information: Information is data which has been transformed into meaningful and useful results is called information e.g. report card, pay slip and project reports etc.

Define Constant and variable?


Constant: The data whose value remains the same during program execution is called constant. There are two types of constants. 1. Numeric constant 2. String constant 1. Numeric constant: They consist of numbers, which can take part in mathematical calculations. For example A = 5, Balance = 500, Fee = 300, etc. 2. String constant: They consist of alphabets, numbers and special characters, and are always written within quotation marks. For example B$ = Hello, AD$ = 153, DATE = 15/05/2005, etc. Variable: The data whose value remains not the same and change during the program execution is called variable. Variable are of two kinds. 1. String Variables 2. Numeric variables. String Variable: String variable consist of variables which are represent in Alphabetic data. When we use string variable in BASIC program, we must should write dollar sign ($) with it. For example PK$ = Pakistan Numeric Variable: Numeric variable consist of numeric data and not be used dollar sign ($) with it

NUMBER SYSTEM
Q1. What is number system? Discuss different number system. Human during the evolution of civilizations has invented many numbers system. All number system used to suit different working condition and requirements. The total number of digits used in a number system is called its base or radix. Some number systems are discussed below. 1. Decimal number system: This number system we used in our daily routine work. It consists of ten digits that are from 0 to 9. Therefore base of this system is 10. 2. Binary number system: Computer can process only binary numbers. This number system consists of two digits, the 0 and 1. Therefore base of this system is 2. 3. Octal number system:
Prepared by MUHAMMAD JALIL AL-MUSTAFA PUBLIC SCHOOL AND COLLEGE GILGIT

Notes for Class 10th

- 44 -

This system is a short hand version of binary numbers. It consists of eight digits that are from 0 to 7. Therefore base of this system is 8. 4. Hexadecimal number system: This is also short hand version of binary numbers. It comprises of sixteen numbers, the 0 and 15. Therefore the base of this system is 16. Here the symbols A,, F in hex stands respectively for 10,,15 in decimal. Q2. Convert the following decimal number into other number system. Conversion of decimal into any other number is very simple and easy. Just divide the decimal number by the base in which conversion required, remainder save and continuing the same procedure till the decimal number become less then the base. After that stored remainder write from bottom to top as result. 1. Convert (23)10 and (20)10 into binary number system. 2 2 2 2 23 11 1 5 1 2 1 1 0 (10111) 2 2. 2 2 2 2 20 10 0 5 0 2 1 1 0 (10100) 2

Convert (8610) 10 and (9001) 10 into octal number system. 8 8 8 8 8 86610 1076 134 16 2 2 4 6 0 8 8 8 8 8 9001 1125 140 17 2 1 5 4 1

(20642)8 (21451) 8 Q3. Convert the following Binary number into other number system. Conversion of any other number system to decimal number system is also a easy task. Simply each digit multiplied by its base and then add it. The base must containing appropriate power. The procedure of converting into decimal number is shown in the following example. 1. Convert the binary number into decimal number system. (11101)2 = 124 + 123 + 122 + 0 21 + 1 20 = 116 +18 +14 + 02 +11 = 16 + 8 + 4 + 0 + 1 = (29)10 Convert the octal number into decimal number system. (357)5 = 3 82 + 5 81 + 7 80 = 3 64 + 5 8 + 7 1 = 192 + 40 + 7 = (239)10

2.

Prepared by MUHAMMAD JALIL AL-MUSTAFA PUBLIC SCHOOL AND COLLEGE GILGIT

Notes for Class 10th

- 45 -

Chapter 6

Boolean Algebra
Boolean Algebra
The Boolean algebra was developed by the English mathematician George Boole. It deals with statements in mathematical logic, and puts them in the form of algebraic equations. The modern American mathematician Cluade Shannon fourth developed the Boolean algebra, in order to apply to computer. Boolean algebra is used in designing of logic circuits inside the computer. These circuits perform different types of logical operations. ELEMENTS OF BOOLEAN ALGEBRA: In Boolean algebra an expression can be formed using binary variables, constants, symbols of logic operations and parentheses. BOOLEAN VARIABLES:The variables used in Boolean algebra can be represented by letters of the alphabetic having values;1 and 0. BOOLEAN CONSTANTS:In Boolean algebra a set of constants has only two elements 0 or 1.. Thus Boolean constant is either 0 if not 1. or is 1 if not 0. BOOLEAN OPERATORS:AND OPERATION: In Boolean algebra AND operator is represented by a dot or by the absence of any symbol between two variables and is used for logical multiplication. For example: A.B =X or AB=X OR OPERATION: Or operation is represented by a plus sign between two variables. In Boolean algebra OR is used for logical addition. For Example A+ B=X NOT OPERATORS: NOT operation is a unary operation which is the negation of the value of a variable on which NOT operates. SIMPLIFICATION OF BOOLEAN FUNCTION The basic approach is to proceed from a statement of the function to a truth table and then to a Boolean expression of the function. This Boolean expression is then simplified as much as possible using Boolean rules. TROUTH TABLE: A truth table is a table that shows the result of a Boolean Expression for all the possible combinations of the values given to the variable. KARNAUGH MAPS Kamaugh map provides a systematic method for simplifying Boolean expressions and if properly used will produce the simplest SOP or POS expression possible. A karnaugh is similar to a truth table because it presents all of the possible values of input variables and the result ion output for each value. Karnaugh maps can be used for expressions with two, three, four, and five variables.

Prepared by MUHAMMAD JALIL AL-MUSTAFA PUBLIC SCHOOL AND COLLEGE GILGIT

Notes for Class 10th

- 46 -

PROBLEM SOLVING TOOL FLOW CHART


Flow chart and types of flow chart
The flow chart is a graphical pictorial representation of the sequence of operation to be performed in data processing job. Before writing the program in programming language the programmer frequently prepares a flow chart to establish a clear definite and complete plan of what the program is aspect to do. It is very useful tool to record, analysis and communication all information concerning a problem. There are two types of flow chart. 1. System flow chart 2. Program flow chart 1. System flow chart: A system flow chart is a diagram that shows the flow of whole data processing cycle on whole structure of a company is represented by system flow chart. 2. Program flow chart: A program flow chart is use to show the logic of instruction which are given to the computer where as the program from chart gives a detailed and complete picture of what task are to be performed by the program. Q2. Draw and define each of the following symbols of program flow chart. Terminal, Parallelogram, Rectangle, Diamond, Connector, Flow line 1. Terminal (Oval): This symbol is used to indicate a starting and stopping point in a flow chart. It is the first and last step of flow chart. 2. Parallelogram (Input/Output box): This symbol is used to indicate any input/output operation such as read and write.

3. Rectangle (Process box): A process box is used to indicate any type of arithmetic calculation and data movement instructions. Mathematical formulas are use to in this box.

4. Diamond (Decision box): The decision symbol is used to indicate a decision or action the computer is to be taken. A decision box contains a question with Yes or No answer.

Prepared by MUHAMMAD JALIL AL-MUSTAFA PUBLIC SCHOOL AND COLLEGE GILGIT

Notes for Class 10th

- 47 -

5. Connector (Circle): If the program is long and a many places flow lines cries crossing that cause confusion, so that flow chart connected by the connector. On page connector connect the flow at the same page. 6. Flow line (Arrow): The flow chart symbols are connected together by means of flow lines. Flow lines indicate the flow of operation.

Main steps uses in the preparation of computer program


The following main steps involved in the solution to solve the problem. 1. Define the problem: A problem is the object or task, so that it must be well defined to achieve all benefits or goals. 2. Solve the problem: An algorithm enables the computer to solve a problem, so algorithm should be designed carefully. 3. Drawing flow chart: A flow chart is a pictorial or graphical representation of the logic or algorithm. It is better to meet any problem with the help of a flow chart. 4. Program coding: Program and flow chart written step by step in any computer language is called coding. 5. Testing and debugging: Debugging means to find and remove the errors from the computer program. 6. Documentation: This aid helps for understanding of program flow and its structure.

Prepared by MUHAMMAD JALIL AL-MUSTAFA PUBLIC SCHOOL AND COLLEGE GILGIT

Notes for Class 10th

- 48 -

BASIC PROGRAMMING LANGUAGE


BASIC language
Basic is high level programming language used for the purpose writing a program on a computer. Its stands for Beginners All purpose Symbolic Instruction Code. Basic language was developed at Dartmouth College in mid 1960s under the direction of Dr. J.G. Kemeny and Dr T.E. Kurtz. The American National Standards Institutes (ANSI) standard for minimal version of Basic that was published in 1978. It is very simple and similar to English language. Basic language has used in all fields of life for example engineering, accounting, education, business and science. Basic has also graphic facilities and sound generating system.

BASIC OPERATORS:
Operators are lexical entity that indicates the action to be performed on operands. Operators perform mathematical or logical operation on value. There are three types of operators. 1. Arithmetic operators 2. Relational operators 3. Logical operators 1. ARITHEMATIC OPERATORS: The arithmetic operators perform the usual operation of arithmetic such as addition and subtraction. In order of precedence, they are: OPERATORS + * / ^ OPERATION Addition Subtraction Multiplication Division Exponentiation/Power

2. RELATIONAL OPERATORS: The relational operators compare two values. The values may be either numeric or both strings. The result of comparison is either true or false. OPERATORS = <> < > <= or =< >= or => RELATION TESTED Equality Inequality Less than Greater than Less than or equal to Greater than or equal to

3. LOGICAL OPERATORS:
Prepared by MUHAMMAD JALIL AL-MUSTAFA PUBLIC SCHOOL AND COLLEGE GILGIT

Notes for Class 10th

- 49 -

The logical operators perform logical calculation. Logical operators combination of true or false values and return are true or false result. OPERATORS NOT AND OR OPERATION Logical complement Conjunction Disjunction

Difference between direct and indirect mode


DIRECT MODE: In direct mode commands and statements are executed immediately each direct statement followed by a carriage return. Result of arithmetic, logical and functional operations may be displayed immediately but the instructions are lost after execution. INDIRECT MODE: In indirect mode commands and statements used for entering programs. Program lines are always preceded by line numbers, and are stored in memory. The program stored in memory executed by entering the RUN command. Q4. Write down the short notes on the following. 1. Commands 2. Statements 3. Functions 1. COMMANDS: The commands are normally used direct and indirect mode to operate Basic language. Also commands returns the control at command level after execution for example LIST, AUTO, NEW etc. 2. STATEMENTS: The statements are normally used with a line number and it is indirect mode. Its make a program instruction and its may be save on disk or any other device for example INPUT, REM, END etc. 3. FUNCTIONS: The functions are also reserved words but its different to command and statement. Function call a predetermined operation that is to be performed on one or more operands for example CHR$, LEN, ABS etc.

Prepared by MUHAMMAD JALIL AL-MUSTAFA PUBLIC SCHOOL AND COLLEGE GILGIT

Notes for Class 10th


Command and Statement.

- 50 -

Command: 1. The instructions which a computer process immediately and output a result at the time of enter key pressing are called command. 2. Commands are written without line number. Statement: 1. The instructions which a computer process but the output provide at the time of program execution are called statements. 2. The statements are written with line number. This line number must be written in the start of statement.

ERRORS
1. Syntax error and Logical error 2. Bug and Debugging SYNTAX ERROR: Syntax error is computer grammatical mistake, such as an unmatched parenthesis, incorrect punctuation or used incorrect spelling of command and statement. This type of errors is very easy to find and correct. LOGICAL ERROR: Logical errors are much more difficult to detect, since the output resulting from a logically incorrect program may appear to be error free. BUG: An error malfunctions in computer program and computer system is called bug. DEBUGGING: To locate and correct any error in a computer program and computer system is called debugging.

Prepared by MUHAMMAD JALIL AL-MUSTAFA PUBLIC SCHOOL AND COLLEGE GILGIT

Notes for Class 10th SYNTAX OF BASIC


Q1. Write down the purpose, syntax and examples of the following. OR Q1. Write down the format of the following. 1. AUTO: (command) Syntax: AUTO [line no.] Purpose: Generate the line numbers automatically. Example: AUTO or AUTO 5 or 2. RENUM: (command) Syntax: RENUM [new no.] Purpose: Renumber the program lines automatically. Example: RENUM or RENUM 100 3. LIST: (command) Syntax: LIST [starting line no.]-[ending line no] Purpose: Display all or part of the program currently in memory. Example: LIST or LIST 10-100 or LIST 100or

- 51 -

AUTO 100,5

LIST 100

4. DELETE: (command) Syntax: DELETE [starting line no.]-[ending line no.] Purpose: Erase the specified range of lines of the program from computer memory. Example: DELETE 40 or DELETE 50-200 5. EDIT: (command) Syntax: EIDT [line no.] Purpose: Display the specified line and change the line. Example: EIDT 50 6. LOAD: (command) Syntax: LOADfile name Purpose: Reads a program from a specified device and store it in memory. Example: LOADTEST or LOADTEST,R 7. SAVE: (command) Syntax: SAVEfile name Purpose: Save a program file in a disk. Example: SAVETEST or SAVEB:TEST 8. RUN: (command) Syntax: RUN Purpose: Execute of the program currently in memory. Example: RUN 9. NEW: (command) Syntax: NEW Purpose: Delete the program currently in memory and clear all variables. Example: NEW
Prepared by MUHAMMAD JALIL AL-MUSTAFA PUBLIC SCHOOL AND COLLEGE GILGIT

Notes for Class 10th


10. SYSTEM: (command) Syntax: SYSTEM Purpose: Close all open files and return control to the operating system. Example: SYSTEM 11. CLS: (statement) Syntax: CLS Purpose: CLS is used to clear the entire screen. Example: CLS or 10 CLS 12. REM: (statement) Syntax: REM remarks Purpose: To put a remarks or comments in a program. Example: 5 REM practical no. 1

- 52 -

13. INPUT: (statement) Syntax: INPUT string[;/,]variable Purpose: To take the instruction from keyboard during the execution of program. Example: 50 INPUT enter name, N$ 14. PRINT: (statement) Syntax: PRINT string[variable] Purpose: To transmit the data and output on a screen. Example: 40 PRINT YOUR NAMEN$ 15. LET: (statement) Syntax: LET variable=expression Purpose: To assign the value of expression to a variable. Example: 20 LET A=4 or 30 LET N$=ALI 16. GOTO: (statement) Syntax: GOTO line no. Purpose: To branches unconditionally to the specified line number. Example: 100 GOTO 20 17. KEY: (statement) Syntax: KEY n,text, KEY LIST, KEY ON/OFF Purpose: To assign the function key, display the list of function keys and on/off the key. Example: KEY 2,FILES or KEY LIST or KEY ON or KEY OFF 18. FILES: (command) Syntax: FILES Purpose: Display all names of files/programs from specified disk. Example: FILES or FILESB: 19. END: (statement) Syntax: END Purpose: To terminate the program execution and return to command level. Example: 100 END 20. STOP: (statement)
Prepared by MUHAMMAD JALIL AL-MUSTAFA PUBLIC SCHOOL AND COLLEGE GILGIT

Notes for Class 10th


Syntax: STOP Purpose: To terminate the program execution and return to command level. Example: 100 STOP

- 53 -

21. CONT: (command) Syntax: CONT Purpose: Resume execution of an interrupted operation. Using Stop and End statement. Example: CONT 22. KILL: (command) Syntax: KILL filename Purpose: Delete a file/program from a diskette. Example: KILL test.bas 23. NAME: (statement) Syntax: NAME old filename AS new filename Purpose: To change the old file name in new file name. Example: NAME test.bas AS Nasir.bas 24. SHELL: (statement) Syntax: SHELL Purpose: To temporary exit from Basic to Dos command prompt. Example: SHELL 25. LOCATE: (statement) Syntax: LOCATE [row,column] Purpose: Moves the cursor to the specified position. Example: 30 LOCATE 5,10 26. SWAP: (statement) Syntax: SWAP variable, variable Purpose: To interchange the value of two variables. Example: 50 SWAP A, B or 60 SWAP A$,B$ 27. IF-THEN-ELSE: (statement) Syntax: IF [expression] THEN [statement] ELSE [statement] Purpose: To make a decision on the result of an expression. Example: 60 IF a=10 THEN 70 ELSE 20 28. FOR-NEXT: (statement) Syntax: FOR variable=starting no. TO ending no. [STEP] : NEXT Purpose: To perform a repetitive loop for given number of time. Example: 20 FOR A=1 to 10 : 100 NEXT A 29. GOSUB-RETURN: (statement) Syntax: GOSUB [line no.] : RETURN Purpose: To branch a subroutine and return from a subroutine. Example: 30 GOSUB 40 : 70 RETURN 30. READ-DATA: (statement)
Prepared by MUHAMMAD JALIL AL-MUSTAFA PUBLIC SCHOOL AND COLLEGE GILGIT

Notes for Class 10th


Syntax: READ variables : DATA data Purpose: To assign the numeric or string values in variables. Example: 40 READ A,N$ : 80 DATA 123,ALI 31. DIM: (statement) Syntax: DIM variable (subscript) Purpose: To assign the values of array variable subscript & allocate storage accordingly. Example: 20 DIM A (3), N$(3) 32. WHILE-WEND: (statement) Syntax: WHILE condition: WEND Purpose: To perform a conditional loop. Example: 30 WHILE A<10 : 90 WEND 33. TRON: (command) Syntax: TRON Purpose: To trace the execution of program statement. Example: TRON 34. TROFF: (command) Syntax: TROFF Purpose: To turn off the tracing of program execution. Example: TROFF

- 54 -

35. ON-GOSUB: (statement) 36. ON-GOTO: (statement) Syntax: ON [variable] GOSUB [line no. list] ON [variable] GOTO [line no. list] Purpose: Branches one or more specified line nos. depending on the value of expression. Example: 20 ON choice GOSUB 30,40,50 or 20 ON choice GOTO 30,40,50 37. CHAIN: (statement/command) Syntax: CHAIN file name Purpose: To call a program into memory and execute the program. Example: CHAIN test 38. LLIST: (command) Syntax: LLIST [starting line no.]-[ending line no.] Purpose: Print all or part of the program on the paper. Example: LLIST or LLIST 50-150 or LLIST 100 or LLIST 10039. LPRINT: (statement) Syntax: LPRINT expression Purpose: To print data or output on a paper. Example: 40 LPRINT NAME : NASIR 40. MERGE: (command) Syntax: MERGE file name Purpose: To combine a program into the program currently in memory.
Prepared by MUHAMMAD JALIL AL-MUSTAFA PUBLIC SCHOOL AND COLLEGE GILGIT

Notes for Class 10th


Example: MERGE TEST 41. MKDIR: (command) Syntax: MKDIR directory name Purpose: To create a directory on the specified disk. Example: MKDIR ABC 42. CHDIR: (command) Syntax: CHDIR directory name Purpose: To allow you to change the directory. Example: CHDIRABC or CHDIR.. 43. RMDIR: (command) Syntax: RMDIR directory name Purpose: To remove a directory from specified disk. Example: RMDIR ABC

- 55 -

(GRAPHIC STATEMENTS)
44. SCREEN: Syntax: SCREEN [mode] Purpose: To sets the specifications for the display screen. Example: 20 SCREEN 0,0,0 or 20 SCREEN 1 or 20 SCREEN 2 45. CIRCLE: Syntax: CIRCLE (x,y),radius Purpose: To draw a circle, arc and ellipse on the screen. Example: 40 CIRCLE (100,160), 80 46. LINE: Syntax: LINE (x1,y1)-(x2,y2),color,box Purpose: To draw a line or box on the screen. Example: 30 LINE (10,50)-(30,40),2 47. DRAW: Syntax: DRAW string expression Purpose: To draws an object as specified by a string expression. Example: 20 DRAW f60 l120 e60 Dn=Move down Fn=Move diagonally down right Un=Move up Gn=Move diagonally down left Ln=Move left Hn=Move diagonally up left Rn=Move right En=Move diagonally up right Bn=Mover but no plot draw Nn=Move but return to previous position n=Number 48. PSET: Syntax: PSET (x,y),color Purpose: To set the pixel position on the screen. Example: 20 PSET (50,80),2 49. PAINT: Syntax: PAINT (x,y),[color,border,background] Purpose: To fill a diagram or area with a color and pattern. Example: 20 PAINT (100,160),2

(FUNCTIONS)
Prepared by MUHAMMAD JALIL AL-MUSTAFA PUBLIC SCHOOL AND COLLEGE GILGIT

Notes for Class 10th


50. ABS(): Syntax: ABS(x) Purpose: To return the absolute value of the numeric expression. Example: ? ABS(-5) 51. ASC(): Syntax: ASC(x$) Purpose: To display the ASCII code for the character of the string. Example: ? ASC(a) 53. CHR$(): Syntax: CHR$(n) Purpose: To converts an ASCII code to its character equivalent. Example: ? CHR$(65) 54. COS(): Syntax: COS(x) Purpose: To display the trigonometric function. Example: ? COS(45) 55. DATE$: Syntax: DATE$ Purpose: To display and set the system date. Example: ? DATE$ or DATE$=07-30-00 56. EXP(): Syntax: EXP(x) Purpose: To calculate the exponential function. Example: ? EXP(2) 57. HEX$: Syntax: HEX$(x) Purpose: To convert the decimal value in hexadecimal value. Example: ? HEX$(50) 58. INKEY$: Syntax: INKEY$ Purpose: To read a single character from the keyboard. Example: Y$=INKEY$ 59. INSTR(): Syntax: INSTR([n],x$,y$) Purpose: To search the location of specified string. Example: ? INSTR(x$,y$) or ? INSTR(n,x$,y$) 60. INT(): Syntax: INT(x) Purpose: To return the integer value. Example: ? INT(50.45)
Prepared by MUHAMMAD JALIL AL-MUSTAFA PUBLIC SCHOOL AND COLLEGE GILGIT

- 56 -

Notes for Class 10th


61. LEFT$(): Syntax: LEFT$(x$,n) Purpose: To return the given number of character form left side. Example: ? LEFT$(paksitan,3) 62. LEN(): Syntax: LEN(x$) Purpose: To return the number of character in a string. Example: ? LEN(Pakistan) 63. LOG(): Syntax: LOG(x) Purpose: To return the natural logarithm of a value. Example: LOG(2.5) 64. MID$(): Syntax: MID$(x$,n1,n2) Purpose: To return the requested part of a given string. Example: ? MID$(Pakistan,4,2) 65. OCT$(): Syntax: OCT$(x) Purpose: To converts the decimal value in octal value. Example: ? OCT$(45) 66. RIGHT$(): Syntax: RIGHT$(x$,n) Purpose: To return the given number of character from right side. Example: ? RIGHT$(Pakistan,2) 67. SIN(): Syntax: SIN(x) Purpose: To calculate the trigonometric sine function. Example: ? SIN(30) 68. SPACE$(): Syntax: SPACE$(x) Purpose: To returns a sequence if blank spaces. Example: SPACE$(8) 69. SPC(): Syntax: SPC(x) Purpose: To generate blank spaces in a print statement. Example: ?SPC (5) 70. SQR(): Syntax: SQR(x) Purpose: To return the square root of a given value. Example: ? SQR(64)
Prepared by MUHAMMAD JALIL AL-MUSTAFA PUBLIC SCHOOL AND COLLEGE GILGIT

- 57 -

Notes for Class 10th


71. STR$(): Syntax: STR$(x) Purpose: To converts numeric value in string value. Example: ? STR$(56) 72. STRING$(): Syntax: STRING$(n,x$) Purpose: To return the string of a given character. Example: ? STRING$(50,=) 73. TAB(): Syntax: TAB(x) Purpose: To set the column position on the screen or printer. Example: TAB(10) 74. TAN(): Syntax: TAN(x) Purpose: To return the trigonometric tangent function. Example: ? TAN(45) 75. TIME$: Syntax: TIME$ Purpose: To display and set the system time. Example: ? TIME$ or TIME$=12:30 76. VAL(): Syntax: VAL(x$) Purpose: To convert the string value in numeric value. Example: ? VAL(x$)

- 58 -

Discuss statement-causing transfer of control.


The transfer control statement is used to perform loops to repeat part of a program multiple times. Sometimes, however, it is necessary to jump to some other part of the program, thus altering the normal sequence of execution. Therefor, the conditional transfer control is used to produce looping effect.

Difference between a GOTO, ON-GOTO and IF-THEN statement.


1. GOTO: The GOTO statement refers to a jump as an unconditional branching operation. This statement consists of a statement number, followed by the keywords GOTO and the number of the statement to which control will be transferred. This type of loop is called infinite looping. 2. ON-GOTO: This statement is used to multiple branching. This statement contains a numeric variable or formula and two or more numbers of remote statements. This statement is normally used in the selection of choice. The choice is controlled by a variable and on the basis of its value.

3. IF-THEN:
Prepared by MUHAMMAD JALIL AL-MUSTAFA PUBLIC SCHOOL AND COLLEGE GILGIT

Notes for Class 10th

- 59 -

This statement is used to carry out a conditional branching operation. It transfers control to a specific portion of a program depending on the condition. If the condition is true then the control will be transferred to the first executable statement and if the condition is false the control will be transferred to the next executable statement.

FOR-NEXT loop
The FOR-NEXT statement specifies how many times the loop will be executed. This statement included in the FOR-NEXT statement and numeric variable called the running variable, whose value changes each time the loop is executed. The variables are specifying initial and final values. This loop always begins with a FORTO statement; it always ends with a NEXT statement. The complete loop included between the FOR-TO and the NEXT statement.

Nested loop with atleast two examples.


One loop is imbedded with another loop is called nested loop. Each nested loop must begin with its own FOR-TO statement and end with its own NEXT statement. Each inner loop must be completely imbedded with an outer loop. An outer loop and an inner loop cannot have the same running variable. An outer loop can have several inner loops, which may or not be nested. Example 1 Example 2 10 FOR A=1 TO 5 10 FOR L=1 TO 75 20 FOR B=1 TO 3 20 FOR C=1 TO 100 30 ? A;B 30 LOCATE 1,L:? NASIR 40 NEXT B 40 NEXT C 50 NEXT A 50 NEXT L

Difference between the counter loops and controlled loops


COUNTER LOOP: The counter loops are used to execute a set of statements for a specific number of times. In the counter loop, the number of repetitions of statements is known in advance. CONTROLLED LOOP: The controlled loop is used to execute the set of statements till a specific condition is satisfied. In this loop, the number of repetitions is not pre-defined. It depends upon the given condition.

Arrays in programming and advantages.


When writing a program, it is often convenient to refer to an entire collection of items at one time. Such a collection is usually referred to as an array. An array is a sequence of related objects in computers memory, each, of which is identified uniquely by its subscript. Arrays are used in many applications, which make the programmers life easy.

Subscript variable (all essential rules for it)


The individual elements within an array are known as subscripted variable. The essential rules of subscripted variable are following. 1. The subscript must be integer-valued and cannot be negative. 2. A comma must be separate the two value subscripts. For example T(8,5) 3. The array name, followed by the value of the subscript, enclosed in parenthesis.
Prepared by MUHAMMAD JALIL AL-MUSTAFA PUBLIC SCHOOL AND COLLEGE GILGIT

Notes for Class 10th


4. A subscripted variable is used in a program like a simple variable. 5. A subscript can be a zero, any positive integer or expression. 6. Variables, formulas and function name can also be used.

- 60 -

DIM statement
An array variable is allowed to range from 0 to 10. Whenever we want to store more than 10 values in an array in the memory, we accomplished by means of the DIM (DIMENSION) statement. For this purpose, we identify the total number of locations to be reserved in the computers memory. The DIM statement consists of a statement number, followed by the keyword DIM. The DIM statement allows a user to determine maximum array sizes easily and quickly.

DEF statement
Some time the programmer will want to write his own functions, to be used along with the library functions. For this purpose the DEF FN statement is used to define and name a function subprogram. In the DEF FN statement, arguments are used only to define the function; they do not affect program variable that has the same name. Both numeric and string function can be define with the DEF statement.

Distinguish between function and subroutine.


FUNCTION: Functions are predefining routine, which used to calculate and return a single value. SUBROUTINE: Subroutines are similar to function, which can be used to calculate and return many values. Define graphics. The graphics is and art to design and produce pictorial representation of information. The use of graphics is to sketch and draw diagrams in different modes either in black and white or in color. This facility is available almost in all language, depending on the hardware used. Graphics depends on the hardware such as input, output and graphic cards or adapter. Mouse, track ball and light pen are also useful for graphics work.

Different types of graphic modes.


There is two type of graphic mode used in basic. 1. Medium resolution graphic 2. High resolution graphic 1. MEDIUM RESOLUTION GRAPHIC: In medium resolution graphic mode, the screen is divided into a matrix consisting of 200x320 pixels. The choice of a mode is accomplished with the SCREEN 1 statement and choice of colors can be specified by the COLOR statement. 2. HIGH RESOLUTION GRAPHIC: In high-resolution graphic mode, the screen is divided into a matrix consisting of 200x640 pixels (in black and white). The choice of a mode is accomplished with the SCREEN 2 statement.

What is a pixel? Can pixels be controlled?


The smallest element of a screen is called pixel. The resolution of graphics display is measured in terms of the largest number of horizontal and vertical pixels that can be displayed at any one time. Programming statements can control the pixel.

END
Prepared by MUHAMMAD JALIL AL-MUSTAFA PUBLIC SCHOOL AND COLLEGE GILGIT

S-ar putea să vă placă și