• No results found

CPEN 101-2016-2017 Exam Questions (1).docx

N/A
N/A
Protected

Academic year: 2020

Share "CPEN 101-2016-2017 Exam Questions (1).docx"

Copied!
5
0
0

Loading.... (view fulltext now)

Full text

(1)

UNIVERSITY OF GHANA (All rights reserved)

SCHOOL OF ENGINEERING SCIENCES BACHELOR OF SCIENCE IN ENGINEERING

LEVELS 200/300 FIRST SEMESTER EXAMINATIONS, 2016/2017 CPEN 101 ENGINEERING COMPUTATIONAL TOOLS (2 Credits) INSTRUCTIONS:

ANSWER FOUR QUESTIONS IN ALL

SECTION A IS COMPULSORY AND SHOULD BE ANSWERED IN THE ANSWER BOOKLET

SELECT THREE OTHER QUESTIONS FROM SECTION B

FOR SECTION B, CREATE ONE FOLDER AND PUT ALL YOUR FILES IN THIS FOLDER. SAVE THE FOLDER ON THE COMPUTER DESKTOP USING YOUR ID OR NAME AS THE NAME OF THE FOLDER

TIME ALLOWED:TWO (2) HOURS

SECTION A [40 MARKS]

ANSWER ALL QUESTIONS IN THIS SECTION QUESTION ONE

A) Answer each question in this section with a True (T) or False (F) Each question in part A) carries 1 mark.

1. M-files are used in MATLAB when the problem is more involving than the simple ones

we normally solve interactively.

2. The mathematical function cos2x is equivalent to (cos x) ^ 2 in MATLAB.

3. You execute a MATLAB script file at the command-line prompt by typing its name without the extension .m.

4. For a MATLAB M-file function, the keyword function must always be in upper case letters.

5. In MATLAB, text pre-pended by the % sign is a comment.

(2)

7. To call a MATLAB M-file function, type its name at the prompt and supply its arguments if any.

8. If a MATLAB M-file function has two or more outputs, it is always necessary to enclose them in square brackets during the function definition.

9. Array multiplication and division in MATLAB are respectively represented by .* and ./. 10. MATLAB is a contraction of the two words MATRIX LABORATORY.

11. Application software is the reason why you would spend money to buy a computer. 12. For every computer, the RAM is the main memory whilst the hard disk is the primary

storage area.

13. Microsoft Office 365, Windows Media Player, and Adobe Acrobat Reader are examples of System software.

14. Windows 10, UNIX, and Mac OS X are examples of computer Application software. 15. In terms of age, Windows Vista is the predecessor of Windows 7 much as Windows 7 is

also the predecessor of Window 8.

16. The CPU is classified as the brain of a computer because it is made up of the ALU and control unit.

17. Open-source software is a free to all software for which the source-code is distributed and may be used or altered to suit ones needs.

18. A browser is specially-crafted software used to access the Internet.

19. A translator or compiler converts high-level language into a low-level language for the computer to understand.

20. A computer’s binary circuit can only process machine language code and nothing else. 21. A computer with a 4 GB RAM capacity is better than one with a 5 GB RAM all things

being equal.

22. The Operating System of a computer manages all hardware and software tasks.

23. The Application software can be defined as programs that help users with certain tasks. 24. MS Excel is an electronic spreadsheet software just as Lotus 1-2-3.

25. MS Excel is always a part of any release of Microsoft Office Suite.

26. By default, if an MS Excel Workbook is opened in MS Office 2010, it displays 3 worksheets labeled as Sheet 1, Sheet 2, and Sheet 3.

27. The error message # VALUE in MS Excel stands for “not a value.”

28. The computer power supply does not actually supply power to the computer; but rather converts standard household AC current into DC current needed by the PC.

29. A port is a generic term for any connector on the back or front of a PC’s system unit. 30. The relation cos x – ln x is written COS (X) –LOG(X) using MS Excel syntax.

B)

i) An operating system such as MS Windows 7 is classified as the main software of a computer. Explain why this is so. [2 marks]

ii) Rearrange each of the software types in the table below as either a system software

(3)

[6 mark]

iii) Explain briefly why MATLAB is classified as a high-level programming language.

[2 marks]

SECTION B [60 MARKS]

ANSWER THREE QUESTIONS FROM THIS SECTION Q2. The Body Mass Index, or BMI, for a person is defined using US units as

BMI = 703 *

weight

height

2

where the weight is in pounds and the height is in total inches. Write a MATLAB function

called findbmi that would receive the weight and the height as input arguments and would

return the BMI. Use the if-elseif-else structure to implement the following conditions in your program:

 If BMI is less than 18.5, display ‘you are underweight’;

 If BMI is between 18.5 to 24.9 inclusive, display ‘you are healthy’;  If BMI is between 25 to 29.9 inclusive, display ‘you are overweight’; and  If BMI is greater than 30, display ‘you are obese’.

Test your program as below. For example, to find the BMI for a person who weighs 170 lbs and 5’11’ (71 inches tall), here are two examples of function calls:

>> findbmi(170, 71)

ans = 23.7076

>> bmi = findbmi(170, 71)

bmi = 23.7076 [20 marks]

System software Application software

Microsoft Office 365 Linux

BIOS MS Excel

(4)

Q3. Neglecting air resistance, the horizontal range of a projectile fired into the air at angle θ degrees is given by the formula

R =

2

V

2

sin

Θ

cos

Θ

g

.

Create a worksheet that computes R for a selected initial velocity V and firing angle θ. Use g = 9.8 meters/sec2. Use MS Excel’s built-in functions to convert degrees to radians by using the RADIANS () function and then determine R for 10 different values of θ and V as listed in Table 2. Name the worksheet as projectile range.

In your MS Excel worksheet, put g in cell B1; arrange the angles in degrees in cells A3 to A12 and those in radians in cells B3 to B12 from the lowest to the largest and the velocities in cells C3 to C12. Hence calculate the values of R in cells D3 to D12.

[20 marks]

Table 2: Table listing values of θ and V to be used in finding R

Θ (degrees) V (meters/sec)

25 150

40 120

55 105

70 69

85 150

100 60

115 90

130 200

145 250

160 180

Q4. a) Write a MATLAB script called sincplot.m to plot the function

y =

sin

x

x

in the range pi/100 to 10pi at intervals of pi/100.

Show grids on your plot using the grid on command. Also, label the x-axis, y-axis, title

of the graph and also use the gtext function to write the equation of the function that you

have plotted on the curve. [10 marks]

(5)

Table 3 gives data on the amount of force used to push a block through the given distance over five segments of a certain path. The force varies because of the differing friction properties of the surface.

Table 3: Table showing force and distance values

1 2 3 4 5

Force(N) 400 550 700 500 600 Distance(m) 2 0.5 0.75 1.5 3

Create a MATLAB script file called work_done.m that uses the data in Table 3 to compute:

i. the work done on each segment of the path; and ii. the total work done over the entire path.

[10 marks]

Q5. a) The atomic weight is the weight of an atom of a chemical element. For example, the atomic weight of oxygen is 15.9994 and the atomic weight of hydrogen is 1.0079. Write a MATLAB script to calculate the molecular weight of hydrogen peroxide, which consists of two atoms of hydrogen and two atoms of oxygen. Include comments in the script. [10 marks] b) The volume V of a sphere depends on its radius r as follows:

V= 4πr3/3

Write a script called volsphere.m to compute the volumes of a sphere given

the radius in meters, for 1 ≤ r ≤ 2, in increments of 0.1 using a for loop. Display the radii and volumes in a table and label each column and format the table to show the

volume to 3 d.pl, and the radius to 1 d.pl.

[Hint: use disp and fprintf to display the volumes and radii in a table format as follows: disp (‘radius volume’)

fprintf(‘%0.1f %0.3f\n’, radius, volume)

The command disp (‘radius volume’) should come before the for loop whilst fprintf(‘%0.1f %0.3f\n’, radius, volume) should be within the for loop]. [10 marks]

Figure

Table 3 gives data on the amount of force used to push a block through the given distance over five segments of a certain path

References

Related documents

Windows 7 Professional Windows 7 Ultimate Windows Vista® Home Basic Windows Vista® Home Premium Windows Vista® Business Windows Vista® Enterprise Windows Vista® Ultimate Windows®

Middleware 4.1.5 is supported on the following operating systems: Microsoft • Windows Vista • Windows 7 • Windows 8 • Windows 8.1 • Windows 10 Apple.. • Mac OSX 10.8

Middleware 4.1.3 is supported on the following operating systems: Microsoft • Windows Vista • Windows 7 • Windows 8 • Windows 8.1 Apple.. • Mac OSX 10.8 (Mountain Lion) •

Middleware 4.1.14 is supported on the following operating systems: Microsoft • Windows Vista • Windows 7 • Windows 8 • Windows 8.1 • Windows 10 Windows installer.. • Fixed

Where your Windows Login User Account does not have Administrator or Power User access right, you will need to start the software using ‘Run as administrator’ option.. To start

You should notice that the files and folders are displayed in a list, with information about file size, file type, and modified date, as shown in Figures 2.13a and 2.13b.. If

Windows Vista Enterprise Windows Vista Ultimate Windows 7 Professional Windows 7 Ultimate Windows 7 Enterprise Windows 8 Windows 8 Pro Windows 8 Enterprise Windows 8.1 Windows 8.1

Share Computer Audio with Attendees (Windows Vista or newer) In Windows Vista and newer Windows operating systems (including Windows 7, Windows 8 and Window 10), the presenter in