0% found this document useful (0 votes)
25 views

Worksheet2 Y9 ANS

Uploaded by

annayaharis279
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)
25 views

Worksheet2 Y9 ANS

Uploaded by

annayaharis279
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/ 6

TERM 1 Year: 9

WSS Secondary
Homelearning (HL) Subject: Computing
Revision worksheet 2

Multiple choice questions:

1. An identifier is the ‘name’ given to a variable. For example:


distanceToSchool = 10
What is the value of the variable?
a) 10
b) =
c) distanceToSchool
2. Which of the following is a characteristic of pseudocode?
a) It uses strict syntax rules
b) It is written in plain language
c) It is executed by computers
d) It requires a compiler
3. In pseudocode, how is a decision typically represented?
a) Using a loop
b) Using an "if" statement
c) Using a function
d) Using a class
4. What is the difference between a flowchart and pseudocode?
a) A flowchart is diagramatic whilst pseudocode is written in a programming language (eg.
Pascal, Java, Visual Basic).
b) A flowchart is textual whilst pseudocode is diagrammatic.
c) A flowchart is a diagrammatic description of an algorithm whilst pseudocode is a
textual description of an algorithm.
d) Flowchart and pseudocode are representations of algorithms.
5. Below is a step in an algorithm. Which among the option below is its equivalent
pseudocode? Divide the value of x by y and add ten.
a) x / y + 10
b) (x/y) + 10
c) y/x + 10
d) (y/x) + 10
6. A real is...
a) A whole number
b) A number with a decimal part
c) Letters, numbers or punctuation
d) True or False
7. A string is...
a) A whole number
b) A number with a decimal part
c) Letters, numbers or punctuation
d) True or False
8. If the condition is True, then the true block of statements is executed and if it is False, then
the false block of statements is executed.
a) if statement
b) if-else statement
c) if-elif statement
9. This loop can only be used when the programmer knows the number of times a code is to
be repeated
a) while
b) for
c) do while
d) repeat until
10. What is a Count-Controlled loop?
a) for loop
b) while loop
True or False
1. In Python, the selection statements are also known as decision making statements or
branching statements. True
2. The selection statements are used to select a part of the program to be executed based on
a condition. True
3. In Python, When we want to test multiple conditions we use elif statement. True
4. The index number of Strings starts from 1. False
5. lowercase() function converts the string to lowercase. False
Define the following Terms:
1. Pseudocode
Pseudocode is a tool used in designing programs.

Pseudocode means ‘not real program statements.

A simple method of showing an algorithm.

2. Flowchart
A flowchart is a type of diagram that represents a workflow or process.

3. Selection Statement
A selection statement is used to test a condition. If the condition is true, then some code is
run; if the condition is false, different code can run.
4. Count controlled loop
The count-controlled loops in python are FOR loops.

Count-controlled loops use the keyword for.


5. Strings
In Python, a string is a sequence of characters enclosed within single quotes, double
quotes, or triple quotes.
III. Write a Python Program.
1. Write a python program to create a subroutine Max() that input two numbers, find the
largest number and output the largest number.
def Max():
n1=int(input(“enter number1:”))
n2= int(input(“enter number2:”))
if n1>n2:
print(“number1 is largest”)
else:
print(“number2 is largest”)
2. Write a python program to create a sub-routine circle() that input the radius of the circle,
calculate its area
def circle():
radius=float(input(“enter the radius:”))
area=3.14*radius*radius
print(area)
3. WAP to print multiplication table of any number using for loop
Number=int(input(“enter any number:”))
for i in range(1,11):
print(Number,”X”,i,”=”,Number*i)
4. Write python statements to convert
Convert 1000 into a string.
Mystring=str(1000)
Convert 1 into Boolean.
Mybool=bool(1)
Convert 25.4 into an integer
Myint=int(25.4)
4. WAP to output sum of numbers from 1 to 10.
sum=0
for i in range(1,11):
sum=sum+i
print(“The sum of numbers from 1 to 10 is:”, sum)
Flowcharts:
1. Draw the flowchart that Ask the user to input their feeling, Checks if feeling happy. If yes
prints “keep smiling”. If No prints “smile please”
2. Create a flowchart for following situation. Input a number. Check if number is 0. If yes,
output zero. If no, check again ,if number is greater than 0.If yes , output positive number.If
no, output negative number

3. Answer the questions based on the below flowchart.


1. What is the identifier of the counter variable?
c
2. What is the starting value of the counter?
-10
3. What is the end condition of the loop?
C<0
4. How many times will this loop run?
10 times
5. Write the pseudocode of this flowchart
FOR C-10 TO 0
OUTPUT “STILL MINUS”
END FOR
OUTPUT “NOT MINUS”
PSEUDOCODE:
1. Write the pseudocode to Input two numbers and output the smallest number.
INPUT number1
INPUT number2
IF number1>number2 THEN
OUTPUT “number2 is smallest”
ELSE
OUTPUT “number1 is smallest”
ENDIF
2. Write pseudocode that Input a number and subtract it from 100. Output a message that
says whether the result is positive or negative.
INPUT Number
result=Number-100
IF result<0 THEN
OUTPUT “Negative number”
ELSE
OUTPUT “positive number”
ENDIF
3. Write pseudocode that Ask the user to input “What is 3x3?” if the answer is 9 output the
message saying its correct , if its wrong, output the message saying its wrong.
OUTPUT “what is 3x3?”
INPUT answer
IF answer=9 THEN
OUTPUT “Its correct”
ELSE
OUTPUT “Its Wrong”
ENDIF
4. Write pseudocode that create a subroutine character() that Ask user to enter the x-
coordinate and y-coordinate of a character in a game. If the x and y coordinate is less than 0
or more than 1024, Output the massage “Your character is off the screen”
OUTPUT “Enter the x-coord”
INPUT Xcoord
OUTPUT “Enter the y-coord”
INPUT Ycoord
IF Xcoord<0 or ycoord<0 or xcoord>1024 or ycoord>1024 THEN
OUTPUT “Your character is off the screen”
ELSE
OUTPUT “Your character is still on the screen”
ENDIF
5. Convert the below python program into pseudocode.
for x in range(1,101):
print(x)
FOR X1 TO 101:
OUTPUT X

You might also like