A-level Computing/AQA/Paper 1/Skeleton program/2024

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

This is for the AQA A Level Computer Science Specification.

This is where suggestions can be made about what some of the questions might be and how we can solve them.

Please be respectful and do not vandalise the page, as this would affect students' preparation for exams!

Please do not discuss questions on this page. Instead use the discussion page.

Section C Predictions[edit | edit source]

The 2024 paper 1 will contain 3 questions worth 11 marks. As long as you know the program well, this will be a walk in the park!

Section D Predictions[edit | edit source]

Programming Questions on Skeleton Program

  • The 2024 paper 1 contains 4 questions: a 5 mark, a 6 mark question and two 14 mark questions - these marks include the screen capture(s), so the likely marks for the coding will be 1-2 marks lower.
  • The 2023 paper 1 contains 4 questions: a 5 mark, a 9 mark question, a 10 mark question and one 13 mark question - these marks include the screen capture(s), so the likely marks for the coding will be 1-2 marks lower.
  • The 2022 paper 1 contained 4 questions: a 5 mark, a 9 mark question, a 11 mark question and one 13 mark question - these marks include the screen capture(s), so the likely marks for the coding will be 1-2 marks lower.
  • The 2021 paper 1 contained 4 questions: a 6 mark, an 8 mark question, a 9 mark question and one 14 mark question - these marks include the screen capture(s), so the likely marks for the coding will be 1-2 marks lower.
  • The 2020 paper 1 contained 4 questions: a 6 mark, an 8 mark question, a 11 mark question and one 12 mark question - these marks include the screen capture(s), so the likely marks for the coding will be 1-2 marks lower.
  • The 2019 paper 1 contained 4 questions: a 5 mark, an 8 mark question, a 9 mark question and one 13 mark question - these marks include the screen capture(s), so the marks for the coding will be 1-2 marks lower.
  • The 2018 paper 1 contained 5 questions: a 2 mark question, a 5 mark question, two 9 mark questions, and one 12 mark question - these marks include the screen capture(s).
  • The 2017 paper 1 contained 5 questions: a 5 mark question, three 6 mark questions, and one 12 mark question.

Current questions are speculation by contributors to this page.

Question 1 - Symbol Case[edit | edit source]

Lower case symbols are not accepted. E.g. if you enter 'q' it is not recognised as 'Q'. Fix this.

C#:

private string GetSymbolFromUser()

            {

                string Symbol = "";

                while (true)

                {

                    Console.Write("Enter symbol: ");

                    Symbol = Console.ReadLine();

                    if (Symbol.Length == 1 && char.IsUpper(Symbol[0])) // Check if the input is a single uppercase letter

                    {

                        break; // Exit the loop if it's a valid uppercase letter

                    }

                    else

                    {

                        Console.WriteLine("Invalid input. Please enter a single uppercase letter.");

                    }

                }

                return Symbol;

            }

Published by Aaron

Delphi/Pascal:


Java:


Python:

    def __GetSymbolFromUser(self):
        Symbol = ""
        while not Symbol in self.__AllowedSymbols:
            Symbol = input("Enter symbol: ").upper()
        return Symbol


VB.NET:


Question 2 - Game file not existing[edit | edit source]

If a filename is entered that does not exist, the game is unplayable (infinite loop). Amend the program so that in this case the default game is played, with a suitable message to indicate this.

C#:

Delphi/Pascal:


Java:


Python:

This function edits the __LoadPuzzle function so that it loops back to Main() if it fails to load the game (i.e. the file name was invalid) which results in the user being prompted to re-enter the filename.

def __LoadPuzzle(self, Filename):
        try:
            with open(Filename) as f:
                NoOfSymbols = int(f.readline().rstrip())
                for Count in range (1, NoOfSymbols + 1):
                    self.__AllowedSymbols.append(f.readline().rstrip())
                NoOfPatterns = int(f.readline().rstrip())
                for Count in range(1, NoOfPatterns + 1):
                    Items = f.readline().rstrip().split(",")
                    P = Pattern(Items[0], Items[1])
                    self.__AllowedPatterns.append(P)
                self.__GridSize = int(f.readline().rstrip())
                for Count in range (1, self.__GridSize * self.__GridSize + 1):
                    Items = f.readline().rstrip().split(",")
                    if Items[0] == "@":
                        C = BlockedCell()
                        self.__Grid.append(C)
                    else:
                        C = Cell()
                        C.ChangeSymbolInCell(Items[0])
                        for CurrentSymbol in range(1, len(Items)):
                            C.AddToNotAllowedSymbols(Items[CurrentSymbol])
                        self.__Grid.append(C)
                self.__Score = int(f.readline().rstrip())
                self.__SymbolsLeft = int(f.readline().rstrip())
        except:
            print("Filename not valid, re-enter on next line")
            Main()


VB.NET:


Question 3 - Blow up a block (blocked cell)[edit | edit source]

Have a 'bomb' that can remove or 'blow-up' a block in a 'blocked cell', but costs you some of your score (minus some points):

C#:


Delphi/Pascal:


Java:


Python:

    # added "B" to self.__AllowedSymbols
    def AttemptPuzzle(self):
        Finished = False
        while not Finished:
            self.DisplayPuzzle()
            print("Current score: " + str(self.__Score))
            Row = -1
            Valid = False
            while not Valid:
                try:
                    Row = int(input("Enter row number: "))
                    Valid = True
                except:
                    pass
            Column = -1
            Valid = False
            while not Valid:
                try:
                    Column = int(input("Enter column number: "))
                    Valid = True
                except:
                    pass
            Symbol = self.__GetSymbolFromUser()
            self.__SymbolsLeft -= 1
            CurrentCell = self.__GetCell(Row, Column)
            if CurrentCell.CheckSymbolAllowed(Symbol):
                CurrentCell.ChangeSymbolInCell(Symbol)
                AmountToAddToScore = self.CheckforMatchWithPattern(Row, Column)
                if AmountToAddToScore > 0:
                    self.__Score += AmountToAddToScore
            elif Symbol == "B" and self.__bomb(Row,Column):
                self.__Score -= 3

    def __bomb(self,Row, Column):
        Index = (self.__GridSize - Row) * self.__GridSize + Column - 1
        if self.__Grid[Index].GetSymbol() == "@":
            blockedCellSymbolsNotAllowed = self.__Grid[Index].getNotAllowedSymbols()
            self.__Grid[Index] = Cell()
            self.__Grid[Index].setSymbolsNotAllowed(blockedCellSymbolsNotAllowed)
            self.__Grid[Index].ChangeSymbolInCell("")
            self.__Grid[Index].IsEmpty()
            return True
        return False

     #Funtions below are in the Cell class
    def getNotAllowedSymbols(self):
        return self.__SymbolsNotAllowed

    def setSymbolsNotAllowed(self,SymbolsNotAllowed):
        self.__SymbolsNotAllowed = SymbolsNotAllowed


VB.NET:


Question 4 - Add additional symbols/letters[edit | edit source]

Add additional letters/symbols e.g. L or O or U or V or C or H or I.

C#:


Delphi/Pascal:


Java:


Python:


VB.NET:


Question 5 - Save current game (status)[edit | edit source]

Save the current status of the game (file-handling)/writing to a text file.

C#:


Delphi/Pascal:


Java:


Python:


VB.NET:


Question 6 - Rotated letter/ HEY babes[edit | edit source]

Score a 'rotated' symbol/letter (lower score?)

C#:


Delphi/Pascal:


Java:


Python:


VB.NET:


Question 7 - Game difficulty setting[edit | edit source]

Offer 'game difficulty' setting to change level of game (with greater number of blocked cells = 'more difficult')

C#:


Delphi/Pascal:


Java:


Python:

class Puzzle():
    def __init__(self, *args):
        if len(args) == 1:
            self.__Score = 0
            self.__SymbolsLeft = 0
            self.__GridSize = 0
            self.__Grid = []
            self.__AllowedPatterns = []
            self.__AllowedSymbols = []
            self.__LoadPuzzle(args[0])
        else:
            self.__Score = 0
            self.__SymbolsLeft = args[1]
            self.__GridSize = args[0]
            self.__Grid = []
            print("1: Easy, 2: Normal, 3: Hard")
            difficulty = ""
            while not (difficulty == "1" or difficulty == "3" or difficulty == "2") or not difficulty.isdigit():
                difficulty = input("Enter a difficulty")
            difficulty = int(difficulty)
            difficulties  = {1:95 , 2:80 , 3:65} #modify these values to change difficulties
            for Count in range(1, self.__GridSize * self.__GridSize + 1):
                if random.randrange(1, 101) < difficulties[difficulty]:
                    C = Cell()
                else:
                    C = BlockedCell()
                self.__Grid.append(C)
            self.__AllowedPatterns = []
            self.__AllowedSymbols = []
            QPattern = Pattern("Q", "QQ**Q**QQ")
            self.__AllowedPatterns.append(QPattern)
            self.__AllowedSymbols.append("Q")
            XPattern = Pattern("X", "X*X*X*X*X")
            self.__AllowedPatterns.append(XPattern)
            self.__AllowedSymbols.append("X")
            TPattern = Pattern("T", "TTT**T**T")
            self.__AllowedPatterns.append(TPattern)
            self.__AllowedSymbols.append("T")


VB.NET:


Question 8 - Fix symbols placed error[edit | edit source]

When you try place a symbol in a invalid cell it still counts as a placed cell towards the amount of symbols placed.

C#:


Delphi/Pascal:


Java:


Python:


VB.NET:


Question 9[edit | edit source]

Create a new puzzle file to be imported into the code for the user to play:

C#:


Delphi/Pascal:


Java:


Python:


VB.NET:


Question 10[edit | edit source]

Be able to undo a move once you have done it but it uses points and you only have a limited amount of times you can undo a move:

C#:


Delphi/Pascal:


Java:


Python:


VB.NET:


Question 11[edit | edit source]

Description of problem:

C#:


Delphi/Pascal:


Java:


Python:


VB.NET:



Question 12[edit | edit source]

Description of problem:

C#:


Delphi/Pascal:


Java:


Python:


VB.NET:


Question 13[edit | edit source]

Description of problem:

C#:


Delphi/Pascal:


Java:


Python:


VB.NET:


Question 14[edit | edit source]

Description of problem:

C#:


Delphi/Pascal:


Java:


Python:


VB.NET:


Question 15[edit | edit source]

Description of problem:

C#:


Delphi/Pascal:


Java:


Python:


VB.NET:


Question 16[edit | edit source]

Description of problem:

C#:


Delphi/Pascal:


Java:


Python:


VB.NET:


Question 17[edit | edit source]

Description of problem:

C#:


Delphi/Pascal:


Java:


Python:


VB.NET:


Question 18[edit | edit source]

C#:


Delphi/Pascal:


Java:


Python:


VB.NET: