X

Computer Programming Olympiad School Round 2 Question Paper 2017

Name of the Organization : Computer Olympiad South Africa
Examination Name : Programming Olympiad
Announcement : Programming Olympiad Round 2 Question Paper
Year : 2017
Type : Past Papers
Website : http://olympiad.org.za/programming-olympiad/past-papers/school-rounds/
Download Question Paper :
2017 PO School Round 2 : https://www.southafricain.com/uploads/9866-2017POR2.pdf
2016 PO School Round 2 : https://www.southafricain.com/uploads/9866-2016POR2.pdf
2011 PO School Round 2 : https://www.southafricain.com/uploads/9866-2011POR2.pdf
2010 PO School Round 2 : https://www.southafricain.com/uploads/9866-2010POR2.pdf
2009 PO School Round 2 : https://www.southafricain.com/uploads/9866-2009POR2.pdf

Computer Programming Olympiad Round 2 Question Paper

** Download Programming Olympiad 2017 PO School Round 2 sample question Paper & Solution above PDF links
** Not to be used before 14 August 2017

Related : Computer Programming Olympiad Round 1 Question Paper 2017 : www.southafricain.com/9860.html

Instructions

1. This paper is for ALL candidates.
2. All answers must be TYPED or PASTED on your Answer Sheet. Handwritten Answer Sheets will be disqualified.

3. Each correct answer earns 10 marks.
4. You have 60 minutes to attempt as many questions as possible.

5. Programs should be readable, concise, and use appropriate variable names.
6. Indicate the question, your name, surname and the language and version used at the start of every program e.g. “Q3 Sam King, Python 2.7”

7. Save your program as Qn Name Surname e.g. Q3 Sam King
8. You may assume that the user input will satisfy the problem specification and so you do not need to validate the input.

9. Do not write code to produce only specific answers, as the external judges may use other test cases.
10. After the contest you may be given time to print out your Answer Sheet. Do not make any changes.

11. Make sure you save the programs you have created and the Answer Sheet in a place where your teacher can find them.
12. Do Not Modify Any Files After The End Of The Contest As This Will Lead To Disqualification.

Sample Questions

Section 1 : Secret Code
Section 2 : Polynacci
Section 3 : Rational Order

Related Post

Secret Code

You have just found secret instructions on how to encode a message. Determine the message length and round up to the nearest multiple of 5. Write out the message in rows of 5 characters each until the message is complete. Send the message a column at a time from left to right.

For example, suppose the message is: THIS IS A CODED MESSAGE
As it is 23 characters long, add two spaces at the end to make the message 25 characters long.

The rows of five characters are:
1 2 3 4 5 T H I S I S A C O D E D M E S S A G E

The characters are sent one column at a time from left to right. The encoded message therefore becomes:
TIC.AHSOMGI.DEESAES…DS.

Task: Write a program that will encode any message using the secret instructions. Make sure to output all spaces as full stop characters: ‘.‘
Examples:
Input: THIS IS A CODED MESSAGE
Output: TIC.AHSOMGI.DEESAES…DS.
Input: 3 AND 7 MAKES 10!
Output: 3.K0.7E!A.S.NM..DA1.

Test your program with the following cases and type or paste the answers in the correct blocks on the web page:
1a) MEET.ME.IN.THE.PARK.TONIGHT.AT.SEVEN
1b) LOREM IPSUM DOLOR SIT AMET
1c) OLEHDKL.OEA..U.YBWLI,EHDT..E.?ITRI..HE..WE.H.IRSI
1d)T.GLEHC.L.EACEM.THDAR.A.LATSATTHET!.EDE.T….HDKT.EOIH

Polynacci

You may recall the Tribonacci numbers which you saw in Round 1. In that sequence you started with three initial terms and each term thereafter is the sum of the previous three terms.
We now further generalise this concept and consider a sequence of numbers which we call a Polynacci sequence. A Polynacci sequence begins with M given initial terms. The next term of the sequence is then generated by adding the previous M terms.

For example, if M = 3 and we start with terms 1, 2, 3, we obtain the sequence:
1, 2, 3, 6, 11, 20, 37, 68, 125, 230, 423, 778, …

If we have M = 5 and we start with the terms 1, 1, 2, 2, 3, then we obtain the sequence:
1, 1, 2, 2, 3, 9, 17, 33, 64, 126, 249, …

Task: Create a program that will determine the N-th term of a Polynacci sequence given the first M terms.
Note 1: The number of initial terms must be calculated from the given input and not be provided as an input value.
Note 2: The input numbers are separated by a single space
Example cases:
Input: Start with: 2 3 4 N: 10
Output: 335
Input: Start with: 1 2 3 4 5 N: 10
Output: 214
Test your program with the following cases and type or paste the answers in the correct blocks on the web page:
2a) Start with: 3 1 1 N: 12
2b) Start with: 2 3 5 7 N: 15
2c) Start with: 1 4 9 7 2 2 N: 30
2d) Start with: 2 8 15 4 4 3 8 9 10 3 N: 36

Rational Order

Consider the set of all reduced rational numbers between 0 and 1 inclusive with denominators less than or equal to N. Here is the set when N=5:
0/1 1/5 1/4 1/3 2/5 1/2 3/5 2/3 3/4 4/5 1/1
Note that, for N = 5, there is a total of 11 reduced rational numbers found between 0 and 1 with denominators no more than 5.

Task: Given a positive integer N your task is to write a program that calculates all the reduced rational numbers between 0 and 1 inclusive with denominators less than or equal to ??. Output only the total number of rational numbers found.
Examples
Input: N = 4 Output: 7
Input: N = 5 Output: 11
Test your program with the following cases and type or paste the answers in the correct blocks on the web page:
3a) N = 7
3b) N = 15
3c) N = 62
3d) N = 100

Categories: Question Paper
www.southafricain.com © 2022 Contact Us   Privacy Policy   Site Map