Download CBSE Class 8 Computer Science Computer Programming Notes in PDF format. All Revision notes for Class 8 Computer Science have been designed as per the latest syllabus and updated chapters given in your textbook for Computer Science in Class 8. Our teachers have designed these concept notes for the benefit of Class 8 students. You should use these chapter wise notes for revision on daily basis. These study notes can also be used for learning each chapter and its important and difficult topics or revision just before your exams to help you get better scores in upcoming examinations, You can also use Printable notes for Class 8 Computer Science for faster revision of difficult topics and get higher rank. After reading these notes also refer to MCQ questions for Class 8 Computer Science given on studiestoday
Revision Notes for Class 8 Computer Science Computer Programming
Class 8 Computer Science students should refer to the following concepts and notes for Computer Programming in Class 8. These exam notes for Class 8 Computer Science will be very useful for upcoming class tests and examinations and help you to score good marks
Computer Programming Notes Class 8 Computer Science
Give brief answers to the following questions.
Question: What is program? Give few examples of programs.
Answer: A set of instructions given to the computer to perform a specific task is called a program. A computer works according to the instruction written in program. Few examples of programs are:
A program to find area of a circle for a gives radius. A program to find sum and average of five values
A program to find the grades of students
A program to find greater of two values
Question: What is the purpose of programming language?
Answer: A programming language is designed to develop programs or instructions to communicate with computer to solve various problems. Programming languages are the means of communication between user and computer.
Question: Differentiate between a constant and variable.
Answer: A quantity whose value cannot be changed during execution of program is called constant. A quantity whose value can be changed during execution of program is called variable. Variables are the named memory locations that can store data and result of processing. Variables give meaningful names to constants.
Question: Differentiate between Syntax error and logical erro
Answer: Syntax error is a type of error that occurs when a program statement does not follow the syntax of programming language. A type of error that occurs due to wrong logic of the program is called logical error.
Question: What are the rules for defining/declaring variables in GW -BASIC?
Answer: Following are the rules for defining/declaring variables in GW -BASIC:
Alphabets and numbers can be used for variables.
The first character of the variable should be an alphabet.
No special symbol is allowed except Underscore ( _ ).
Underscore ( _ ) cannot be used as a first or last character.
Question: Name different types of constants with examples.
Answer: Constants are classified as string constants and numeric constants.
String constants: These are series of alphabetic or alphanumeric character written in double quotation marks. For example “Pakistan” , “Haider” and “H.No.107” et c.
Numeric constants: These are the numbers, for example 15 , 20.50 , -50 etc.
Question: Give the precedence of the arithmetic operators.
Answer: Precedence is the priority that is followed while applying operators in an expression. In other words the order in which operators in an expression are evaluated is known as precedence. It is also known as hierarchy of operators. The precedence of arithmetic operators is given below:
Priority level
Operator
Symbol
Precedence
First
Exponential Operator
^
Highest
Second
Multiplication, Divide
*OR /
Third
MOD Operator
MOD
Fourth
Addition or Subtraction
+ OR –
Lowest
Question: What is the purpose of modulus operator (MOD)?
Answer: Modulus operator is used to get the remainder after division. For example if a = 10 and b = 3 , the MOD operator ( a MOD b) will return 1 after performing division.
Question: What is the purpose of following GW-BASIC commands?
a. LIST
b. RUN
c. LOAD
d. SAVE
Answer:
a) LIST Command: List command is used to display all or specific statements of a program from memory on screen. The shortcut key for list command is F1.
Syntax: LIST [line number][- line number]
Example: LIST it displays al lines of the program.
b) RUN Command: RUN command is used to execute the program that is currently loaded in the memory. The shortcut key for RUN command is F
Syntax: RUN
Example: RUN it runs the program currently in memory.
c) LOAD Command: LOAD command is used to load a saved program file from disk to memory. The shortcut key for list command is F3.
Syntax: LOAD filename
Example: LOAD “Test.bas” it loads the file “Test.bas” in memory.
d) SAVE Command: SAVE command is used store a program from memory to disk permanently. The shortcut key for list command is F4.
Syntax: SAVE filename
Example: SAVE “Test.bas” it stores the file “Test.bas” from memory to disk.
Question: (i) What is arithmetic expression? Explain different types of operators with examples.
Answer: Arithmetic Expression: An expression that consists of different arithmetic operators, variables and constants is called arithmetic expression. It is evaluated by performing arithmetic operation on numeric values. There are three common types of operators.
Arithmetic Operators ( +, -, *, /, ^, MOD)
Assignment Operator (=)
Relational Operators (< , >, , =)
a) Arithmetic Operators: These are use to perform mathematical calculations like addition, subtraction, division, multiplication and exponentiation. Their explanation with examples is as follows:
Operator symbol
Operation
Description
Example
+
Addition
Gives the sum of values
A+B+C, X+50, 67+45
–
Subtraction
Gives the difference of values
X-56, A-C, 80-56
*
Multiplication
Gives the product of values
A*B, Y*50, 45*60
/
Division
Gives the quotient
X/Y, B/40, 125/25
^
Exponentiation
Raise the value to the power of an exponent
A ^ 10, 5^ 2, A^B
MOD
MODULUS
Gives the remainder after division
35 MOD 6, X MOD Y
b) Assignment Operator: An operator which is used to assign a value to a variable is called assignment operator. In programming languages “Equal to sign (=)” is used as an assignment operato For example A=5 , X = A + 2.54 etc.
c) Relational Operators: These are used to perform comparisons on two values. The result of comparison is either true (non zero) or false (zero). Following is their description with examples:
Operator symbol
Operation
Description
Example
=
Equal to
Returns true if the values are equal and false if not
A = B
Not equal to
Returns true if the values are not equal and false if they are equal.
5 7
>
Greater than
Returns true if the first number is greater than second and false if not
15 > 11
Less than
Returns true if the first number is less than second and false if not
7 < 9
>=
Greater than OR equal to
Returns true if the first number is greater than or equal to the second and false if not
(X+1) >= 7
Less than OR equal to
Returns true if the first number is less than or equal to the second and fal se if not
Y
Question: Explain the purpose of the following GW-BASIC statements with their syntax and examples.
a. PRINT
b. INPUT
c. READ and DATA
d. IF-THEN-ELSE
Answer:
a) PRINT Statement: PRINT statement is used to display message or output to the screen.
As shortcut”?” can be used for PRINT command.
Syntax: line number PRINT [string/variables/constants]
String: It indicates the sequence of characters that is displayed on screen.
Variables: It indicates the variables whose values to be displayed on screen. Constants: It indicates the constants to be displayed on screen.
For example: 10 PRINT “I Love India” will print I Love India
10 PRINT X, Y, Z will print values of variables x, Y and Z
10 PRINT 205 , -101 will print constant values 205 and -101
b) INPUT Statement: INPUT statement is used to take input from the user during the execution of the program.
Syntax: line number PRINT [string;] list of variables
String is used to prompt the user to enter the required value using keyboard and it is optional. List of variables is used to store the entered values.
Example: 10 CLS
20 INPUT “Enter a number”, X
30 PRINT “Square of your number is=”, X^2
This program will get value for X from user at execution time and will print its square.
c) READ and DATA Statement: READ/DATA statement is a combination of two statements used together when there is a need to process large number of variables with given data. READ statement defines the list of variables while DATA statement contains constant values for these variables in READ statement. Values in READ and DATA statements should be separated by commas.
Syntax: line number READ list of variables separated by commas.
line number DATA list of constants separated by commas.
Example: 10 READ X, Y, Z, K
20 DATA 8, 9, 13, 15
The above program will specify four variables x, y, z and k and assign them values 8, 9, 13 and 15 respectively. If values in DATA statement are more than variables in READ statement then the extra values are ignored but if the variables in READ statement are more than the values in DATA statement then syntax error encounters i.e. “Out of Data”.
d) IF-THEN-ELSE Statement: IF-THEN-ELSE is a decision making statement, depending upon the condition, it takes some action or changes the order of execution. It helps the computer to check whether a condition is true or false.
Syntax: IF expression/condition THEN statement(s)1 ELSE statement(s)2
If the expression or condition is true then Statement(s)1 will be executed otherwise
Statement(s)2 will be executed.
T
Flowchart:
Condition
Statement (s)
Statement (s)
F
Output:
Enter your marks: 65
You have passed
Example: 10 CLS
20 INPUT “Enter your marks:”; marks
30 IF marks >= 40 THEN PRINT “ You have passed”
40 END Short Questions other than exercise
Question: Explain the use of semicolon with PRINT.
Answer: Two or more variables can be separated in print statement by semicolon. If semicolon is used the second value appears right after the first value. There is no space be tween values.
Example: PRINT “Apple” ; “Mango” ; “Orange”
Output will be as: AppleMangoOrange
Question: Explain the use of comma with PRINT.
Answer: Two or more variables can be separated in print statement by comma. If com ma is used each value is displayed in 14 spaces. A maximum of five values can be printed in single line using commas.
Example: PRINT “Apple” , “Mango” , “Orange”
Output will be as: Apple Mango Orange
Question: What is expression? What are its types?
Answer: An expression is a combination of symbols (operands) and operators that represent a value.
There are two types of expressions:
Arithmetic expression uses arithmetic operators to perform arithmetic calculations.
Relational expression uses relational operators to compare two values.
Question: Define programming.
Answer: Programming is a technique to develop programs. Different programming languages are used to write programs. Simply computer programming is all about developing, implementing and maintaining the programs.
Question: How arithmetic expression can be assigned to a variable?
Answer: An arithmetic expression can be assigned to a variable by using assignment operator (=). The variable is written on the left side of assignment operator and expression is written on right side of assignment operator. First expression is evaluated and result is stored in variable e.g. a = c – d * 10
Question: Differentiate between bug and debugging.
Answer: An error in a program is called a bug. The process of finding and removing errors in a program is called debugging. Errors can be found by testing the program.
Question: Differentiate between save and load command.
Answer: SAVE command is used to store a program from memory to the disk permanently whereas load command is used to load a stored program from disk to memory.
Question: How the commands are differ from statements?
Answer: Commands are key words which are used to issue instructions to the computer to perform specific task. They do not need any line number while statements are instructions for the computer program to perform an action. Each statement is started with a line number. Statements are executed according to line number in ascending order.
Question: Differentiate between string constant and numeric constant.
Answer: The string constant may consist of alphanumeric or numeric data and is written in double quotation marks while numeric constant consists of numeric data i.e. only numbers and is written without quotation marks.
Question: Why variables are used with INPUT statement?
Answer: The variables are used with INPUT statement to store the input data. Two or more variables must be separated by comma.
Question: Write the use of $ in GW-BAS
Answer: A dollar sign $ is used after a string variable name such as A$ and Address$. The dollar sign indicates that the variable contains a string value.
Question: What is the use of arithmetic operators?
Answer: Arithmetic operators are used to perform arithmetic calculations like addition, subtraction, division, multiplication and exponentiation.
Question: What is the use and syntax of CLS command?
Answer: CLS Command: CLS stands for Clear Screen. It is used to clear the contents of the screen.
Syntax: CLS
Question: Define precedence.
Answer: Precedence is the priority that is followed while applying operators in an expression. In other words the order in which operators in an expression are evaluated is known as precedence. It is also known as hierarchy of operators.
Question: Define the syntax of programming language.
Answer: The syntax of programming language is the set of rules that defines the combination of symbols used by that language
Question: What is “Out of Data” error?
Answer: If the variables in READ statement are more than the values in DATA statement then syntax error encounters i.e. “Out of Data”
CBSE Class 8 Computer Science Computer Programming Notes
We hope you liked the above notes for topic Computer Programming which has been designed as per the latest syllabus for Class 8 Computer Science released by CBSE. Students of Class 8 should download and practice the above notes for Class 8 Computer Science regularly. All revision notes have been designed for Computer Science by referring to the most important topics which the students should learn to get better marks in examinations. Our team of expert teachers have referred to the NCERT book for Class 8 Computer Science to design the Computer Science Class 8 notes. After reading the notes which have been developed as per the latest books also refer to the NCERT solutions for Class 8 Computer Science provided by our teachers. We have also provided a lot of MCQ questions for Class 8 Computer Science in the notes so that you can learn the concepts and also solve questions relating to the topics. We have also provided a lot of Worksheets for Class 8 Computer Science which you can use to further make yourself stronger in Computer Science.
You can download notes for Class 8 Computer Science Computer Programming for latest academic session from StudiesToday.com
Yes, the notes issued for Class 8 Computer Science Computer Programming have been made available here for latest CBSE session
There is no charge for the notes for CBSE Class 8 Computer Science Computer Programming, you can download everything free of charge
www.studiestoday.com is the best website from which you can download latest notes for Computer Programming Computer Science Class 8
Come to StudiesToday.com to get best quality topic wise notes for Class 8 Computer Science Computer Programming