Foundation of Programming (AQA)

studied byStudied by 6 people
0.0(0)
Get a hint
Hint

Data Types

1 / 65

flashcard set

Earn XP

66 Terms

1

Data Types

Specifies the kind of data that can be stored and manipulated within a program. Examples: integers, real numbers, Booleans, characters, and strings.

New cards
2

Integer

Whole numbers without a fractional part, used for counting and indexing. Example: 5, -42

New cards
3

Real (Float)

Numbers that can contain a fractional part, used for measurements and continuous data. Example: 3.14, -0.001

New cards
4

Boolean

Represents true or false values, used for logical operations and conditional statements. Example: True, False

New cards
5

Character

A single alphanumeric character, used for text processing at a granular level. Example: 'A', '3'

New cards
6

String

A sequence of characters, used for text and sentences. Example: "Hello", "123ABC"

New cards
7

Variable Declaration

Introduces a variable by specifying its name and type. Example: age = 25

New cards
8

Constant Declaration

Defines a value that cannot be changed during program execution. Example: PI = 3.14159

New cards
9

Assignment

Assigns a value to a variable. Example: name = "Alice"

New cards
10

Iteration

Repeats a block of code multiple times or until a condition is met.

New cards
11

Selection

Makes decisions within a program based on conditions. Example: score = 85

New cards
12

Subroutine (Procedure/Function)

Encapsulates a block of code that performs a specific task. Example: def calculate_area(width, height): return width * height

New cards
13

Sequence

Default mode of execution where statements run one after the other.

New cards
14

Nested Iteration

Repeats a sequence of instructions within another iteration.

New cards
15

Nested Selection

Makes decisions within a program based on conditions within another selection.

New cards
16

Named Constants and Variables

Used to make programs easier to read and maintain. Constants ensure values do not change accidentally, while variables hold data that can change.

New cards
17

Meaningful Identifier Names

Improve code readability and maintainability by using descriptive names and consistent naming conventions. Examples: total_sum, user_age, calculate_area

New cards
18

Arithmetic Operations in Programming

Include addition, subtraction, multiplication, real division, integer division, and remainders.

New cards
19

Modular Arithmetic

Used in scenarios requiring periodicity, such as clock arithmetic.

New cards
20

Relational Operations

Include common relational operators like Equal To, Not Equal To, Less Than, Greater Than, Less Than or Equal To, and Greater Than or Equal To.

New cards
21

Boolean Operations

Include common Boolean operators like NOT, AND, and OR.

New cards
22

Data Structures

Ways of organizing and storing data efficiently. Examples: Arrays, Records (Structures).

New cards
23

Records

Used to group different data types under one name, allowing for a structured way to represent real-world entities.

New cards
24

Arrays

A collection of elements of the same type, stored in contiguous memory locations.

New cards
25

One-Dimensional Array

Example: numbers = [1, 2, 3, 4, 5]

New cards
26

Two-Dimensional Array

Example: matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]

New cards
27

Efficiency

Data structures like arrays allow for efficient storage and retrieval of data.

New cards
28

Organization

Records provide a structured way to store related data fields.

New cards
29

Simplicity

Arrays and records simplify the implementation of algorithms and data manipulation operations.

New cards
30

User Input

Obtaining user input from the keyboard in Python using the input() function.

New cards
31

Output Data

Using the print() function in Python to display data and information on the computer display.

New cards
32


Length

Using the len() function in Python to get the length of a string.

New cards
33

Position

Accessing individual characters in a string by their position using zero-based indexing.

New cards
34

Substring

Extracting a part of a string.

New cards
35

Concatenation

Joining two strings together.

New cards
36

Convert Character to Character Code

Using ord() to get the ASCII value of a character and chr() to get the character from an ASCII value.

New cards
37

String Conversion Operations

Converting between different data types like string to integer, real to string, etc.

New cards
38

Generating Random Integer

A specified range using randint() to generate a number from the random module.

New cards
39

Generating Random Float

Generating a random number between 0.0 and 1.0 using the random() function.

New cards
40

Random Choice from a Sequence

Choosing a random element using the choice() function.

New cards
41

Shuffling a Sequence

Randomly shuffling the elements of a sequence using the shuffle() function.

New cards
42

Simulation

Simulating random events or behaviors.

New cards
43

Games

Generating random game scenarios, outcomes, or choices.

New cards
44

Statistical Sampling

Generating random samples for statistical analysis.

New cards
45

Cryptographic Applications

Creating cryptographic keys or initialization vectors.

New cards
46

Subroutine

A named 'out of line' block of code that can be executed by writing its name in a program statement.

New cards
47

Procedures

Subroutines that perform actions but do not return a value.

New cards
48

Functions

Subroutines that perform actions and return a value.

New cards
49

Modularity

Breaks programs into manageable sections. Each subroutine performs a specific task, making it easier to understand and manage.

New cards
50

Simplified Maintenance

Easier to update and fix code. Changes in a subroutine affect all calls to it, reducing the need to make multiple updates.

New cards
51

Improved Readability

Makes code more organized and easier to understand. Subroutines give structure and clarify the purpose of each part of the code.

New cards
52

Enhanced Collaboration

Different programmers can work on different subroutines simultaneously. This is particularly useful in large projects.

New cards
53

Parameters

Variables listed as part of a subroutine's definition, allowing data to be passed into the subroutine.

New cards
54

Data Passing by Value

A copy of the data is passed to the subroutine.

New cards
55

Data Passing by Reference

A reference to the actual data is passed, allowing modifications.

New cards
56

Returning Values from Subroutines

Subroutines can return a value to the calling routine using the return statement.

New cards
57

Local Variables in Subroutines

Variables declared within a subroutine, accessible only within that subroutine.

New cards
58

Structured Approach

A method of programming that emphasizes breaking a program into smaller, manageable, and reusable modules or subroutines.

New cards
59

Common Validation Checks

Includes minimum length check, empty string check, and range check for validating input data.

New cards
60

Simple Authentication Routines

Example of an authentication routine that checks username and password for validity.

New cards
61

Testing

Involves running a program to find errors or confirm expected behavior under different conditions.

New cards
62
New cards
63

Types of Errors

Syntax errors and logic errors are common types of errors in programming.

New cards
64

Records (Structures)

Used to group different data types under one name, allowing for a structured way to represent real-world entities. This is akin to a form where different fields (like name, address, phone number) are filled out for each individual.

New cards
65

Syntax Error

Errors due to incorrect code syntax

New cards
66

Logic Error

Errors where program runs but produces incorrect results

New cards

Explore top notes

note Note
studied byStudied by 18 people
... ago
4.0(1)
note Note
studied byStudied by 12 people
... ago
5.0(1)
note Note
studied byStudied by 34 people
... ago
5.0(1)
note Note
studied byStudied by 13 people
... ago
5.0(2)
note Note
studied byStudied by 1 person
... ago
5.0(1)
note Note
studied byStudied by 57 people
... ago
5.0(1)
note Note
studied byStudied by 22 people
... ago
5.0(1)
note Note
studied byStudied by 1975 people
... ago
4.7(11)

Explore top flashcards

flashcards Flashcard (93)
studied byStudied by 1 person
... ago
5.0(1)
flashcards Flashcard (115)
studied byStudied by 13 people
... ago
5.0(2)
flashcards Flashcard (22)
studied byStudied by 17 people
... ago
5.0(3)
flashcards Flashcard (75)
studied byStudied by 2 people
... ago
5.0(1)
flashcards Flashcard (29)
studied byStudied by 27 people
... ago
5.0(2)
flashcards Flashcard (40)
studied byStudied by 1 person
... ago
5.0(1)
flashcards Flashcard (20)
studied byStudied by 1 person
... ago
5.0(1)
flashcards Flashcard (134)
studied byStudied by 2615 people
... ago
4.0(26)
robot