Professional Documents
Culture Documents
EEI Escuela de Ingeniería Industrial de Vigo: Informática para La Ingeniería 24/6/2015 Group C
EEI Escuela de Ingeniería Industrial de Vigo: Informática para La Ingeniería 24/6/2015 Group C
EEI Escuela de Ingeniería Industrial de Vigo: Informática para La Ingeniería 24/6/2015 Group C
7. Given the following program, what is shown on the screen after running it?
Module Module1 ANSWERS:
Sub Perimeter(ByVal side1 As Double, ByVal A. 8
side2 As Double, ByRef peri As Double)
B. 4
peri = 2 * side1 + 2 * side2 + peri
C. 102
End Sub
Sub Main() D. 12
Dim peri As Double E. None of the above
Perimeter(2, 3, peri)
Perimeter(3, 1, peri)
MsgBox(Peri)
End Sub
End Module
8. Given the following code “Do while m<>5… Loop”. To convert it to “ Do until ….. Loop”. What condition must we put after the “until”?
A. The condition is m=5
B. The condition is m>=5
C. The condition is m<=5
D. The condition is the same, that is, m<>5
E. None of the above
9. Given the following code “Do….Loop while m>5 AND sum=75”. To convert it to “Do ….. Loop until”. What condition must we put after the
“until”?
A. The condition is m=5 OR sum < 75
B. The condition is m>=5 AND sum=75
C. The condition is m<=5 XOR sum <> 75
D. The condition is the same, that is, m>5 AND sum=75
E. None of the above
10. Which of the following statements is correct?
A. A computer’s system bus is composed of: Address Bus, Central Bus and Control Bus
B. The processor may only perform comparison operations.
C. The data required for a program to run, must be in RAM
D. A computer’s system bus is composed of: Data Bus, Control Bus and Direct Bus
E. None of the above
Exercise 1 (1.5 points).- Write the code of a function that receives the following parameters:
• A vector of Integers.
• Two integer values that correspond to positions in the vector and that must be checked to validate that they
are correct.
that returns a String indicating:
• That the position values are incorrect.
• That the vector’s minimum value is found within the two positions.
• That the vector’s minimum value is not within the two positions.
Criteria: Function header (0.25). Declaring local variables (0.15). Checking position values (0.2). Determining the minimum value and its position
(0.5). Determining the response (0.3). Returning the result (0.1)
Exercise 2 (3 points).- A sequential file called “PresTemp” is located on “F” and has values that correspond to:
• Day, month, year and hour of type Byte. For the year, only the last two digits are used.
• Temperature and pressure of type Single.
This file contains data for the first 6 months of the year 2014, with values captured every 3 hours, so the data set is
stored 8 times a day. Write a program code that presents a menu with 3 options:
1.- Asks for a day and a month and shows the average temperature and pressure for that day/month. This
option must be implement in the “Main” code.
2.- Asks for a day, checks that it is valid and loads all the temperature data for that month in a vector with as
many positions as days in that month, multiplied by the number of reading that are taken each day. Once the
vector is loaded with data, use Sub to calculate the maximum, minimum and average temperature for that
month.
3.- Exit, which will show a message indicating that the program is finishing.
Any non-valid option must show an error message and return to the menu. The program may only be
terminated with the exit option (3).
Criteria: Variable and type definitions (0.3). Menu (0.5). Option 1 data request (0.2). Data validation for option 1 (0.3). Rest of option 1 (0.3).
Option 2 data request (0.1). Data validation for option 2 (0.15). Temperature vector redimensioning (0.15). Loading values in the vector (0.25).
Sub header (0.2). Sub code (0.35). Exit message (0.1). Error message (0.1).
Exercise 3 (2.5 points).- Define a structure that allows loading the data stored in the file in the previous exercise for
the months of January and May. Write the code that allows loading the data from the file into the structure. Once
the data is in memory, write the code needed to visualize the highest temperature of the first week of May.
Criteria: Structure definition (0.3). Variable definition (0.3). Definition of the place where the data read from the file will be stored (0.2). Find the
month (0.3). Open the file (0.15). Close the file (0.05). Load the structure (0.6). Show the highest temperature of the first week of May (0.6).