Computer Science Exam Questions Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Describe what happens during Syntax analysis, when code is compiled

A
  • The given input is checked for the confirmation of rules and structure of the formal grammar
  • It analyses the syntactical structure and checks if the given input is in the correct syntax of the programming language or not
  • If an error is found, A syntax error is reported
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

A high-level language states what is required but not how to do it. The statements do not have to be in a specific order.

Identify the type of language described

State one typical use for this type of language and give one reason for your choice

A

Identify the type of language described
Declarative

State one typical use for this type of language and give one reason for your choice
Medical diagnosis/expert systems - Reason
A potential reason could be for a medical diagnosis is that it is just reporting on what the symptoms are, not how to solve them

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Low-level languages have features which include opcodes and mnemonics

Explain the term opcode

Explain the term mnemonics, giving an example

A

Explain the term opcode
The opcode is the instruction that is executed by the CPU

Explain the term mnemonics, giving an example
mnemonics are pieces of code to help humans understand what binary instructions represent, so instead of outputting the binary for instruction, let’s say load, it would instead output LDA

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

A professional photographer, Sarah, takes and edits photographs for magazines

Sarah carries around a digital camera and laptop to use on shoots. She keeps extra peripherals in her office that she can use when editing and finalising photographs.

The laptop has both system software and application software

Define the term ‘software’.

Explain why Sarah needs both system and application software

Sarah needs a computerised system in which to catalogue her photographs.
Give two reasons why you would not recommend that Sarah has this software custom written

A

Define the term ‘software’.
Software is any program or operating system inside of a computer

Explain why Sarah needs both system and application software
Needs software for both systems and applications because the software instructs them how to run

Give two reasons why you would not recommend that Sarah has this software custom written

  1. Expensive
  2. Easy to get off the internet
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

A software development team is writing a word game

The team is using Rapid application development

Describe the Rapid Application Process

A

Describe the Rapid Application Process
• Form of agile software
• Prioritizes releases and iterations
• Emphasizes the use of software and user feedback over strict planning and requirements recording
• starts with analysis and quick design, then goes through a loop of building, demonstrating and retrieving data, once it has been satisfactorily built, it is put into testing and implementation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Open-source software has grown in popularity over the last few decades

State the name of a type of translator software other than a compiler or interpreter

A

State the name of a type of translator software other than a compiler or interpreter
Assembler

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

A software company decides to release a duplicate file finder which it has named “De-Duplicator, Duplicate files are files that are the same (bit for bit identical). Space s often wasted on computers by having multiple versions of the same file. Duplicate file finders are programs that find and identify duplicate files on a hard drive so that they can be removed.

The software team that produces De-Duplicator decides to make a new version that can detect duplicated images that the previous version could not. The software team must decide which methodology they will use for the project. Some members of the team suggest extreme programming whilst others would prefer to use the waterfall lifecycle

Discuss the two methodologies and justify which you would recommend

A

Discuss the two methodologies and justify which you would recommend
Advantages of waterfall lifecycle
• Allows for strict schedules to be made for different parts of the program to be made, allows the programmers to know how close they are to completion
• Easy to manage due to the rigidity of the model
• Easy to arrange tasks
• Cleary defined stages

Disadvantages of waterfall lifecycle
• No working prototype is made until late into the cycle
• Not good for complex problems or object-orientated problems
• Not good for a changing target
• Integration is done as the final step, so any technological or business bottlenecks can’t be identified until it is finished

Advantages of extreme programming
• Saves companies cost and time
• reduces risks regarding programming or project failure through pair programming
• starts with simple code that works and gets improved upon at any time
• Constant feedback can be given, as integration can happen early on

Disadvantages of Extreme programming
• Customers must participate in the process since their feedback is constantly needed
• Can be a large time investment
• Can be expensive
• Requires version management
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Liquid Lizards is a computer game in which players get to fire lizards from a cannon to knock down walls. Players get to pick different types of lizards, each with qualities and special powers

The game is coded using an object-oriented language. Below is the code for the lizard class

(https://cdn.discordapp.com/attachments/860926934221062177/971376741551595550/IMG_6218.jpg)

This game uses a 2D graphics library. Explain why a linker would need to be used after compilation

A

This game uses a 2D graphics library. Explain why a linker would need to be used after compilation
• To like the 2D graphics library to the code a linker is needed
• without the code the 2D graphics library would not know what to do
• 2D graphics library would not need to be installed if a linker is present

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

The program, as shown in Fig.2 below, is written in assembly code using the Little Man Computer instruction set. It is supposed to take in two numbers and output the higher

(https://cdn.discordapp.com/attachments/860926934221062177/971377830086709298/IMG_6219.jpg)

State what type of translator program would be needed to convert the code above into machine code.

A

State what type of translator program would be needed to convert the code above into machine code.

Assembler

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

A gaming company decides to release a new video games console. The console will use a modified version of an operating system called Linux

Linux is open-source

Explain how Linux being open-source would benefit the games company

A

Explain how Linux being open-source would benefit the games company
• allow for already existing code to make games cheaper
• don’t need to pay for propriety operating systems
• Company just needs to make adjustments

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

The following is a program written using the Little Man Computer instruction set.

(https://cdn.discordapp.com/attachments/860926934221062177/971378915203506226/IMG_6220.jpg)

Identify the type of memory addressing the program uses.

Describe the difference between the STA and LDA instructions

A

Identify the type of memory addressing the program uses
Direct Addressing

Describe the difference between the STA and LDA instructions
LDA is used to load data from specific locations

STA is used to store data currently in the accumulator

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

A software development company is building an operating system for a mobile phone that is in the process of being designed.

The developers follow the waterfall Cycle.

List three stages of the waterfall Cycle

Justify why the waterfall lifecycle is suited to the development of the operating system

Give one disadvantage to using the waterfall lifecycle to develop the operating system

A

List three stages of the waterfall Cycle

  1. Requirements
  2. Design
  3. Implementation

Justify why the waterfall lifecycle is suited to the development of the operating system
• Suits large scale projects, like an Operating System
• Suits projects which have requirements which are unlikely to change, Operating systems requirements are unlikely to change

Give one disadvantage to using the waterfall lifecycle to develop the operating system
• Lifecycle process cannot adapt to change

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

State three benefits of using library routines when a program is written

A

State three benefits of using library routines when a program is written

  1. Can be called from other programs
  2. Makes writing programs faster
  3. May already be debugged
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Place ticks in the table to show which statements apply to the modes of addressing shown for a low-level instruction in the form ADD123.

Caz is studying low-level languages. She has lost some of her notes on modes of address but has the following part of an example

Address in Current Instruction Register (CIR) is 3
Address to be used is 3+11 = 14

Name and explain two modes of addressing that this example could show

A

Place ticks in the table to show which statements apply to the modes of addressing shown for a low-level instruction in the form ADD123.

(https://cdn.discordapp.com/attachments/860926934221062177/971381243780431912/IMG_6221.jpg)

Name and explain two modes of addressing that this example could show

Relative addressing uses offset 3 to calculate the read address from the base address

Indexed addressing modifies address 3 by adding number 11 from index register

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Second Paper

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

A processor contains several special registers

Name and describe three buses used to convey information between the special registers.

A

Name and describe three buses used to convey information between the special registers.

  1. Data Bus - transfers data between data store and registers
  2. Address Bus - transfers the location of the data needed
  3. Control Bus - Transfers what should be done to the data
17
Q

Computer software is used in geography lessons to teach students about weather systems.
Describe how the following forms of output will be used by the software
1. Animation
2. Interactive Presentation

A

Describe how the following forms of output will be used by the software

  1. Animation - Used to illustrate weather systems which would otherwise not be possible, done through pictures and video
  2. Interactive Presentation - using inputs from users when answering questions about one stage and if the responsive is correct would move onto the next stage
18
Q

The office workers of a large company each use a stand-alone computer.

The finance manager needs to work on some files at home and also to assess new software for use in the finance department

State three different storage devices that the finance manager would use and describe what each device would be used for

A

State three different storage devices that the finance manager would use and describe what each device would be used for

  1. Separate Hard Disk - transfer files and software from work and his home
  2. USB Drive - transfer of files from work to home, software to large would need a separate hard disk though
  3. Virtual Storage Space - Access files available in the department from anywhere without the need for a physical device.
19
Q

Interactive Care Units in hospitals are for patients in need of round the clock monitoring and support. Computerised systems can be used to monitor patients’ vital signs (temperature, heart rate, blood pressure and breathing). They can then alert medical professionals to any significant changes.

These systems are usually run on an embedded, real-time, operating system.

i. State what is meant by the term real-time
ii. Explain why a real-time operating system would be suitable for Intensive Care Units

A

i. State what is meant by the term real-time
They have a guaranteed frame rate

ii. Explain why a real-time operating system would be suitable for Intensive Care Units
Stops patients from not receiving treatment in time stop any delays in response

20
Q

The computers in a car showroom are connected in a network with all data being held on a central server. The computers are used by salesmen, but can also be used by customers to watch videos of the cars that are on offer.

What is meant by a protocol?

A

What is meant by a protocol?

A protocol is a series of rules followed by computers that govern data transmission

21
Q

TCP/IP uses packet switching.

Explain what is meant by packet switching.

A

Explain what is meant by packet switching.
Data is split into packets which are labelled, including the address & order each packet is set on the most convenient/avoidable route meaning they arrive in a different order, and once they all arrive they are re-ordered.

22
Q

Explain two advantages of using packet switching instead of circuit switching to send a messaage between two computers on a network

A

Explain two advantages of using packet switching instead of circuit switching to send a messaage between two computers on a network

  1. safer from interception as it is impossible to intercept all packets de to the many different routes they take
  2. Very efficient use of network as each channel only used for short time/does not tie up a part of the network
23
Q

A computer represents floating-point binary numbers using a 6-bit mantissa and a 4-bit exponent, both using two’s complement

Add the following three numbers together and give the answer in the format described. You must show your working
010100 0010
011000 0001
100010 0010

A

0.5 + 0.125 = 0.625e2 = 0.390625
010100 = 0.625
0010 = e2

0.5 + 0.25 = 0.75e1 = 0.75
011000 = 0.75
0001 = e1

-1 + 0.0625 = -0.9375e2 = 0.87890625
100010 = -0.9375
0010 = e2

0.390625 + 0.75 + 0.87890625 = 2.01953125 = 1.000000101 * 2^1

24
Q

Below are extracts from the ASCII and EBCDIC character sets.

(https://cdn.discordapp.com/attachments/860926934221062177/971408977420234773/IMG_6222.jpg)

Explain, referring to ASCII and EBCDIC, what would happen if computers were to use different character sets when communicating.

A

Explain, referring to ASCII and EBCDIC, what would happen if computers were to use different character sets when communicating.
Characters using ASCII would be interpreted as different characters by EBCDIC, and will be incomprehensible

25
Q

An XOR gate is shown below. Complete the truth table for XOR.

(https://cdn.discordapp.com/attachments/860926934221062177/971409764414259210/IMG_6223.jpg)

A

Complete the truth table for XOR.

https://cdn.discordapp.com/attachments/860926934221062177/971409861671809114/IMG_6224.jpg

26
Q

An Electronics engineer needs a circuit with the following logic.

(A/\B) v (¬A/\B) v (¬C/\¬D)

Complete and use the Karnaugh map below to simplify the expression above

A

Complete and use the Karnaugh map below to simplify the expression above

(https://cdn.discordapp.com/attachments/860926934221062177/971410806363287602/IMG_6225.jpg)

Simplified Expression = B v (¬C /\ ¬D)

27
Q

A company is writing a syntax checker to be used when writing HTML

The first thing the program does is add every tag in a piece of text to the data structure “dataStructureA”

The string “X” is added to “dataStructureA” with the code “dataStructureA. add(“X”)

The string type variable htmlCode holds the code that is to have its tags added.

if htmlCode where to contain:
My Page

dataStructureA would have the following contents:

(https://cdn.discordapp.com/attachments/860926934221062177/971422807512727592/IMG_6226.jpg)

Write the code to fill dataStructureA with the tags in htmlCode.

A
tagStartPos = 0
insideTag = false
i = 0
while i < htmlCode.length
       if htmlCode.substring(i,l) == "
28
Q

Every bank account has an account number and a sort code. The sort code identifies the back branch (location of the bank) with which the account is held and the account number uniquely identifies the bank account. An extract from a bank’s database is shown below

(https: //cdn.discordapp.com/attachments/860926934221062177/971424619313635408/IMG_6227.jpg)
(a) state why the table above is not in the Third Normal Form.
(b) Explain how the database could be put into Third Normal Form.

A

(a) state why the table above is not in the Third Normal Form.
It is not in the third normal form as there is a repeated value in Sort Code & Branch Name

(b) Explain how the database could be put into Third Normal Form.
The database could be put into Third Normal Form by making sure there are no repeated entries, and that each entry is under another thing which it is unique, for instance, As the Acc No, is Unique to the customer, and each customer is given a unique Customer ID, Customer ID would become a primary key, while Forename, Surname and Acc no would become entries underneath it, while as the Sort Code depends on the Branch Name, the Sort Code would become a primary Key, while Branch Name would be an entry underneath it. It would now be in second normal form.

To put it into Third Normal Form, one of the entries which are both Primary Keys would have to become a foreign key for the other, linking them together, to do this, you would split the two groups into three, one group consisting of Customer ID as the Primary Key, with Forename and Surname as the entries below it, Another group consisting of Customer ID and Acc No, with Customer ID being a foreign key for the past Customer ID table and Acc No being a primary key, after this, there would also be a table consisting off Acc No, Sort Code and Branch Name, With Sort code being the primary Key but Acc No being a foreign key to link it to the others

29
Q

The bank needs to ensure the data stored in its database is accurate at all times, including when customers deposit or withdraw funds

Discuss how the bank can ensure the accuracy of its data and the importance of doing so.

A

Discuss how the bank can ensure the accuracy of its data and the importance of doing.

There are a few things the bank needs to do to keep data accurate, these make sure that the data is consistent, isolated, durable, locked when not in use, has referential integrity, have redundancies, accurate in the first place, have security measures to prevent tampering as well as be validated and verified.

making sure the data is consistent means that the transaction should only change the database according got the rules of the database

Making sure the data is isolated means that each transaction shouldn’t affect/overwrite other transactions concurrently being processed

Making sure the data is durable means that once a transaction has been started it remains no matter what happens

what is meant by being locked when not in use is that if one transaction is amending a record, no other transaction should be able to until the first transaction is complete

By having referential integrity, it is meant that changes to data in one table must take into account data in linked tables

Data having redundancies means that if part of a database is lost it can be recoverable elsewhere

By the data being verified and validated, it means that the data should be automatically checked and checks done if the data entered matches the original

30
Q

A 1-dimensional array stores a set of number cards from 0 to 7. An example of this data is shown in Fig 4.1
(https://cdn.discordapp.com/attachments/860926934221062177/971436240127819806/IMG_6229.jpg)

The programmer wants to search for a specific card in the array.

State whether a binary search or a linear search would be the most appropriate method to search for a specific card, and justify your answer.

A

State whether a binary search or a linear search would be the most appropriate method to search for a specific card, and justify your answer.
Search Method: Linear Search
Justification: small and unordered, binary searches are more suited for large, ordered datasets.

31
Q

The array queue shown below is set p to hold a small queue. Assume that there is sufficient storage to hold all necessary additions to the queue.

(https://cdn.discordapp.com/attachments/860926934221062177/971437486402318357/IMG_6230.jpg)

The table below shows variables that are used to maintain the queue:

(https://cdn.discordapp.com/attachments/860926934221062177/971437683807244348/IMG_6231.jpg)

Shown below is an algorithm that is intended to add an item to the queue.

(https: //cdn.discordapp.com/attachments/860926934221062177/971438317973405776/IMG_6232.jpg)
(a) Identify the parameter that is passed to this procedure
(b) Describe the logical decisions that are made
(c) (i) The algorithm contains a logic mistake. Explain what the mistake is
(ii) Rewrite the algorithm to correct the mistake

A

(a) Identify the parameter that is passed to this procedure
Item(1)

(b) Describe the logical decisions that are made
It either sets the queue_full to true or adds the next item to the front

(c) (i) The algorithm contains a logic mistake. Explain what the mistake is
The mistake made is that it adds the object to the wrong area, and should instead be added to the rear of the list

     (ii) Rewrite the algorithm to correct the mistake
if front == max then
    queue_full = true
else
    rear += 1
    queue[rear] = item
end if
32
Q

Variables are used in programming
i. Describe the use of local variables

ii. State two features of global variables that distinguish them from local variables

A

i. Describe the use of local variables
• Used only in specific routines or areas of code
• cab be used as parameters
• data lost at end of the module

ii. State two features of global variables that distinguish them from local variables
1. Can be used throughout the code with the entered value remaining constant
2. announced at the start of code outside any routines or procedures

33
Q

Compare a procedure with a function

A

Compare a procedure with a function

A function returns only one value and can run whenever called, a procedure is a subsection of code

34
Q

A program is needed to plan out the layout of a garden

The program will allow the user to create an image of the garden, for example:
(https://cdn.discordapp.com/attachments/860926934221062177/971453050688532480/IMG_6233.jpg)

(a) The programmer will use abstraction to produce the program interface to represent the garden
(i) Give two different examples of how abstraction has been used to produce the layout of the garden

 (ii) Explain the need for abstraction in the production of this program

 (iii) The user needs to input data into the program to set up their garden layout
       Identify three pieces of data that the user may input into this program
(b) The program is to be built using object-oriented programming.
     All items that can be added to the garden are declared as instances of the class GardenItem.
     The class has the following attributes
 (https://cdn.discordapp.com/attachments/860926934221062177/971453446471446588/IMG_6234.jpg)
     (i) The constructor method sets the attributes to values that are passed as parameters.
         Write pseudocode or program code to declare the class GardenItem and its constructor. All attributes should be 
         private and initialised through the conductor (e.g. daisies = new GardenItem("Flowerbed",2,1) ).
      (ii) The trees in the garden layouts are defined by the class Tree. This class inherits from GardenItem
           The class Tree has the additional attributes: height, sun, and shade.
           If the sun is true then the tree can grow in full sun, if it is false then it cannot
           If shade is true then the tree can grow in full shade, if it is false then it cannot
           The length and width of a tree are the same. Only one value for these measurements is passed to the constructor
           Write an algorithm, using pseudocode or program code, to declare the class Tree. Declare all attributes as private
A

(a) The programmer will use abstraction to produce the program interface to represent the garden
(i) Give two different examples of how abstraction has been used to produce the layout of the garden
1. Key items in the garden have been included, minor items have been ignored
2. removal of unimportant things, or things which are easily inferred to make visualisation easier

 (ii) Explain the need for abstraction in the production of this program
      Abstraction is needed in the creation of this program because: to highlight important details, remove minor details 
      which aren't needed as well as decrease the storage space which the minor details would take up

 (iii) The user needs to input data into the program to set up their garden layout
       Identify three pieces of data that the user may input into this program
       1. Items in garden
       2. Location of items in the garden
       3. Size of items in the garden
(b) The program is to be built using object-oriented programming.
     All items that can be added to the garden are declared as instances of the class GardenItem.
     The class has the following attributes
 (https://cdn.discordapp.com/attachments/860926934221062177/971453446471446588/IMG_6234.jpg)
     (i) The constructor method sets the attributes to values that are passed as parameters.
         Write pseudocode or program code to declare the class GardenItem and its constructor. All attributes should be 
         private and initialised through the conductor (e.g. daisies = new GardenItem("Flowerbed",2,1) ).
class GardenItem
     Private ItemName
     Private length
     Private width
     public procedure new(pItemName, pLength, pWidth)
          ItemName = pItemName
          length = pLength
          width = pWidth
     end procedure
end Class
      (ii) The trees in the garden layouts are defined by the class Tree. This class inherits from GardenItem
           The class Tree has the additional attributes: height, sun, and shade.
           If the sun is true then the tree can grow in full sun, if it is false then it cannot
           If shade is true then the tree can grow in full shade, if it is false then it cannot
           The length and width of a tree are the same. Only one value for these measurements is passed to the constructor
           Write an algorithm, using pseudocode or program code, to declare the class Tree. Declare all attributes as private
35
Q

Livid Lizards is a computer game in which players get to fire lizards from a cannon to knock down walls. Players get to pick different types of lizards, each with qualities and special powers.
The game is coded using an object-oriented language. Below is the code for the lizard class:

(https: //cdn.discordapp.com/attachments/860926934221062177/971481809093267456/IMG_6235.jpg)
(a) Lizard is a class. Describe what is meant by a class
(b) Identify an attribute in the lizard class.
(c) (i) Describe what is meant by the term inheritance
(ii) Explain one way the game’s developers might use inheritance for Livid Lizards.
(d) The game uses a 2D graphics library. Explain why a linker wound needs to be used after compilation

A
(a) Lizard is a class. Describe what is meant by a class
A template defining methods and attributes used to make objects

(b) Identify an attribute in the lizard class.
Speed / mass / size

(c) (i) Describe what is meant by the term inheritance
Inheritance is when a class takes on the methods and attributes of a parent class. The inheriting class may override some of these methods/attributes and may have added extra methods and attributes of its own.
 (ii) Explain one way the game's developers might use inheritance for Livid Lizards. Inheritance could be used for Livid Lizards by having multiple lizards which inherit the methods and attributes of one base lizard, in order to create different types of lizards, which would have different attributes since the base stats of the lizard can be overwritten or modified to suit different lizards

(d) The game uses a 2D graphics library. Explain why a linker wound needs to be used after compilation
A linker would be needed to be used after compilation as without it the 2D graphics library and the main code wouldn’t be able to communicate together, this would mean that the lizards would not have any attributes. Also as the library is not on the computer, after compilation if the linker is present, the 2D graphics library would not need to be downloaded by the user.

36
Q

(a) Two equal (unsigned) integers, shown below, are added together. Calculate the result, showing your working

(00010101 + 00010101)

(b) State which bitwise manipulation on 00010101 would have achieved the same result as the calculation on part (a).
(c) Convert the denary number -52 into an 8-bit binary number using two’s complement
(d) Describe why Two’s complement may be preferable to sign and magnitude.
(e) Using floating-point representation with 4 bits for the exponent and 4 bits for the mantissa, add together the following floating-point binary numbers and write the answer as a normalised floating-point number with a 4-bit mantissa and a 4-bit exponent

0110 0010 and 0100 0011

A

(a) Two equal (unsigned) integers, shown below, are added together. Calculate the result, showing your working

(00010101 + 00010101) = 00101010

(b) State which bitwise manipulation on 00010101 would have achieved the same result as the calculation on part (a).
One shift to the left

(c) Convert the denary number -52 into an 8-bit binary number using two’s complement
(d) Describe why Two’s complement may be preferable to sign and magnitude.
(e) Using floating-point representation with 4 bits for the exponent and 4 bits for the mantissa, add together the following floating-point binary numbers and write the answer as a normalised floating-point number with a 4-bit mantissa and a 4-bit exponent

0110 0010 and 0100 0011