CIS 110 Midterm: CIS 110 UPenn cis110 14fa Exam1 makeup Solutions

33 views6 pages

Document Summary

Cis 110 fall 2014 introduction to computer programming. Check cover sheet for name, recitation #, pennkey, and signature. (1 point total) (9 points total) Fill in the data type and nal value of the variable a. (assume a has been declared with the appropriate data type. ) Write ce as the data type if the statements will cause compiler error, or re if they will cause a run-time error. Give the reason for the error in the third column. _____ a = "1"; a = a + a + "0"; a += a; "110110" -or- 110110 int[] x = { 3, 1, 4, 1 }; Arrayindexoutofboundsexception int x = 15; int y = x / 2 * 2; _____ a = x == y; int x = "1"; int y = x; _____ a = y == x; double x = 3--; _____ a = 4; a %= 2; double x = 4; 0 compiler error use a = math. pow(x, . 5);