Filters

Other

D

Your name is required for this document. It is only stored on this local computer and no where else. Please enter your name below:

National 5 Computing Science Pseudocode Tasks

Knox badge
National 5 Computing Science Pseudocode Tasks

What is pseudocode?

Pseudocode is a type of design notation. It literally means 'phoney code'. It is a textual method of design a rough draft of a program that allows program designers to detail the processes and steps (algorithms) to solve a problem. Pseudocode is language independent; this means that the developers avoid using language specific keywords.

Pseudocode is written in a very readable way and as close to English as possible. Whilst it is the case that pseudocode avoids using programming keywords, constructs such as loops, and selection (if statements) must still be made very clear.

SQA Pseudocode

Within both Higher and National 5 Computing Science, you will need to know how to read and interpret pseudocode. The SQA uses its own reference language called the SQA Reference Language (SQARL) which clearly defines how pseudocode questions are formed. SQARL uses keywords such as DECLARE and SEND:

Line 1   SEND "What is the capital of France?" TO DISPLAY
Line 2   DECLARE answer AS STRING INITIALLY FROM KEYBOARD
Line 3   IF answer == "Paris" THEN
Line 4       SEND β€œCorrect” TO DISPLAY
Line 5   END IF

The above code could be easily translated from pseudocode to Python since it reads like English:

1.  print("What is the capital of France?")
2.  answer = input()
3.  if answer == "Paris":
4.    print("Correct")

Of course, since pseudocode does not need to follow a specific syntax, we can write it much closer to English. The following design is for a program that will read the name, prelim mark and coursework mark for a class of 20 pupils from a file. It will calculate a percentage from each of their prelim marks and coursework marks added together. It will then display the name of the pupil with the highest percentage and their percentage:

1.  Get results
2.  Calculate percentages
3.  Find position of pupil with top mark
4.  Display pupil with top mark

Refinement

The process of refinement is all about breaking a problem down into smaller chunks to make it easier to solve. For the previous program, the problem can be refined as follows:

1.
  1.1. Open marks file
  1.2. Start fixed loop for each pupil
  1.3.	 Get pupil name()
  1.4.	 Get prelim mark()
  1.5.   Get course mark()
  1.6. End fixed loop
  1.7. Close marks file
2.
  2.1. Start fixed loop for each pupil
  2.2.   percentage() equals (prelim mark() + course mark()) divided by 1.5
  2.3. End fixed loop
3.
  3.1. top position equals first position
  3.2. Start fixed loop from second pupil
  3.3.   If percentage() is greater than current top percentage Then
  3.4.     set position as new top position
  3.5.   End If
  3.6. End fixed loop
4. Display "Top pupil is", pupil name(top position), "with", percentage(top position), "percent"

Activity 1

For each of the following Python programs create a pseudocode program of the program.

  1. name = "Frank"
    print(name)
          
  2. username = input("Please insert your name")
    if username == "John":
      password = input("Please insert your password")
      if password = "1234":
        print("Welcome.")
      else:
        print("Your password is incorrect")
    else:
      print("No such user")
          
  3. number = generateRandomNumber(1, 100)
    user_number = input("Please guess a number")
    while user_number != number:
      print("Wrong number. Try again!")
      user_number = input("Please guess again")
    print("Well done. You have given me the right number!")
          

Activity 2

For each of the following problems, write pseudocode to solve the problem:

  1. Print every even number from 1 to 50.
  2. Ask the user for three sets of marks and find the average of the marks. Display the average on the screen after.
  3. Ask the user for 10 marks and then figure out which marks is the highest and display it on the screen.
!
-- DragonDocs version 0.9 --

20.08.2017

Started on DragonDocs
Created a YASS/PHP and HTML-based system for saving and retrieving data

21.08.2017
Added CSS styles to page
Added JavaScript code to the page

02.02.2018
Added the multipage option (used in my dissertation)
Added the XMLHttpRequest-based multipage requests

08.02.2018
Added the Accessibility features
Filters added

10.02.2018
Purple filter added

17.03.2018
Added the Note class
Added the Did You Know class

-- DragonDocs version 1.0 (Yosemite) --

02.10.2019
First trial of DragonDocs in teaching

04.10.2019
Added the Task, Starter, Review your learning sections

07.10.2019
Added the feedback feature
Added the Dark Mode toggle

19.09.2020
Performance gains through the removal of unnecessary code
Added the Learning Intentions and Success Criteria features
Added the school badge

31.09.2021
Changed the headings (h2) to be more consistent with my website
Added sections to the pages - sections must be preceded by a h2
Added the "I have read this section" buttons
Changed the main heading zone to gradient text like my website
Added the table of contents feature

02.02.2022
Added the Print feature
Updated the footer to feature a new gradient
Added the Test It! class
Added the green flag
Automated the table of contents using JavaScript

06.02.2022
Added the 'includes' feature to the document, allowing inclusion of other files easily
Removed the requirement that the IP address must be one of the schools I have taught at, opening these documents to the public

02.03.2022
Once a section has been read or completed, the user can now hide that section

10.10.2022
Added the Extension task class
Changed the scrollbar on Windows to match that of macOS

-- DragonDocs version 2.0 (Kilimanjaro) --

07.08.2023
Added the Save button and the ability to save 'results' or answers to a Word document

12.01.2024
Added the large numbers class
Removed the background of the page navigation

-- DragonDocs version 2.1 (Aurora) --

08.02.2024
Added the active class to active links in the bottom section

09.02.2024
Added the image upload feature

10.02.2024
Added a fix that prevents the upload of non-image files into an image upload
Added pasting images to the upload feature

11.02.2024
Added the ability to view the changelog from a document
Improved the feedback system by recording the DragonDocs User ID and the Document ID data
The feedback from DragonDocs can be accessed much easier

12.02.2024
Added the new step_by_step_mode feature, allowing sections to be viewed individually
Added the ability to lock and unlock DragonDocs

22.02.2024
Added new checkboxes to each list item in a .task or .step
Added functionality to said checkboxes to add a strikeout to steps completed

23.02.2024
Added the new 'step' class
Steps are now auto incremented in CSS so the name displays the step number
Activities are now also auto incremented to display the activity number

25.02.2024
Added the 'matcher' feature to DragonDocs
Fixed an issue in which a closed section would retain it's original height within the document navigation
Added starters and the lesson review to the navigation on the side
The learning intentions and success criteria in teaching documents have now been redesigned to match my slides design

26.02.2024
All buttons are now on the right hand side
The accessibility button now has WAI under it

-- DragonDocs version 2.2 (Serengeti) --

26.02.2024
Code has been rewritten from the ground up to be object-oriented, making additional features easier to add

28.08.2024
Changed the look of grouped multiple choice buttons

06.03.2024
Added the new dragondocs_name feature and the requires_name property which allows names to be prepended to saved documents

09.03.2024
Added code so when the user types in their name and hits the enter key it will save that data and close the modal window
Added the new DragonShow and DragonDocs Link - a connection between both services that allows the presenter to communicate with users of DragonDocs from a DragonShow
Added the new timer option which is sent from DragonShows

04.04.2024
The matcher feature is no longer embed from jamiebalfour.scot but actually a feature of DragonDocs
Made DragonDocs 100% object-oriented, meaning much better management and better performance

05.04.2024
Made subtle changes to the interface to tidy it up a bit

06.04.2024
The multiple choice questions are now also part of the object oriented interface

09.04.2024
As requested, h3 elements are now included in the 'floating navigation'
The active navigation element now becomes bold and the left border has been retired

Time left

: