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

Pseudo Code: Programming On Paper For Ib Paper 1 Exams

This document provides guidance on pseudo code questions that may appear on IB Computer Science Paper 1 exams. It includes examples of pseudo code problems and solutions, as well as tips for writing pseudo code. Pseudo code questions test a student's ability to logically solve a problem by writing out the steps in plain English rather than actual code. The document emphasizes that pseudo code questions can be more complex than the examples shown and advises thinking about data types, control structures, and returning outputs before writing.
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)
696 views

Pseudo Code: Programming On Paper For Ib Paper 1 Exams

This document provides guidance on pseudo code questions that may appear on IB Computer Science Paper 1 exams. It includes examples of pseudo code problems and solutions, as well as tips for writing pseudo code. Pseudo code questions test a student's ability to logically solve a problem by writing out the steps in plain English rather than actual code. The document emphasizes that pseudo code questions can be more complex than the examples shown and advises thinking about data types, control structures, and returning outputs before writing.
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/ 13

Pseudo Code

PROGRAMMING ON PAPER FOR IB PAPER 1 EXAMS


SESSION 3
2 official pseudo code guides

8 pages 3 pages
NOT given in exam Given in exam
Warning!
Pseudo code questions are never as overt or obvious
as the examples we discuss in these sessions.
These examples are only there to teach you the skills
you need to answer more complex problems.

Topics 4, 5 and 7 can include pseudo code…


Top pseudo code tips
When possible, start answering a pseudo code question at the top of a page
Write pseudo code in pencil first and then copy into pen
Think about the data types and associated access methods BEFORE writing
anything
Think about what control structures (especially loops) are associated with that
data type
Be sure to return or output something at the end of the problem – even if they
don’t ask for it!
Basic structure of ALL pseudo code questions
Declarations / Initialisations
Control structures / Calculations
Output / Return

You get marks for individual sections, not the final output.
This means you could well get 7/8 even if your final output is not right.
T1: Array based method
Given an array of ints of odd length, look
at the first, last, and middle values in
the array and return the largest. The array
length will be a least 1.

maxTriple([3]) → 3
maxTriple([1, 5, 3]) → 5
maxTriple([1, 9, 5, 8, 3]) → 5
T2: Array counting
Given an array of ints, return the sum of the
first 2 elements in the array. If the array
length is less than 2, just sum up the elements
that exist, returning 0 if the array is length
0.

sum2([]) → 0
sum2([1, 1]) → 2
sum2([1, 1, 1, 1]) → 2
T3: Fix34 problem
Return an array that contains exactly the same
numbers as the given array, but rearranged so that
every 3 is immediately followed by a 4. Do not move
the 3's, but every other number may move. The array
contains the same number of 3's and 4's, every 3 has
a number after it that is not a 3, and a 3 appears
in the array before any 4.

fix34([1, 3, 1, 4]) → [1, 3, 4, 1]


fix34([1, 3, 1, 4, 4, 3, 1]) → [1, 3, 4, 1, 1, 3, 4]
fix34([3, 2, 2, 4]) → [3, 4, 2, 2]
T4: Position of smallest element in 2D array
A 2D array called M of
10 columns and 8 rows is
created and filled with
random unique integers.
Return the location in
the format COL, ROW of
the smallest integer in
the array.

You might also like