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

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

Validation[edit | edit source]

Error Checking

List the Erroneous, Extreme and Typical Data for a user selecting a menu item:

Answer:


Erroneous data – Anything other than “a, b, d, e, g, h, n” (in the original program, an example would be “z” or “2”).

Extreme data-

Typical data – Letters “a, b, d, e, g, h, n” (in the original program).

List the Erroneous, Extreme and Typical Data for Caeser Cipher Offset:

Answer:

Variables[edit | edit source]

Variables

State one advantage of using named constants for constant values

Answer:

Improves readability of code // Easier to update the programming code if the value changes ( A. by implication) // reduce the likelihood

of errors;

Give the identifier of a local variable

Answer:


Any from; Ciphertext, Plaintext, Choice, AmountToShift, StartPosition, EndPosition, SizeOfRailFence, N,MenuChoice, TextFromUser, CharacterFromFile, TextFromFile, Count, Key, TypeOfCharacter, ChangedText, ASCIICode, NoOfColumns, NoOfRows, NoOfCiphertextCharacters, NoOfCiphertextCharactersProcessed, i, j, PostitionOfNextCharacter, LastFullRowNo, AmountToReduceNoOfColumnsTimesjBy, BeginningOfNextRowIndex, HiddenMessage, CurrentPosition.


State the name of an identifier used for a pre-defined function with a single parameter

Answer:


VB.net = Asc("a")


State the name of an identifier used for a variable that is used to control the iteration of a loop

Answer:


Count.

State the name of a user-defined procedure/function that has exactly 3 parameters, and name them.

Answer:


EveryNthCharacterSteganography(StartPosition, EndPosition, N)

Give an example of an assignment statement:

Answer:


Plaintext = ""

Give an example of a variable declaration:

Answer:


VB.net - Dim N As Integer


Give an example of the use of a variable that has the role of being a Most Recent Holder :

Answer:


textFromUser


Give an example of the use of a variable that has the role of being a Stepper :

Answer:


Count


Give an example of the use of a variable that has the role of being a Gatherer :

Answer:


ciphertext


Loops[edit | edit source]

Loops

Give the name of a stepper variable used in a loop?

Answer:

Count

Give the name of a fixed variable used in a loop?

Answer:

Give the name of a follower used in a loop?

Answer:

Give the name of a most recent holder used in a loop?

Answer:

What is the purpose of nested loops?

Answer:

Why have they used FOR loops in the subroutine ????

Answer:

Sub Routines[edit | edit source]

Sub Routine

Write down a function declaration used in the program

Answer:

Write down a function call used in the program

Answer:

Write down a procedure declaration used in the program

Answer:

Give the name of a parameter used in a procedure

Answer:

Explain the difference between using byRef and byVal

Answer:

When a parameter is passed byRef, the variable inside the routine uses a reference to the same memory location as the variable passed as the parameter. When a parameter is passed byVal, the variable inside the routine copies the value of the calling code's variable to the routine's parameter.

Why is Byref used in the ????? sub routine?

Answer:

ByRef is used because the procedure is then able to change the value that it was sent when it was called.

Write down where a return value for a function is assigned:

Answer:

Name the flag used in the sub routine ?????? and describe its purpose

Answer: