EE3206 Test 1 Solution (2009) - Question 10 By method...

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

View Full Document Right Arrow Icon
EE3206 Java Programming and Applications Test One Solution Part A – Short Question [15 marks] Question 1 Java is compiled into bytecode but not native machine code. The bytecode is then interpreted by JVM (Java Virtual Machine) and executed in runtime. Any machines/platforms with JVM installed can run Java program. Question 2 Java EE / Java SE / Java ME Question 3 A special format used by javadoc tool to compile into API specification. Question 4 final int SIZE = 3; Question 5 The literal 4.5 is double type by default. There is possible loss of precision. Question 6 From high to low: --, *, +, !=, && Question 7 Method signature consists of method name and parameter list. It is used to determine which method being invoked. Question 8 The variables defined in the method header are known as formal parameters. When a method is invoked, you pass a value to the parameter. This value is referred to as actual parameter or argument. Question 9 Call Stack is a memory space to hold data of a call.
Background image of page 1

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

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

Unformatted text preview: Question 10 By method abstraction, the method body can be regarded as a black box. A program designer can plan the system functions based on the contracted input/output in method header without going into the implementation details. Part B – Programming Question [15 marks] Question 11 public static double sum(double num1, double num2) { return num1 + num2; } Question 12 public static int getRandomNum() { return 256 + (int) (Math.random() * 257); } Question 13 public class ReadInput { public static void main(String args) { Scanner scanner = new Scanner(System.in); int input; do { input = scanner.nextInt(); System.out.println(input); } while(input != 0); } } Question 14 public static int processArray(int oldArray){ int row = oldArray.length; int col = oldArray[0].length; int newArray = new int[col][row]; for(int i=0; i<row; i++) for(int j=0; j<col; j++) newArray[j][i] = oldArray[i][j]; return newArray; }...
View Full Document

This note was uploaded on 04/20/2010 for the course ELECTRONIC EE3206 taught by Professor Tingchiwang during the Spring '10 term at École Normale Supérieure.

Page1 / 2

EE3206 Test 1 Solution (2009) - Question 10 By method...

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

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