Вы находитесь на странице: 1из 4

Engineering Programming 100, Semester 1, 2008

CURTIN UNIVERSITY OF TECHNOLOGY


Engineering Foundation Year

Engineering Programming 100, Index: 310207


Mid-semester Test, Semester 1, 2008

Duration: 45 minutes
Total marks: 50 marks

Aids supplied by the University: None


Aids supplied by the Student: None
Calculator: Allowed

THIS IS A CLOSED BOOK TEST

• Mobile phones or any other device capable of communicating information are


prohibited from use during the test.
• Electronic organisers/PDAs or other devices capable of storing text or other
restricted information are prohibited.
• Calculators. If the use of a calculator in the test is allowed, only calculators
specifically approved for use by the Department may be used. The examiner
will check for compliance prior to the commencement of the test.
• Any breaches of policy will be considered cheating and appropriate action will
be taken as per University policy.
• Answer ALL questions in the answer book provided. The test paper has 4
pages. Pages 1-4 contain 14 questions.

1/ State five examples of real life variables that are best represented by integers [1
mark each, 5 marks in total].

2/ State five examples of real life variables that are best represented by floating point
numbers [1 mark each, 5 marks in total].

Page 1 of 4
Engineering Programming 100, Semester 1, 2008

3/ State five examples of real life variables that are best represented by a string [1
mark each, 5 marks in total].

4/ Why would you choose a double precision data type instead of a floating point data
type? [2 marks].

5/ What would be the best type of variable to use to store a number of student marks
in a program [2 marks].

6/ What would be the best type of variable to use to store the height above sea level of
the land given that each value is defined by its (x,y) coordinates [2 marks].

7/ Give the statement(s) to print out a character variable: ans, followed by an integer:
age, and then a floating point number: weight [3 marks].

8/ Give the statement(s) to read in an integer: day followed by a floating point


number: mass from the keyboard [3 marks].

Page 2 of 4
Engineering Programming 100, Semester 1, 2008

9/ What is the result of the following code i.e. what is the value of x [2 marks].
int x;
float y = 5.53;
x = y /2;

10/ What is the value of z given the following variable values and expression [3
marks].
float x = 3.1;
float y = 5.2;
int a = 10;
int b = 20;
float z;

z = x + y/2 – a + b++;

11/ Why is it a good idea to incrementally build the C code for a program starring
with an empty main() [2 marks].

12/ Write the if statement to execute a statement only when the floating point
variable x is between 25.0 and 56.0 inclusive and the value of the integer variable y is
not 0 [4 marks].

13/ Under what circumstances would you use a switch/case statement instead of
if...elseif...else. [2 marks].

Page 3 of 4
Engineering Programming 100, Semester 1, 2008

14/ Write a complete C program to read in two floating point values representing the
external and internal radii of a spherical ball. Compute and output the volume of the
4
material in the ball. The equation for the volume of a sphere is πr 3 [10 marks]
3

END OF TEST

Page 4 of 4

Вам также может понравиться