EE3206 Test 1 Solution - arguments. Question 8 (2 marks)...

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

View Full Document Right Arrow Icon
EE3206/EE5805 Java Programming and Applications Test One Solution Question 1 (1 marks) Java is compiled into bytecode Question 2 (3 marks) Package is used to organize java classes into different namespaces. cd c:\w\x java y.z.MyClass Question 3 (2 marks) final float PI = 3.14 f ; Question 4 (1 marks) var3 = var2 + var1; Question 5 (1 mark) Integer x = 10; Question 6 (1 mark) It is used for dynamic memory allocation/storing objects. Question 7 (2 marks) Method signature is the combination of the method name and the parameter list . Because the target of method invocation is identified by method signature , two methods of the same method name can be distinguished by the types of their input
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: arguments. Question 8 (2 marks) public static char getRandomCharacter() { return (char) (‘g’ + Math.random() * (‘p’ – ‘g’ + 1)); } Question 9 (5 marks) public static int[][] subtractMatrix(int[][] m1, int[][] m2) { int row1 = m1.length; int col1 = m1[0].length; int row2 = m2.length; int col2 = m2[0].length; int[][] result = new int[row1][col1]; if (row1 == row2 && col1 == col2) { for (int i = 0; i < row1; i++) { for (int j = 0; j < col1; j++) { result[i][j] = m1[i][j] - m2[i][j]; } } return result; } else { return null; } }...
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 - arguments. Question 8 (2 marks)...

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