- 2nd Midterm Exam — CMPS 450.2 Dr Anthony Maida Instructions Put your name and student CLID(e.g axy2991 on each page Part 1 The following

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 2nd Midterm Exam — CMPS 450.2 Dr. Anthony Maida November 25, 2008 Instructions: Put your name and student CLID (e.g., axy2991) on each page. Part 1: The following questions are worth 2 points each unless stated otherwise. 1. Write the names of the six different Java namespaces (3 points). 2. Which of the following languages always use pass-by-reference for passing parameters to procedures, functions, subroutines, or methods? a. Java . b. Fortran . c. C . d. Python e. both choices b and d. f. both choices b and c. 3. Discuss the following source code in the context of Java verses C/C++ . What is different about the languages? int x = 1; if (x = 1) x++; 4. Name an operator in C/C++/Java that is right associative. 1 5. In Java , what is the range of values that can be stored in the primitive type byte ? a. 0 to 255 b. -128 to 127 c. -127 to 128 d. -256 to 255 e. -255 to 256 6. In the program below, all of the exception types are checked exceptions. Which checked exceptions need to be declared in methodB() ? (3 pts) public void methodA( ) throws ExceptionA, ExceptionB, ExceptionD { } public void methodB( ) throws ?????? { try { ... obj.methodA(); ... } catch (ExceptionA e) { } catch (ExceptionB e) { ... throw e; ... } if true throw new ExceptionC(); } 7. Discuss the following source code in the context of Java versus C/C++ . Specifically, what is differ- ent about the languages?ent about the languages?...
View Full Document

This note was uploaded on 02/17/2011 for the course CMPS 450 taught by Professor Radle,m during the Fall '08 term at University of Louisiana at Lafayette.

Page1 / 8

- 2nd Midterm Exam — CMPS 450.2 Dr Anthony Maida Instructions Put your name and student CLID(e.g axy2991 on each page Part 1 The following

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online