Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
UMKD SDP2 2016-2017.docx
Скачиваний:
25
Добавлен:
14.10.2016
Размер:
126.72 Кб
Скачать

8. Resources for monitoring academic performance

EXAMPLES OF THE CERTIFICATION EXAM

Variant 1

1) The final exam includes two parts: open test and coding, you need to send 2 files (.doc files) with the answers to the test, and a .zip file with the code.

  • Pay attention to the name of the file.

  • After the coding is done do not send only a .java file, provide the entire folder.

2) All the answers in the final test must be highlighted in red font, the answers should be short, clear, and fully disclose the meaning of the question.

3) During the coding process, the code should be properly commented, should not contain unnecessary actions, and must fulfill all the requirements according to the task.

4) The final exam is 3 hours, all the answers must be sent 5-10 minutes before the test close, in case if the student does not have time to send an answer, the evaluation of the final exam will be 0%.

5) In the file for the test at the top you need to specify which option you choose for the coding (specify either 75 or 100). 75 and 100 suggests the maximum score for the second part - the coding.

  • In the case that a student will perform the test perfectly and perfectly perform coding by 75%, the highest score will be 87.5.

  • In the case that a student will perform the test perfectly and perfectly perform coding by 100%, the highest score will be 100. 

Test (1st part of Exam)

1. Convert the octal value of “213” to hexadecimal. Show your work.

2. For each following expressions, specify the Java type and value that would be generated by the expression:

Assume “a” and “b” are integer variable of the Java type “int” and “c” and “d” are approximations of real values of java type “double” with the following values:

int a = 2;

int b = 5;

double c = 3.0;

double d = -2.0;

Expression

Type

Value

a + 1

b + 2.0

b / a

a + c

c / d

a % b

(double) a + b / 2

(int) c + d

a – ++b

b + 2 / a – 3

3. In the space provided, show what the output generate by performing the following Java statements would be.

int data = 8;

System.out.print("The value <" + data);

System.out.print("> is an integer! ");

System.out.println("This value <2> is text. ");

System.out.println("The end.");

4. In the space provided, show what the following code would display:

String theLine = "1 2 3 5 7 8 12 13";

Scanner theLineReader = new Scanner(theLine);

int cntr = 0;

while (theLineReader.hasNextFloat()) {

float value = theLineReader.nextInt();

System.out.print(value + " ");

cntr++;

}

System.out.println();

System.out.println("cntr: " + cntr);

5. What would the following code display?

int [] numbers = {1,2,3,4,5};

int [] squares = new int[4];

int square;

for (int i=0;i<numbers.length;i++) {

square = numbers[i] * numbers[i];

if (i == squares.length) {

int[] temp = new int[squares.length + 4];

System.arraycopy(squares, 0, temp, 0, i);

squares = temp;

}

squares[i] = square;

}

for (int i=0;i<squares.length;i++)

System.out.print(squares[i]+" ");

System.out.println();

Place your output here:

6. Determine what the printed output of this program will be:

String []names = {"Joe","Alex","Bob","Sue"};

int [] index = {4,0,2,3};

String query = "Bob";

//using an index for indirect addressing of names

String name;

for (int i=0;i<index.length;i++) {

name = names[index[i]];

System.out.println(name);

if (query.equals(name))

break;

}

Describe program trace below.

7. In the space provided below, write the Java code necessary to read some real numbers (float) from the file DataFile.txt.

The program must:

  • Read the file, one number at a time.

  • Properly handle a value that is not a number.

  • Print each number as an output.

8. In the space provided, show variables value after performing the following Java code:

int x = 3, y = 5, z = 2;

if (x <= y) {

x += z;

if (z != x) { y = (x - z) / y;}

z++;

} else if (y == 0) {

y++;

z *= y;

}

---------------------------------------------------------------------------------------------------------------

Coding (2nd part of Exam)

1) Игра «угадай». Компьютер случайным образом выбирает любое число между 1 и 1000. Пользователь (игрок) должен это число угадать. Если не угадывает, то компьютер подсказывает больше или меньше загаданное число от введённого. Пользователь должен угадать данное число не более чем за 10 попыток.

75%

2) Есть массив из 5-и чисел, скажем {1,2,3,4,5}. Необходимо отобразить все возможные варианты перестановок (каковых, естественно, 5!)

100%

Соседние файлы в предмете Программирование на Java