Back to 课程

Computer Science GCES AQA

0% Complete
0/0 Steps
  1. Representing Algorithms Aqa
    4 主题
  2. Efficiency Of Algorithms Aqa
    1 主题
  3. Searching Algorithms Aqa
    3 主题
  4. Sorting Algorithms Aqa
    3 主题
  5. Data Types Aqa
    1 主题
  6. Programming Concepts Aqa
    5 主题
  7. Arithmetic Relational And Boolean Operations Aqa
    1 主题
  8. Data Structures Aqa
    3 主题
  9. String Manipulation Aqa
    1 主题
  10. Random Number Generation Aqa
    1 主题
  11. Structured Programming Aqa
    2 主题
  12. Robust And Secure Programming Aqa
    4 主题
  13. Number Bases Aqa
    2 主题
  14. Converting Between Number Bases Aqa
    3 主题
  15. Units Of Information Aqa
    9 主题
  16. Hardware And Software Aqa
    4 主题
  17. Boolean Logic Aqa
    3 主题
  18. Programming Languages And Translators Aqa
    2 主题
  19. Cpu Architecture Performance And Embedded Systems Aqa
    4 主题
  20. Memory Aqa
    2 主题
  21. Secondary Storage Aqa
    3 主题
  22. Fundamentals Of Computer Networks Aqa
    8 主题
  23. Fundamentals Of Cyber Security Aqa
    1 主题
  24. Methods Of Preventing Cyber Security Threats Aqa
    1 主题
  25. Relational Databases Aqa
    2 主题
  26. Ethical Legal And Environmental Impacts Aqa
    2 主题
课 Progress
0% Complete

Exam code:8525

  • When designing algorithms there are two main tools that can be used to describe them:

    • Pseudocode

    • Flowcharts

Examiner Tips and Tricks

Remember, in the exam you will be expected to create, interpret, correct and refine algorithms in either flowcharts or AQA pseudocode

Systemic Approach

What is a systematic approach to problem solving?

  • A systematic approach means being able to take a logical approach and use algorithmic thinking to solve a problem

  • Some examples of systematic approaches include:

    • Solving a word search puzzle

    • Finding an item within a list

  • A good example of a systematic approach would be a program used to find a username and the matching password in a 2D list

  • In the example below, the 2D list has column 0 which stores the username and column 1 which stores the password

 

[0] 

[1]

[0]

Dave

Un1corn$

[1]

George

B@tman#1

[2]

Elizabeth

Coffee!!

[3]

Henry

Walking&123

  • To iterate through the list, an algorithm would have to take a systematic approach to look for the username entered by the user and then look in the column to the immediate right to find the password for that user

Python code

users = [["Dave", "Un1corn$"],["George", "B@tman#1"],["Elizabeth", "Coffee!!"],["Henry", "Walking&123"]] # Ask the user for a name to search for
name_to_find = input("Enter a name to find: ") # Search for the name in the first column of the list of users
found = False
for i in range(len(users)): if name_to_find == users[i][0]: found = True password_to_check = input("Enter the password: ") if password_to_check == users[i][1]: print("Password correct. Access granted.") break else: print("Incorrect password. Access denied.") break if found == False: print("Name not found.")

Pseudocode

What is pseudocode?

  • Pseudocode is a text based tool that uses short English words/statements to describe an algorithm

  • Pseudocode is more structured than writing sentences in English, but is very flexible

Example

  • A casino would like a program that asks users to enter an age, if they are 18 or over they can enter the site, if not then they are given a suitable message

Pseudocode

Age ← USERINPUT
IF age >= 18 THEN OUTPUT("Welcome to the site")
ELSE OUTPUT("Sorry, this site is for users 18 and over")
ENDIF
  • The casino would like the algorithm refined so that the user also enter their first name and this is used to greet the user when they access the site

Pseudocode

Fname ← USERINPUT
Age ← USERINPUT
IF age >= 18 THEN OUTPUT("Welcome to the site" + fname)
ELSE OUTPUT("Sorry, this site is for users 18 and over")
ENDIF

What are the AQA pseudocode rules?

  • AQA use a standard style for pseudocode which has been around for many years and that is seen in AQA based exams to describe algorithms

  • Pseudocode has no official syntax so to keep exams consistent AQA have stuck with a common and well-used format

Examples

Function

AQA Pseudocode

OUTPUT

OUTPUT("Hello")

INPUT

Fname ← USERINPUT

SELECTION

IF num = 2 THEN

...

ELSE IF num < 4 THEN

...

ENDIF

FOR LOOPS

FOR i ← 1 to 10

...

ENDFOR

WHILE LOOPS

while i ≠ 11

...

ENDWHILE

Examiner Tips and Tricks

AQA have a pseudocode guide (opens in a new tab) for students and teachers to use which will match the pseudocode in the exam papers.

Worked Example

flow-chart-question

Rewrite the flowchart as a pseudocode [4]
You must use Pseudocode

Answer

Pseudocode

INPUT price
IF price < 50 THEN OUTPUT "Great choice!"
ELSE OUTPUT "Way too expensive"
END IF

Program Code

  • Program code, unlike the generic pseudocode, is specific to a programming language

  • The accepted languages you can answer questions in are:

    • C#

    • Python (version 3)

    • VB.NET (opens in a new tab)

  • Exam questions will indicate the form of response expected, for example, pseudocode, program code or a flowchart

Worked Example

A programmer has written a C# program that asks the user to input two integers and then output which of the two integers is the largest. Complete the program by filling in the gaps using the information below. Each item in the table 3 should only be used once. [5]

Console.Write

num1

num2

output

else

<

>

Else if

string

double

int

 

int num1; 

________ num2; 

Console.WriteLine("Enter a number: "); 

num1 = int.Parse(Console.ReadLine()); 

Console.WriteLine("Enter another number: "); 

num2 = int.Parse(Console.ReadLine()); 

if (num1 > num2) 

Console.WriteLine("________is bigger."); 

else if (num1________num2) 

Console.WriteLine("________is bigger."); 

________

Console.WriteLine("The numbers are equal."); 

}

Answer

int num1; 

int num2; 

Console.WriteLine("Enter a number: "); 

num1 = int.Parse(Console.ReadLine()); 

Console.WriteLine("Enter another number: "); 

num2 = int.Parse(Console.ReadLine()); 

if (num1 > num2) 

Console.WriteLine("num1 is bigger."); 

else if (num1 < num2) 

Console.WriteLine("num2 is bigger."); 

else

Console.WriteLine("The numbers are equal."); 

}

Flowcharts

What is a flowchart?

  • Flowcharts are a visual tool that uses shapes to represent different functions to describe an algorithm

  • Flowcharts show the data that is input and output, the processes that take place and any decisions or repetition

  • Lines are used to show the flow of control

flow-chart-symbols

Example

Flowchart

<img alt=”flow-chart-1″ class=”ContentBlock_figure__vJw2q” data-nimg=”1″ decoding=”async” height=”680″ loading=”lazy” sizes=”(max-width: 320px) 320w, (max-width: 640px) 640w, (max-width: 960px) 960w, (max-width: 1280px) 1280w, 1920w” src=”https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=3840/https://cdn.savemyexams.com/uploads/2024/02/flow-chart-1.png” srcset=”https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=16/https://cdn.savemyexams.com/uploads/2024/02/flow-chart-1.png 16w, https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=32/https://cdn.savemyexams.com/uploads/2024/02/flow-chart-1.png 32w, https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=48/https://cdn.savemyexams.com/uploads/2024/02/flow-chart-1.png 48w, https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=64/https://cdn.savemyexams.com/uploads/2024/02/flow-chart-1.png 64w, https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=96/https://cdn.savemyexams.com/uploads/2024/02/flow-chart-1.png 96w, https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=128/https://cdn.savemyexams.com/uploads/2024/02/flow-chart-1.png 128w, https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=256/https://cdn.savemyexams.com/uploads/2024/02/flow-chart-1.png 256w, https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=384/https://cdn.savemyexams.com/uploads/2024/02/flow-chart-1.png 384w, https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=640/https://cdn.savemyexams.com/uploads/2024/02/flow-chart-1.png 640w, https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=750/https://cdn.savemyexams.com/uploads/2024/02/flow-chart-1.png 750w, https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=828/https://cdn.savemyexams.com/uploads/2024/02/flow-chart-1.png 828w, https://cdn.savemyexams.com/cdn-cgi/image/f=auto,width=1080/https://cdn.savemyexams.com/uploads/2024/02/flow-chart-1.p

Responses

您的邮箱地址不会被公开。 必填项已用 * 标注