Darren Provine at Rowan University


Introduction to Programming Sample Exam Questions

Going Metric

(This problem tests your knowledge of writing functions.)

A yard is three feet. A foot is 12 inches. A meter is 39.370079 inches.

This program should accept in a distance in yards and return a distance in meters. To make it work, you will need to write a function `YardsToFeet', a function `FeetToInches', and a function `InchesToMeters'.

Example: 1 yard = 0.9144 meters

There is a comment which says `DO NOT CHANGE ANYTHING ABOVE THIS LINE'. Do not change anything above that line.

FORM: frmMetric.frm (Remember to right-click on the link and choose "save as".)


To solve this problem, you have to write three functions. The click event is already written; you have to write the functions which it calls.

The click event first converts the yards to feet, and then converts the feet to inches, finally converting the inches to meters. The functions do the actual computation.

FourCalc

(This problem tests your knowledge of math operations, string handling, and basic click events.)

The form contains the interface for a simple four-function calculator. I should be able to enter a number in box A, a number in box B, and then click any of the four buttons. The result should tell me what operation was run and what the answer was.

Example: If you put 4 in A, and 5 in B, the label lblCalc should say "A + B = ", and the label lblAnswer should say "9".

FORM: download FourCalc.frm (Remember to right-click on the link and choose "save as".)

This form uses a label, not a picture box, for output. In order to set the text in a label, you have to use "foo.Caption =" (for a label named foo) instead of using the "Print" method of a Picture Box. (A label doesn't have a "Print" method.)


(US flag) This page's URI: http://elvis.rowan.edu/~kilroy/class/intro/e1qs/
Last modified: Thursday, 15 February 2007, 12:06:43pm