CPSC 112 Midterm: CS 112 Yale 18 Spring Exam1 Solution

86 views5 pages
31 Jan 2019
Course
Professor

Document Summary

Miscellaneous: (1 point) (a) write your name, recitation number, and pennkey (username) on the front of the exam. (b) sign the certi cation that you comply with the penn academic integrity code. Give the type and value for each of the following expressions and variable declarations. When there is more than one statement, give the type and value that the last state- ment computes. If the code would result in a syntax error, write n/a in the rst column, and give the reason for the error in the second column. You do not need to write the exact error message. Stdout. print is a void function, cannot assign to a string. 6++ char[] arr = {"5", "3"}; arr[2]; double. Cannot increment a literal value array index out of bounds. The following program is supposed to print out the second-largest double value speci ed on the command line, or -infinity if less than two numbers are given.