Coding Practice Questions
Coding Practice Questions
MATHS
MYP 1
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)/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
End IF
END WHILE
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)/2 area
keyPressed = “blank”
if keyPressed == “A”
output “What is your measurement in metres?”
convertCentimetres = ________________________________
else
convertMetres = _________________________________
If today is Saturday and the time being 1.30 AM. What will be the output?
9. Following code is determine to find the product of two numbers. Fill in the
missing spaces.
num1/num2 num1
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
volumeRoom = ______________________
Output “Volume of room is”, ___________
lenghtRoom + widthRoom + heightRoom
Set side1=0
Set side2 = 0
Set side3= 0
Set height Prism=0
Set heightTriangle = 0
Set baseTriangle = 0
Set surfaceArea=0
(b * h) + (L * (s1 + s2 + s3))
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
surfaceAreaRoom = ______________________
Output “Volume of room is”, ___________
(lengthRoom*widthRoom + widthRoom*heightRoom +
heightRoom*lengthRoom)
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
Set sideCube=0
Set volumeCube= 0
Output” enter side of cube”
Store user input as _______________
volumeCube = ______________________
Output “Surface area of cube is”, ___________ m3
volumeCube=