3.1.1 - 3.1.5 [Data types, structures, procedures/functions, program flow control, scopes]

Description

GCSE Computer Science Flashcards on 3.1.1 - 3.1.5 [Data types, structures, procedures/functions, program flow control, scopes], created by Katzz on 24/10/2014.
Katzz
Flashcards by Katzz, updated more than 1 year ago
Katzz
Created by Katzz over 9 years ago
181
3

Resource summary

Question Answer
What is Data? Consists of facts/statistics out of context and is used for analysis.
What is 'information'? Sentence of words or series of image put into context - gives 'data' meaning.
What is a variable? --------------------------------------------------------- What is a constant? Variable - data entities whose values can be altered ----------------------------------------------------------- Constant - data entities that can't be altered.
Ian explains that '3' is a variable whereas 's' isn't. Explain why he is right/wrong. Wrong - variable can only be a LETTER not a NUMBER.
Emma starts her programming with a variable, _f64. Ian says she is wrong because a variable shouldn't contain numbers. Is he right? No - variable can start with an underscore '_' and then contain numbers or letters or more underscores. It shouldn't start with a number though.
What are 'data types'? The different forms that data can be stored in.
What do 'internal codes' do? Keep track of the different types of data of every data object.
What is the most common data type? Primitive data types - predefined types of data supported by programming language.
What is an integer data type? Deals with whole numbers and not decimal numbers. It is a complete unit or entity.
What is a real data type and when is it used? Contains numeric data in DECIMAL form. Used in situations when more accurate info than an integer can provide is needed.
What is the most popular code for representing real numbers? The IEEE Floating-Point Standard
Why can the decimal in a floating-point number float? Because floating-point numbers don't have a fixed number of digits before and after the decimal point.
Are all floating-point numbers that a computer represents right? Most are approximations
What is an FPU? Floating-point unit - a chip in many microprocessors to perform floating-point arithmetic BECAUSE mathematics with floating-point numbers need a lot of computing power and makes computers slow during processing.
Fixed-point numbers are more accurate than floating-point numbers , then why are they used? Because computers can handle a large range of them - BUT it's a challenge in programming to ensure that the approximations in fpn lead to reasonable results.
What is a 'string'? Text composed of a set of characters that can include spaces and numbers E.g. 'Gary' and 'Gary is the best'
What does the data type 'boolean' represent? The values of true/false or yes/no.
What is the primitive data type of Boolean? Logical.
What is Boolean logic? A type of mathematical comparison - used to evaluate true/false.
What does the boolean operator AND mean? True IF both sides are true
What does the boolean operator OR mean? True IF one or both sides are true
What does the boolean operator NOT mean? Changes true to false AND false to true
Turn over to memorise all of the operators of python < Less than <= Less than/equal to == Equal to != Not equal to >= Greater than/equal to > Greater than
What would happen if you multiplied a number with a string. E.g. 'Kinder' * 5 Multiplies the word that many times. E.g. Kinder Kinder Kinder Kinder Kinder
How would you write this in Boolean: When the door is open and it is cold outside I have to wear my coat If ("door is open") AND ("it is cold outside") then "wear coat"
What is a 'complier'? A special program that processes the lines of code you have written in your chosen programming language by turning them into the machine language that the system processor uses.
Real data types can hold any data (decimal and whole), then what's the point of integer data types? 1. PROCESSING SPEED - time it takes computer to calculate 'real' numbers is longer than it is for integers. 2. STORAGE - real data types take up more space than integers. So it's more efficient to use integers when real isn't needed.
The date/time variable is used to store date and time. What are the advantages of this data type? 1. You can choose which format you'd like the date/time to be displayed as (dd/mm/yy OR mm/dd/yy) 2. The data entered is automatically validated to make sure it's valid (doesn't have to be accurate - validation means its possibly accurate)
What are data structures? Study of data structures is about organising data so it's more suitable for computer processing. Most data structures are viewed as simple containers used for storing a collection of objects of a given type.
Explain the 2 most common data structures. ARRAYS - Ordered arrangement of data elements that are accessed by referencing their location within the array. LINKED LIST - Group of elements - each contains pointer that points to following element in list. List must maintain pointer when data changes. ARRAY AND LINKED LIST STORE MULTIPLE ELEMENTS MOSTLY OF SAME TYPE.
What are one-dimensional arrays? A structured collection of components that can be accessed individually by specifying position of component with a single index value. In Python & PHP - they allow a list of items to be stored and each can be accessed by pointing to its location within array.
Example of a one-dimensional array carMakers = ["Ford", "Land Rover", "Vauxhall", "Nissan", "Mercedes"] *A one-dimensional array is just a list of variables*
Array: carMakers = ["Ford", "Land Rover", "Vauxhall", "Nissan", "Mercedes"] Use a coded solution to identify "Mercedes" as the car_name. car_name = carMakers[4] *It's [4] because you start counting with 0 in programming so number 4 (4th variable) is Mercedes.
subject = Computer Science How do you slice this string so that you can also see the 5th letter to the 11th letter. How can you slice this string so that you can only see the 10th letter? subject[3:11] *This will print 'puter sci' subject[10] *this will print 'i'
3.1.3 Program Flow Control - Chapter 4
What is a while statement / while loop? Efficient loops that continue to loop until the condition is false.
What are the 3 fundamental control structures? Sequence - set of instructions in order meaning each action follows prev action SELECTION - involves choice (IF, ELSE) ITERATION - repeats actions
Program flow control represented as a flowchart
What does the 'Start' and 'End' symbol represent? START - start of process and has 1 output END - End of process: has 1 input and contains 'End' or 'Return' depending on its function in the overall process of flowchart.
What does the 'Process' symbol represent? > some operations that's carried out on an element of data. > Has 1 input and 1 output > Contains brief description describing process being carried out on the data.
What does the 'Decision' symbol represent? > A Boolean choice > Has 1 input and 2 ouputs > Contains question that has 2 possible answers > 2 outputs labelled with 2 answers to question to show direction of logic flow depending on decision.
Example of flowchart
Flowchart showing an iteration loop. *It'll keep repeating until the statement is false.
A flowchart representing selection *If condition is true, perform action 1, else perform action and end.
3.1.4 PROCEDURES AND FUNCTIONS
What are the advantages of program control flowcharts? 1. Lets large problems break down into smaller, manageable sections 2. Helps with testing the software 3. Helps to design programs that can be modified later 4. Helps discovers error before they're programmed
What are procedures and functions? Named blocks of code [SUBROUTINES] that can be used and re-used to perform specific tasks and are featured in ALL programming language.
What are the definitions of a PROCEDURE and FUNCTION? PROCEDURE - a block of code that performs tasks without returning a value FUNCTION - similar to procedure but it returns a value
What are the 2 types of functions? User-defined functions - created by user for program Built-in functions - part of programming language.
What are BUILT-IN functions provided by and stored by? Provided by the system Stored in library files
Built-in functions are the real power of any programming language. Why are they so useful? They're always available for your program to call. They save a lot of effort in writing code to perform common tasks.
Built-in function example On line B9, it's adding up the chocolate for line B4, but a built-in function called SUM can do the same thing
What are common built-in functions in python? print( ) input( ) list( ) len( )
What is a PARAMETER? A special variable that prevents procedures and functions from having a limited use.
When is a parameter used? In a subroutine to refer to a piece of data provided as an input in the subroutine. It lets values pass to the procedure/function for use inside it.
Why can't functions be used in the same manner as procedures? They return a value back instead of just performing duties.
Give 2 reasons as to why functions are used 1. Reusability - once a function is defined, it can be used over and over again instead of writing the code. 2. Lets you test small parts of the program in isolation from the rest.
Show full summary Hide full summary

Similar

Computing Hardware - CPU and Memory
ollietablet123
SFDC App Builder 2
Parker Webb-Mitchell
Data Types
Jacob Sedore
Intake7 BIM L1
Stanley Chia
Software Processes
Nurul Aiman Abdu
Design Patterns
Erica Solum
CCNA Answers – CCNA Exam
Abdul Demir
Abstraction
Shannon Anderson-Rush
Spyware
Sam2
HTTPS explained with Carrier Pigeons
Shannon Anderson-Rush
Data Analytics
anelvr