A-level Computing/AQA/Problem Solving, Programming, Data Representation and Practical Exercise/Fundamentals of Programming/questions

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

Variables[edit | edit source]

Using the source code below, answer the following questions:

Module Glocals
	Dim number1 as integer = 123
	
	Sub Main()
		console.writeline(number1)
		printLocalNumber()
		printGlobalNumber()
	End Sub
	
	Sub printLocalNumber
		Dim number1 as integer = 234
		console.writeline(number1)
	End Sub

	Sub printGlobalNumber
		console.writeline(number1)
	End Sub
End Module
  1. Name an identifier of a global variable
  2. Copy down an assignment statement
  3. For the following, add declaration statements including datatypes
    1. The name of a person
    2. The gender of a person
    3. The DateOfBirth of a person
    4. Whether a person is a teacher or not
  4. Name the identifier of a local variable
  5. Why wouldn't you use an integer to store a person's height in metres? What would you use instead?
  6. Give an example of when you would use a Constant variable
  7. Why would the following statement be unwise for a 100m race: dim winningTime as integer
  8. What are the benefits of using a record?
  9. What is the output of the above code?
  10. Coded question...

Data Structures[edit | edit source]

Using the following code answer the questions below:

  1. How many dimensions does the array in the above code have?
  2. Construct a trace table for the above code.
  3. What does the code do?
  4. Declare an empty data structure to store a chess board of 64 squares, allowing for the recording the colour of each square.
  5. Why is it important to write files?
  6. Write down the CSV code for the following data:
Type Colour
Cat Brown
Dog Purple, with red bits

3 Validation 3.1 Constant Declarations 3.2 Selection 3.2.1 IF Statement 3.2.1.1 Nested Ifs 3.2.2 Case Statement 3.3 Iteration 3.4 Procedures and Functions 3.4.1 Declarations 3.4.2 Calls 3.4.3 Parameters 3.4.3.1 ByRef 3.4.3.2 ByVal

answers

4 Fundamentals of Structured Programming 4.1 structure tables 4.2 structure charts 4.3 hierarchy charts 4.4 Good Coding Practice 4.4.1 Use procedures that execute a single task 4.4.2 Use procedures/functions with interfaces 4.4.3 Use sensible variable datatypes 4.4.4 Meaningful identifier names 4.4.4.1 Use sensible variable names 4.4.4.2 Use sensible Function/Procedure names 4.4.5 Try to stick to one naming convention 4.4.6 Don't make your names too long 4.4.7 Indent your work 4.4.8 Use comments where necessary 4.5 The advantages of the structured approach

Data Structures[edit | edit source]

2.1 One-Dimensional Arrays 2.2 Two-Dimensional Arrays 2.3 Fields 2.4 Records 2.5 Files 3 Validation 4 Fundamentals of Structured Programming 4.1 Constant Declarations 4.2 Selection 4.2.1 IF Statement 4.2.1.1 Nested Ifs 4.2.2 Case Statement 4.3 Iteration 4.4 Procedures and Functions 4.4.1 Declarations 4.4.2 Calls 4.4.3 Parameters 4.4.3.1 ByRef 4.4.3.2 ByVal 5 Good Coding Practice 5.1 Use sensible variable datatypes 5.2 Use sensible variable names 5.3 Use sensible Function/Procedure names 5.4 Try to stick to one naming convention 5.5 Don't make your names too long 5.6 Indent your work 5.7 Use comments where necessary