Docsity

Abstraction and Decomposition in Computer Science, Exams of Computer Science

Toggle sidebar
bg1
OCR A Level Computer Science
Paper 2 test questions with
complete answers.
What is computational thinking? - Answer The ability to think logically
about a problem in a way a computer can execute it and apply
techniques for solving it using a set of problem solving methods.
Why is computational thinking important? - Answer As many
overarching problems are very difficult to understand
What is the aim of computational thinking? - Answer To be able to
make an overarching problem understood and then formally
represented and solved
What does computational thinking require? - Answer Computational
thinking requires algorithmic thinking
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d

Partial preview of the text

Download Abstraction and Decomposition in Computer Science and more Exams Computer Science in PDF only on Docsity!

OCR A Level Computer Science

Paper 2 test questions with

complete answers.

What is computational thinking? - Answer The ability to think logically about a problem in a way a computer can execute it and apply techniques for solving it using a set of problem solving methods. Why is computational thinking important? - Answer As many overarching problems are very difficult to understand What is the aim of computational thinking? - Answer To be able to make an overarching problem understood and then formally represented and solved What does computational thinking require? - Answer Computational thinking requires algorithmic thinking

What stages does algorithmic thinking require? - Answer - Understanding the problem

  • Formulate the problem
  • Design an algorithm
  • Implement the algorithm
  • Run the code and solve the original problem What does formulating the problem entail? - Answer Producing a concise representation of the problem using abstraction and/or mathematical notation What is abstraction? - Answer Abstraction is the process of removing the unnecessary details and leaving only the key elements of a problem to allow focus on the essential features making an overarching problem easier and potentially faster to solve giving an alternate representation of reality Give examples of abstraction - Answer - Variables
  • Objects
  • Layers
  • Data models
  • Data structures
  • entity-relationship diagrams

What is a data model? - Answer A data model is an abstract model that organises elements of data and how they relate to one another and to real world entities What is an entity relationship diagram? - Answer An entity relationship diagram is a graphical model to represent the relationship between different entitites What is an overall definition of generalisation? - Answer Generalisation is solving new problems based on previous problems for which we have an existing solution normally involving the use of an algorithm to solve a problem and adapting it so it can solve similar problems Why is abstraction required? - Answer Abstraction enables the programmer to focus on the important aspects of a program rather than focusing on unnecessary detail What does abstraction enable? - Answer Abstraction enables:

  • teams of programmers to work on different aspects of a problem
  • programmers to user pre built and built in functions without concerning themselves how it works Describe how layering is an example of abstraction - Answer Layering is an example of abstraction. How one layer is implemented is self

contained and independent of another ayer. For the programmer developing one layer of a system, all that is necessary is to know wha input requirements are for the next layer and what outputs are expected from the previous layer Outline how abstraction relates to reality - Answer Abstraction is a simplification of reality. Entities in the real world are represented by containers such as variables or data structures. The real world at a values are stored in these containers Describe how abstraction applies to object oriented programming - Answer In object oriented programming, the objects are abstraction of real world entities and the attributes and methods represent real world characteristics and actions When first developing an abstract model what must you consider? - Answer When first developing a model you must consider if the problem can be solved using a computer program If problem the abstract model is representing can be solved using a computer program what must you then need to consider? - Answer - What are the key features of the problem

  • How will it be used
  • Who will be using it
  • What is the skill set of the target user group

What about the data must be considered when designed a proposed solution to the problem? - Answer The designer must decide upon data and structures required for the proposed solution to the problem What are preconditions? - Answer Preconditions are requirements which must be met before a program can be executed. Give examples of preconditions that can be specified within documentation - Answer - Requirements for the specification specification the device to be able to run the program

  • the operating system required to run the program
  • any additional software or hardware Give examples of preconditions when planning the development of a program or routine - Answer - Sub programs will need the correct data passed to them
  • Input data should be validated to ensure it meets essential criteria
  • actions need to be validated to ensure they will not crash the program if erroneous results are returned Give example of the preconditions that need to be applied for an algorithm traversing a binary tree? - Answer - what type of tree it is, for example binary
  • if it is ordered
  • traversal order

What is cache? - Answer Cache is very fast memory with L1 found on the CPU and cats as a temporary store for the most frequently used instructions and data. How is the contents of what's stored in cache determined? - Answer An algorithm anticipates what instructions and data will need to be stored there ready for fast access to improve efficiency and is vital component of thinking ahead Why is cached data important? - Answer Cached data can replace the need for recalculations or the need to transfer data from slow to access storage online or on a disk Give an example for how caching is used for web access - Answer Caching is used extensively for web access where frequently used pages are stored for future use What is the advantage for caching frequently used web pages? - Answer - content can be loaded with minimal delay

  • any images and text do not need to be downloaded very time the page is visited This also helps free bandwidth for other tasks

When developing programs how can certain commonly used functions be reused? - Answer Commonly used functions can be pre-written and be provided as libraries within the programming language for reuse by the programmer What are the advantages of reusing pre-written components - Answer The advantages of reusing pre-written components:

  • They are reliable and bug free having been tested and used many times
  • they save time for the programmer
  • they saves on development cots for a project
  • mathematical techniques and other expert processes can be optimized by experts for computational efficiency Sometimes why may it be more appropriate to start from scratch rather than use pre-written components? - Answer There may be some compatibility issues when using prewritten code What is decomposition? - Answer Decomposition is the process of breaking down problems into smaller and more manageable sub problems so each one is self contained can be solved and recognised individually and effectively in order to make the overarching problem easier to solve

Describe how top level hierarchal structure diagrams are good visualisations for problems, their solutions and decomposition - Answer Top down design is used to make complex problems easier to understand and solve as each branch is repeatedly sub divided until the problem is broken down into tasks that are able to be solved at the lowest level What types of solutions may be inappropriate for top level diagrams? - Answer Event driven programs do not easily fit into the model of hierarchal structure as there are parallel strands for linked objects but the top down design can be used for the processes within these linked objects After decomposition has occurred what should then take place? - Answer Following decomposition, development for each individual solution should take place What could each solution for a decomposed subproblem be? - Answer - A pre existing function or subprogram

  • An existing solution that can't be modified
  • An individual task that can be allocated to a programmer What would each decomposed sub problem represent? - Answer Each decomposed subproblem should represent a single self contained solution model estate can be developed and tested independently from the rest of the code and then integrated into the main solution

mathematical problem which have known rules that will be applied to produce the required output What is a paradigm? - Answer A programming paradigm is an approach to programming (not a particular type of language) What are the two main paradigms? - Answer procedural and object orientated When developing a computer solution what should be determined before starting? - Answer - The choice of programming paradigm

  • The programming language and/or IDE that provides the most appropriate features to solve the problem
  • Peripheral devices that are required What is it necessary to do when thinking logically in order to solve a problem? - Answer - identify when decision are required to be made
  • Identify what decision need to be made
  • identify the conditions to enable a decision to be made
  • understand the interactions between decisions
  • apply decision making to the real world problem What are the best ways to identify decision points in programs? - Answer using flowcharts or pseudocode

What may the choice of programming language determine? - Answer The choice of programming language may determine what is possible to code What may affect the choice of programming language? - Answer What is required of the code may determine the choice of programming language When may an assembler be chosen over a high level language? - Answer When coding for a small embedded system, an assembler is more likely choice than a high level language Give an example of a minor change to a condition that can drastically affect a code's output? - Answer using a > instead of >= Give an example of how a choice of loop can drastically change the output of a program? - Answer A repeat loop always executes at least once while a while loop may never have to run if the initial condition isn't met What user involved decisions may need to be considered when developing software? - Answer - Identify where the user will need to make decisions

  • identify and provide for all the possible outcomes for those decisions
  • organisation of the separate tasks and switching between processors can cause delays in processes starting and actually slow down the program
  • some problems just cannot be broken down into tasks that can be completed simultaneously
  • problems with large sections that need to be sequentially completed will not benefit from other parts being processed simultaneously What does genuine parallel processing require? - Answer Multi core processors. Parallel processing can have significant benefits if problem is suited to being broken down into modules that can be processed simultaneously though time and processing power may be taken up in deciding which tasks can be split up and the reassembly of multiple threads In a single core processor, how the may the illusion of parallel processing be given? - Answer Giving a small time slice to each tasks int he processor meaning that tasks are being completed sequentially but appear simultaneously What is an algorithm? - Answer An algorithm is a sequence of unambiguous rules and instruction used for solving or completing a specific task

What type of representation is an algorithm and what is the advantage of this? - Answer An algorithm is a generalised representation so can be used for similar problems and a wide range of inputs What must occur to combat the fact that many different algorithms can solve the same problem? - Answer Algorithms must be compared too determine which is most suitable by looking at the best and worst case scenarios for both types of complexity What are the two complexities algorithms differ in? - Answer Algorithms differ in:

  • Execution time
  • Execution space What do space and time complexity together make up? - Answer An algorithm's efficiency is made up of space and time complexity Define an algorithm's efficiency - Answer An algorithm's efficiency is a reflection on the amount of CPU time or memory space an algorithm require to execute What can the choice of algorithm depend on? - Answer The size of the data set used

Which greek letter denotes average case? - Answer Theta: Θ( ) Which letter denotes worst case? - Answer Big O: O( ) What are the 6 classes of complexity from most efficient(slowest growing) to least efficient (fastest growing) - Answer - Constant

  • Logarithmic
  • Linear
  • Linearithmic
  • Polynomial
  • Exponential What is the Big O notation for constant complexity? - Answer O(1) What is the Big O notation for logarithmic complexity? - Answer O(log n) What is the big O notation for Linear complexity? - Answer O(n) What is the big O notation for linearithmic complexity? - Answer O(n log n)

What is the big O notation for polynomial complexity? - Answer O(n^k) [where k is a constant greater or equal to 0] What is the Big O notation for exponential complexity? - Answer O(k^n) [where K is a constant greater than 1] What can Big O can examine? - Answer Big O can examine both space (RAM) and time (CPU execution time) complexities What is constant complexity and give an example? - Answer Constant complexity is where the complexity remains constant regardless of data set size and is the most efficient. Used for simple statements (no loops) and can encompass tasks such as pushing/popping from stacks) Gives a horizontal line on a time/data set graphq What is logarithmic complexity and give an example? - Answer Logarithmic complexity involves the rate of complexity increase decreasing as the data set increases and has a good efficiency as very scalable Can be seen in divide and conquer techniques such as binary search (quick and merge sort are divide and conquer but are linearithmic) Give a log graph