A-level Computing/AQA/Problem Solving, Programming, Data Representation and Practical Exercise/Skeleton code/2011 Exam/Section B

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Section B Introduction[edit | edit source]

This section will ask you questions that you will have to find programming solutions to. There will be more than one way of answering each question, so the answers below are only indicative of what we are looking for.

As long as you get the same answers it doesn't matter how you do it. You may be given pseudocode to help you program the problem.

Batting Averages[edit | edit source]

Write a program to enter batting scores until the number 0 is input. And then output the total and average score.

Password Cracking[edit | edit source]

Write code to keep asking for login, only accepting: username= PSN Password = easy. Otherwise it should say. “Not hacked yet”:

Christmas Trees[edit | edit source]

Write code to print out a Christmas tree of a user defined size: even rows = *, odd = #. For example for the number 4 it should output:

#
**
###
****