CSC190H1 Midterm: CSC190H1_20151_621429585706solutions

32 views8 pages
31 Jan 2019
School
Course
Professor

Document Summary

Note to students: this le contains sample solutions to the term test. Make sure that you understand why the solutions given here are correct, that you understand the mistakes that you made (if any), and that you understand why your mistakes were mistakes. For all remarking requests, please refer to the portal for instructions. Please provide short answers to each one of the following sub-questions. Assume that the number of bits allocated in a computer for short int is 16 bits. The range of short integers that can be stored in this computer is therefore [-32768, 32767]. If so, what is the problem called and why is it caused? short int i=32768; printf("i is %d\n", i); This is an integer over ow problem. short int is only allocated 16 bits in the computer. The value 32768 requires more than 16 bits of storage space.