Docsity

Computer Science Exam - February 18, 2016, Prove d'esame di Computer Graphics

Toggle sidebar
bg1
Computer Sciences – 18/02/2016 – Total time: 2h
SURNAME:
NAME:
D1
STUDENT ID:
TEACHER:
Question 1
Given the numbers n1=01010000 and n2=11110111 represented in S&M, calculate the sum of the values,
eventually indicating if there is overflow.
Question 2
The parallelism of a given memory is 8 bits. Determine the width of an address BUS capable of handle a memory
of 64kB.
Question 3
Highlight what are the main differences between main memory and the mass memory.
pf2

Anteprima parziale del testo

Scarica Computer Science Exam - February 18, 2016 e più Prove d'esame in PDF di Computer Graphics solo su Docsity!

Computer Sciences – 18/02/2016 – Total time: 2h

SURNAME: NAME:

D 1

STUDENT ID:

TEACHER:

Question 1

Given the numbers n1=01010000 and n2=11110111 represented in S&M, calculate the sum of the values, eventually indicating if there is overflow.

Question 2

The parallelism of a given memory is 8 bits. Determine the width of an address BUS capable of handle a memory of 64kB.

Question 3

Highlight what are the main differences between main memory and the mass memory.

Computer Sciences – 18/02/2016 – Total time: 2h

Question 4 (PROGRAMMING) It is required to write a C program to evaluate the opportunity to recover marine archeological finds. The program is able to process a map , which indicates for each position the maximum hydrostatic pressure for a specific ocean area. The map is described by a NN square matrix of positive real numbers between 0 and 1000 that indicate the hydrostatic pressure. The program also processes another file containing the information about the marine archeological finds, indicating the find position in the map, the find volume, and the find weight. The software must be able to identify how many marine archeological finds are recoverable by a submarine without damaging it, considering its resistance to the depth and the maximum weight to allow the submarine to return to the surface with the collected finds.

Write a C program able to process the map of the marine hydrostatic pressure with N=15. The name of the file containing the map is specified as the first argument of the command line. A second file passed as the second argument of the command line contains the types of finds that are identified to be recovered. The finds can be at most 150 and have the following format:

Row and column are two integers indicating the position of the find, and the weight is a real number.

The program shall receive two additional parameters on the command line that are: the maximum pressure that the submarine can tolerate, and the maximum weight that can be accumulated in the compartment to return to the surface.

The program shall:

  1. Determine whether every one of the finds is located in the considered sea area and, if not, display to the video all the finds in not recoverable area.
  2. Display to the screen all the recoverable finds and the number of dives made by the submarine, considering the following: a. The submarine cannot exceed the maximum pressure specified in input. All the finds that are located at a higher hydrostatic pressure cannot be recovered: print the list to the screen. b. The weight carried by the submarine cannot exceed the maximum one provided in the command line. Once the limit is reached, another dive is needed. If the weight of a single find is greater than the maximum weight transportable, print a message to the screen.

Examples of file (a map with N=5 has been used for convenience): SEA_map.txt 14.7 18.5 12.9 43.4 80. 24.5 38.5 45.4 94.5 123. 37.9 56.5 94.6 184.4 243. 34.6 75.3 96.4 194.8 210. 65.8 88.5 91.4 144.1 234.

finds_1.txt 6 4 20. 4 1 10. 0 0 20. 3 3 12. 0 4 80. 1 1 32.

C:\prog.exe SEA_map.txt finds_1.txt 120 40 Finds not found in the area SEA_map.txt 6 4

Finds not recoverable for excessive pressure: 3 3 Pressure: 194. Dive 1: 4 1

Dive 1: 0 0 Find 0 4 Excessive weight Dive 2: 1 1