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

Coding Practice Questions

The document contains a series of coding practice questions for MYP 1 Maths at Khalsa Community School, focusing on pseudocode and basic programming concepts. It includes exercises on calculating sums, averages, areas, volumes, and surface areas, with missing spaces for students to fill in. Each question is designed to reinforce understanding of mathematical operations and programming logic.

Uploaded by

abc12355
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Coding Practice Questions

The document contains a series of coding practice questions for MYP 1 Maths at Khalsa Community School, focusing on pseudocode and basic programming concepts. It includes exercises on calculating sums, averages, areas, volumes, and surface areas, with missing spaces for students to fill in. Each question is designed to reinforce understanding of mathematical operations and programming logic.

Uploaded by

abc12355
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 16

KHALSA COMMUNITY SCHOOL

MATHS
MYP 1

CODING PRACTICE QUESTIONS

1. Code is used to determine the sum of two numbers. Fill in the missing
spaces.
Set num 1=0
Set num 2 = 0
Set Sum = 0
Output “enter number 1”
Store user input as _______________
Output “enter number 2”
Store user input as_______________
Sum = ______________________
Output “sum of two numbers is”, ___________

num1 num1+num2

num2 num1-num2
2. Code is used to determine the sum of two numbers. Fill in the missing
spaces.

Set quiz1=0
Set quiz2 = 0
Set quiz3 = 0
Set Average=0
Output “enter marks of quiz 1”
Store user input as _______________
Output “enter marks of quiz2”
Store user input as_______________
Output “enter marks of quiz 3”
Store user input as _______________
Average = _________________________
Output “Average of marks of three quizzes is”, ___________

quiz1 quiz2 quiz3

(quiz1+quiz2+quiz3)/3 quiz1+quiz2+quiz3
3. Following is pseudocode. If a user has entered three inputs,
A= 150 cm, B = 160 cm, C = 155 cm. What should be the output?

READ A, B, C
SET Tallest = A
IF B > Tallest
SET Tallest = B
END
IF C > Tallest
SET Tallest = C
END
PRINT ‘The Tallest is ‘, Tallest

a. 150 c. 155

b. 160 d. None of the above

4. Following is pseudocode. If a user has entered three inputs, What should


be the output in the following cases:
a. If the user has entered number 56.
____________________________________________________
b. If the user has entered number 10.
____________________________________________________
c. If the user has entered number 13.
____________________________________________________

SET N % A number set by the programmer, e.g., 13


PRINT ‘Enter a value in the range [0,100]’
INPUT guess
WHILE guess ~= N
IF guess>N
PRINT ‘Enter a Lower value’
INPUT guess
ELSEIF guess < N
PRINT ‘Enter a Higher value’
INPUT guess
ELSE
PRINT “ Yes, you did it”

End IF
END WHILE

5. Following is a pseudocode to determine area of triangle. Fill in the missing


spaces.

Set base=0
Set height = 0
Set area = 0
Output” enter base of a triangle”
Store user input as _______________
Output “ enter height of a triangle”
Store user input as_______________

Area = _________________________
Output “ Area of triangle is”, ___________ m2

base height length

(base*height)/2 area

6. Read the following code. Fill in the missing spaces.

set metres = 0.00

set centimetres = 0.00

set convertMetres = 0.00

set convertCentimetres = 0.00

keyPressed = “blank”

repeat until keyPressed = “A” or “B”

output “Type A to convert from metres (m) to centimetres (cm).


Type B to convert from cm to m.”

store user input as keyPressed

if keyPressed == “A”
output “What is your measurement in metres?”

store user input as metres

convertCentimetres = ________________________________

output metres, “ metres is ”, convertCentimetres, “


centimetres.”

else

output “What is your measurement in centimetres?”

store user input as centimetres

convertMetres = _________________________________

output centimetres, “ centimetres is ”, convertMetres, “ metres.”

Fill in the blanks


Help box

metres * 100 centimetres * 100


metres* 1000

centimetres * 0.01 centimetres * 0.001


7.

If today is Saturday and the time being 1.30 AM. What will be the output?

a. Holiday b School day

8. What is the output of the following pseudocode:


a. 10 b. 5 c. 0 d. None of the above

9. Following code is determine to find the product of two numbers. Fill in the
missing spaces.

Set num 1=0


Set num 2 = 0
Set multi = _____
Output” enter number 1”
Store user input as_______________
Output “ enter number 2”
Store user input as_______________
multi = ______________________
Output “ product of two numbers is”, ___________
num1*num2 num1-num2 0
num2

num1/num2 num1

10.What will be the output of the following pseudocode if user entered


following values:
Num1 = 12 num2 = 9 num3= 27
a. 9,12,27
b. 27,12,9
c. 9,27,12
d. None of the above
11. Following is a pseudocode to determine area of trapezoid. Fill in the
missing spaces.

Set base1=0
Set base2 = 0
Set height = 0
Set Area = 0
Output” enter base one of trapezoid ”
Store user input as _______________
Output “enter base two of trapezoid”
Store user input as_______________
Output” enter height of trapezoid ”
Store user input as_______________
Area = ______________________
Output “Area of trapezoid is”, ___________

(base1*base2)/2 ((base1+base2)*h)/2

Base1 base2 height

12. Following is a pseudocode to determine volume of a room which is a


rectangular prsim. Fill in the missing spaces.
Set lengthRoom=0
Set widthRoom = 0
Set heightRoom = 0
Set volumeRoom = 0
Output” enter length of room”
Store user input as _______________
Output “enter width of room”
Store user input as_______________
Output” enter height of room”
Store user input as_______________

volumeRoom = ______________________
Output “Volume of room is”, ___________
lenghtRoom + widthRoom + heightRoom

lenghtRoom * widthRoom * heightRoom

lengthRoom heightRoom widthRoom

13. Following is a pseudocode to determine surface area of a tent which is


a triangular prism. Fill in the missing spaces.

Set side1=0
Set side2 = 0
Set side3= 0
Set height Prism=0
Set heightTriangle = 0
Set baseTriangle = 0
Set surfaceArea=0

Output” enter one side of triangular prism”


Store user input as _______________
Output “enter second side of triangular prism”
Store user input as_______________
Output” enter third side of triangular prism”
Store user input as_______________
Output” enter base of triangle”
Store user input as_______________
Output” enter height of triangle”
Store user input as_______________
Output” enter height of prism”
Store user input as_______________
Surface Area Tent = ______________________
Output “ Surface area of tent is”, ___________

(base * heightTriangle) + (heightPrism * (side1 + side2 + side3))

(b * h) + (L * (s1 + s2 + s3))

base heightTriangle heightPrism

side1 side2 side3 surfaceArea

14. Following is a pseudocode to determine volume of a tent which is a


triangular prism. Fill in the missing spaces.

Set side1=0
Set side2 = 0
Set side3= 0
Set height Prism=0
Set heightTriangle = 0
Set baseTriangle = 0
Set volumeTent =0
Output” enter one side of triangular prism”
Store user input as _______________
Output “enter second side of triangular prism”
Store user input as_______________
Output” enter third side of triangular prism”
Store user input as_______________
Output” enter base of triangle”
Store user input as_______________
Output” enter height of triangle”
Store user input as_______________
Output” enter height of prism”
Store user input as_______________
volumeTent = ______________________
Output “ Volume of tent is”, ___________m3

base heightTriangle heightPrism

side1 side2 side3 surfaceArea

((base * heightTriangle)/2) * heightPrism )


Side1*side2*side3

15. Following is a pseudocode to determine volume of a room which is a


rectangular prism. Fill in the missing spaces.
Set lengthRoom=0
Set widthRoom = 0
Set heightRoom = 0
Set volumeRoom = 0
Output” enter length of room”
Store user input as _______________
Output “enter width of room”
Store user input as_______________
Output” enter height of room”
Store user input as_______________

surfaceAreaRoom = ______________________
Output “Volume of room is”, ___________

lenghtRoom + widthRoom + heightRoom

lenghtRoom * widthRoom * heightRoom

(lengthRoom*widthRoom + widthRoom*heightRoom +
heightRoom*lengthRoom)

lengthRoom heightRoom widthRoom

16. Following is a pseudocode to determine surface area of a cube. Fill in


the missing spaces.

Set sideCube=0
Set surfaceArea= 0
Output” enter side of cube”
Store user input as _______________
surfaceArea = ______________________
Output “Surface area of cube is”, ___________ m2
(6*a*a)

(6 +a+a)

sideCube surfaceArea

17. Following is a pseudocode to determine volume of a cube. Fill in the


missing spaces.

Set sideCube=0
Set volumeCube= 0
Output” enter side of cube”
Store user input as _______________
volumeCube = ______________________
Output “Surface area of cube is”, ___________ m3

sideCube sideCube *sideCube *sideCube

volumeCube=

You might also like