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

29 views7 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 = false; a = a || (true && !false); double x = 3; x--; - or -- argument should be int not char double x = 4; Use a = math. pow(x, . 5); int[] x = { 3, 1, 4, 1 }; _____ a = "1"; a = a + a; a += a; _____ a = 3; a %= 2; int x = 15; int y = 2 * x / 2;