Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
[PRGA1001 Programming I]
Programme:
Duration:
[3 Hours]
Instructions to Candidates
[Please amend as required, and ensure that instructions are accurate and clear]
1. This paper has _6_ pages and _8_questions.
2. You are required to answer all questions
The question paper is to be returned with the Answer script.
Key Examination Protocol
1. Students please note that academic dishonesty (or cheating) includes but is not limited to
plagiarism, collusion, falsification, replication, taking unauthorised notes or devices into an
examination, obtaining an unauthorised copy of the examination paper, communicating or
trying to communicate with another candidate during the examination, and being a party to
impersonation in relation to an examination.
2. The above mentioned and any other actions which compromise the integrity of the academic
evaluation process will be fully investigated and addressed in accordance with UTTs
academic regulations.
3. Please be reminded that speaking without the Invigilators permission is NOT allowed.
Page 1
Question
mark
/ 7
10
10
15
10
----------------------------------------------------------------TOTAL
75
Page 2
QUESTION 1 (7 marks)
Write a program which reads in a number from the user which represents a temperature
in degrees Fahrenheit. It then calculates and outputs the equivalent temperature in
degrees Celsius using the formula:
C = (F - 32) x 5/9
QUESTION 2 (6 marks)
What would be the output from the following program:
#include <stdio.h>
void main()
{
int x = -2, a = 3;
while (x <= 16)
{
a += 5;
x += 3;
}
printf ("a = %d \n", a);
}
Page 3
x1
x3
x5
x7
x9
Sin ( x)
1!
3!
5!
7!
9!
Your job is to write a C program to determine the sine of an angle. The input consists of
the value of the angle in degrees and the output consists of the sine of the angle. Apply
the Taylor expansion to 20 terms in order to determine the sine of the angle.
Page 4
Page 5
Indicate all the steps that you would use in SciLAB in order to determine and display the
following integral
(
( )
[ ( )
( )]
[ ( )
( )]
where h = b a
QUESTION 7 (9 MARKS)
Write a SciLAB script to multiply the following polynomials:
y = 3x3 + 7x2 + 18
y = 8x2 - 3
QUESTION 8 (8 MARKS)
This question deals with the development of a SciLab script to evaluate a polynomial at
a specific point. The polynomial to be evaluated is:
y = 4x4 - 3x3 + 2x - 8
Your script must allow the use to enter the value of x at which the polynomial is to be
evaluated, and must display the required value.
END OF PAPER
The University of Trinidad and Tobago
December 2012 Final Examinations
(PRGA1001)
Page 6