CMSC 131 Study Guide - Midterm Guide: Duplicate Code, Multiple Choice, Ternary Operation

79 views10 pages

Document Summary

I pledge on my honor that i have not given or received any unauthorized assistance on this examination. This exam is a closed-book and closed-notes exam. The exam is a 50 minutes exam. Please use a pencil to complete the exam. There are three problems in the exam. Multiple choice questions can have more than one valid/correct answers. You do not need any import statements for coding questions. You must write code that is efficient and that avoids code duplication. 2: (3 pts) the following code compiles. Write none if no problems or invalid operations are present. You can assume the method is in a class that compiles. public void check(double val, int x) { if (x > 0) { if (val == 4. 5) { If an exception is thrown indicate why. public class values { public int a; public boolean b; public string c; public values() { public static void main(string[] args) {