0% found this document useful (0 votes)
22 views7 pages

Chapter 1 Grade 8

This document provides an overview of flowcharts, pseudocode, and programming constructs. It details flowchart symbols, basic structures, and rules for writing pseudocode, along with explanations of identifiers, arithmetic operators, and conditional statements. Additionally, it addresses the differences between pseudocode and program code, and includes examples and questions related to the concepts discussed.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views7 pages

Chapter 1 Grade 8

This document provides an overview of flowcharts, pseudocode, and programming constructs. It details flowchart symbols, basic structures, and rules for writing pseudocode, along with explanations of identifiers, arithmetic operators, and conditional statements. Additionally, it addresses the differences between pseudocode and program code, and includes examples and questions related to the concepts discussed.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Chapter 1

Computational thinking and programming

Section: 1.1 pseudocode – 1.2 selection in pseudocode notes

1. What is a Flowchart?

A flowchart is a diagram that uses symbols to represent the sequence of steps in


a process or a solution to a problem. It shows how data moves and decisions are
made.

2. Flowchart Symbols

1. Oval (Terminator)
• Purpose: Indicates the start and end points of the flowchart.
• Example:
Here’s a simplified version of the flowchart symbols:
• Start 1. Oval (Terminator)
• End • Purpose: Marks the start or end of the flowchart.

2. Parallelogram Example:
(Input/Output)
• Start
• Purpose: Shows
• Endinput to and output from the process.
• Example:2. Parallelogram (Input/Output)
• Input: “Enter
• number”
Purpose: Represents input or output of data.
• Example:
• Output: “Display
• result”
Input: “Enter number”
3. Rectangle • (Process/Instruction)
Output: “Display result”
3. Rectangle (Process)
• Purpose: Represents

a process or operation that is to be performed.
Purpose: Shows a task or action.
• Example:• Example:
• “Add two• numbers”“Add two numbers”
• “Calculate area”
• “Calculate4. area”Diamond (Decision)
4. Diamond• (Decision)
Purpose: Indicates a decision with two options, like Yes/No.
• Example:
• Purpose: Used

for decision-making steps that involve a Yes/No or
“Is number > 10?”
True/False choice.• “Is age ≥ 18?”
• Example: 5. Arrow (Flow Lines)
• Purpose: Shows the direction of the process flow.
• “Is number > 10?”
• “Is age >= 18?”
5. Arrow (Flow Lines)
• Purpose: Shows the flow or direction of the process.

3. Basic Structure of a Flowchart

1. Start: Begin the process with a start symbol (oval).


2. Input: Gather the required input (parallelogram).
3. Process: Perform necessary calculations or steps (rectangle).
4. Decision: Make a decision based on a condition (diamond).
• If “Yes”, follow one path.
• If “No”, follow another.
5. Output: Show the result (parallelogram).
6. End: End the process (oval).

4. Tips for Drawing Flowcharts

• Ensure the flow of the process is logical and easy to follow.


• Use the correct symbols for each part of the process.
• Always start and end with an oval (Start/End).
• Keep decisions (diamonds) simple (usually Yes/No or True/False).
• Use arrows to indicate the direction of flow.

Flowcharts help in visualizing algorithms and understanding how a process


works, which is essential in programming and problem-solving.

5. Define constructs and its types?


The keywords are used to describe the control flow of the algorithm

The three main constructs are

• Sequence (the order statements run in)


• Selection (checking a condition and running code when this condition is true or
false)
• Iteration (running code multiple times in a loop)

6. Rules of pseudocode

• Using double quotation marks around strings.


• Writing START at the beginning and STOP at the end.
• Writing the pseudocode in a series of statements, one after the other,
in order from top to bottom.
7. Define identifier with examples?
An identifier is the name we give to a variable or a sub routine

Eg: INPUT colour


INPUT name
INPUT animal

The identifiers in these three examples are colour, name and animal.

8. Concatenation symbols and example

Eg: foot + ball = football

Operator symbol

comma ,
Plus sign +
Ampersand &

9. Define arithmetic operators


Arithmetic operators are symbols we use to perform mathematical calculations.

Operator Symbol

Addition +
Subtraction -
Multiplication *
division /

10. Conditional statements

* IF THEN
* IF THEN ELSE
* ELSEIF
11. Boolean operators

Boolean operator Format Rules

AND One condition on either side If both conditions are true, the result
is true.
Otherwise, the result is false

OR One condition on either side If one, or both, condition are true, the
result is true.
It is false only when both conditions
are false
NOT One condition If the condition is true, it makes it
false.
If the condition is false, it makes it
true.

Question 1.1 (Page no: 16)

Q1) What is pseudo code used for ?


Ans : To design algorithms or programs .

Q2)Difference between pseudocode and program code ?


Ans: Program code has syntax that has to be followed, whereas pseudocode is
language-independent .

Q3)Which of this is the following valid example of pseudo code ?


A. number INPUT
B. number =INPUT
C.INPUT “ Enter a number between 1 and 10 “,
D. number = input(“ Enter your number” )

Ans : All are valid .

Q4)Which of this is not a valid example of pseudo code


Explain your choice
Output a message that tells the user to enter a word .
OUTPUT “Enter a word “
writeToScreen (“Enter a word”)

Ans : The first is not valid because the text to be output is not in double
quotation marks – it is an English statement and is not like code.
Question 1.2 (Page no : 25)

Q1)Give a suitable pseudocode command word to output a message .


Ans: Any command such as OUTPUT, PRINT, WRITE .

Q2)Why is pseudocode called “ language independent” ?


Ans :It does not use commands or syntax for one specific language, and it can
be understood by all programmers who can write high-level language
programs .

Q3)What are the two signs that can be used for assignment pseudocode ?
Ans :Equals (=) and back arrow (←) .

Q4) What are the names of the variable in this pseudo code program
first 1
second 2
third first +second
Ans :first, second, third .

Q5) What is the value stored in answer after each pseudocode statement is run?
Ans : a answer 1* 10= 10
. b. answer (20 / 2 )+5 = 15
c.answer 50 * 2 - 1 = 99
d. answer 1 + 2 - 3 = 0.

1.1 Selection in Pseudocode

Question 1.3 (Page no: 57)

Q1)What are the three components of conditional statement ?

Ans :(1) Condition.


(2) code to run when true and
(3) code to run when false .

Q2)What is the pseudocode command word used in all conditions statement ?

Ans : IF.
Q3)What will this algorithm output ?

Ans :"Smaller"

Q4) Read this pseudocode algorithm:

Ans :
a. "second"
b. "same"
c. When both values are the same
d. When the first number is the larger
e. When the second number is the larger.

Q5) Read this pseudocode algorithm:


a)What will be the output when 2 is input?
Ans:The first ever computer was as big as a room."

b)What will be the output when one is input ?


Ans: "Why was the computer sneezing?"

c) What will happen when 3 is input?


Ans: "It had a virus."
Nothing – there will be no output
d) How the algorithm be changed so when a different value is entered, the
message “Not Valid” is output?

Ans: Include an ELSE statement

You might also like