St Brendan’s as computer Science Summer task Summer 2016 St Brendan’s Computer Science Summer task



Download 1.82 Mb.
Page10/10
Date28.05.2018
Size1.82 Mb.
#51383
1   2   3   4   5   6   7   8   9   10

What you need to do

TASK A: Modify the program to calculate the change for a payment of a random bill (up to £100). An example is shown here.
Test: Test your program with an appropriate payment for your random bill.

Evidence that you need to provide

Include the following in your Electronic Answer Document.


Your completed PROGRAM SOURCE CODE. (3 marks)
SCREEN CAPTURE for Test (1 mark)


1 0



1 1



Question 5a

Create a class SwapUsingTeacup class with the code below:





What you need to do

Modify the above program to swap the values held in variables x and y by making use of the variable temp (do not just print other way round). The variable temp used in the swap is sometimes called a teacup. An example output is shown here.


Test: Test your program with the initial values
3 and 7 in x and y

Evidence that you need to provide

Include the following in your Electronic Answer Document.


Your completed PROGRAM SOURCE CODE. (2 marks)
SCREEN CAPTURE for Test (1 mark)


1 2



1 3


Question 5b

Create a class SwapWithoutTeacup class with the code below:





What you need to do

Modify the program to swap the values held in variables x and y by only making use of variables x and y (and not creating/using any other variables). An example output is shown here.



Test: Test your program with the initial values 11 and -4 in x and y

Evidence that you need to provide

Include the following in your Electronic Answer Document.


Your completed PROGRAM SOURCE CODE. (2 marks)
SCREEN CAPTURE for Test (1 mark)


1 4



1 5

Question 6 a (review traces on page 5 and 6 of this booklet before trying this question)


input a and b

if a > b then

output a – b

else


output b – a

end if
Trace the pseudocode of an algorithm.

Consider the pseudocode shown in the box alongside:.
What you need to do

Complete the trace below with input values: a is 2 and b is 7.

Copy your answers to the Electronic Answer Document (EAD)

1 6

a

b

output

2

7














(1 mark)
Fill in the trace below with a input as 8 and b as 3 and copy to your EAD


a

b

output

8

3
















1 7



(1 mark)

1 8
State the purpose of this algorithm? (1 mark)


input n

set s to 0

for x is 1 to n

if (x MOD 3 ≠ 0)

s ← s + x

end if


end for loop

output s
Question 6 b

Trace the pseudocode of an algorithm.

Consider the pseudocode shown in the box alongside:.


What you need to do

Complete the trace below with input value: n is 4.



Copy your answers to the Electronic Answer Document (EAD)


n

x

s

output

4




0







1












































1 9

(2 marks)
Fill in the trace below with a input value of n as 8 and copy to your EAD


n

x

s

output

8




0







1




























































































2 0

(2 marks)


2 1
State the purpose of this algorithm? (1 mark)
Note: MOD calculates the remainder (what is left) from integer division. For example

17 MOD 5 is 2

You may want to code these to check your answers (but you are not required to do so).

Theory work


Set aside at least five hours to view the lecture and work through the tutorial chapters below.
Listen to MIT introductory lecture, Lec 1 | MIT 6.00 Introduction to Computer Science and Programming, Fall 2008: http://www.youtube.com/watch?v=k6U-i4gXkLM&feature=related (54 mins, but skip minutes: 0 – 4.35 and 7.15 – 16.15). Do not worry if you find it difficult to follow in places and note the programming language introduced briefly is Python not Java but it is still a good introduction to what computing is about and relevant to our course. Then answer question 7 below:
Read through http://chortle.ccsu.edu/java5/index.html chapters 1 to 4. Try the quizzes and flashcards. Then work through the rest of the questions below.

Note Chortle does NOT use binary prefix so you need a little extra research for question 10.


Type your answers to the exercises below in your Electronic Answer Document.

You must save this document at regular intervals.



Question 7


2 2

James knows he needs to find the shortest route from Bath to Milton Keynes. Angela knows Dijkstra’s algorithm/method for finding the shortest path between any two locations. State and explain which person has imperative knowledge and which

person has declarative knowledge in this situation. (1 mark)




2 3

Two students want to sum up the integer variables x and y using Java.

Freda writes int z = x + y and forgets to place a semicolon at the end of the statement

George writes int z = x – y; and has wrongly put a minus instead of a plus. Both have made errors. State and explain who has made a syntax error and who has made a semantic error

(1 mark)


2 4

How many primitives did Turing use to program anything that can be programmed? (1 mark)
Question 8 (based on Chortle Chapter 1)


2 5

Explain what software refers to for a computer system (1 mark)


2 6

Explain what bus refers to for a computer system (1 mark)


2 7

Main Memory (RAM) is volatile but Secondary Memory (also called secondary
storage or auxiliary storage) is not. Explain what volatile means. (1 mark)



2 8

Where are programs and data kept for long-term storage (when computer is
switched off)? (1 mark)


2 9

Where is a program and its data kept whilst the program runs (from where
small chunks are then fetched into the processor to be executed)? (1 mark)
Question 9 (based on Chortle Chapter 2)

3 0
Explain what bit stands for and what it means. (1 mark)


3 1

What does one Hertz mean? (1 mark)



Question 10 (based on Chortle Chapter 3 – and research on binary prefix)

For this question also investigate binary prefix as defined by the US National Institute of Standards and Technology and in particular the meaning of kibibyte, mebibyte and gibibyte . NOTE: Chortle does NOT cover this – so look up each binary prefix in Wikipedia (for example https://en.wikipedia.org/wiki/Kibibyte).




3 2

How many bits are there in one byte? (1 mark)


3 3

What are 220 bytes and 230 bytes (using binary prefix) called respectively? (1 mark)




3 4

A particular digital image is 1024 rows by 1024 columns, and each location (pixel) is represented by 24 bits. How many mebibytes are needed to store this image? (1 mark)




3 5

How many bytes can a 64 bit processor read from (or write to) memory at one time? (1 mark)



Question 11 (based on Chortle Chapter 4)


3 6

Is Java a high or low level programming language? (1 mark)


3 7

Software X is used to translate the whole source code of a high level language program and saves it to a binary (machine code) file that can then be run. Which type of translator is software X - a compiler or an interpreter? (1 mark)


End of questions
Please complete the feedback survey at the end of the EAD
Remember to submit the completed EAD – see EAD for details

Optional extras - the future?

  • Ubiquitous computing: Youtube (BBC4) Michio Kaku - The Intelligence Revolution

  • CS50 introduction Harvard http://cs50.tv/2013/fall/lectures/0/w/

  • Jobs: TED talk: Andrew Mcafee - future jobs




jaz last edit: 2016 6 20 page of 15


Download 1.82 Mb.

Share with your friends:
1   2   3   4   5   6   7   8   9   10




The database is protected by copyright ©ininet.org 2024
send message

    Main page