Skip to main content

Table 5 Examination programming quiz

From: Student placement and skill ranking predictors for programming classes using class attitude, psychological scales, and code metrics

No.

Examination sentence

1

Create a program that computes the sum of natural numbers from 1 to 100 and outputs it to the display. Do not use mathematical formulas.

2

Create a program that calculates the sum of squares from 1 to 100 and outputs it to the display. Do not use mathematical formulas.

3

Create a program to calculate a sequence of numbers (Fibonacci numbers & F(0)=0, F(1)=1, F(n)=F(n-1)+F(n-2)) where the program terminates when F (n) exceeds 10000.

4

Create a program to calculate a sequence of numbers (Tribonacci number & T(0)=0, T(1)=0, T(2)=1, T(n)=T(n-1)+T(n-2)+T(n-3)). where the program is terminated when T (n) exceeds 10000.

5

Create a program to generate 1000 Java random numbers with natural numbers between 0 and 100. Display their maximum value, minimum value, and average value.

6

Create a program that displays the number of bills (10,000 yen, 5,000 yen, 1 thousand yen) and coins (500 yen, 100 yen, 50 yen, 10 yen, 5 yen, 1 yen) needed to pay the random amount entered on a keyboard. The solution should use the fewest bills or coins possible.

7

Create a game to hit a randomly generated integer between 0 and 999. When the user inputs a value smaller than the correct answer, display “it is smaller than the correct answer”. When the user inputs a value larger than the correct answer, display “it is larger than the correct answer”. If the user does not answer correctly after 10 attempts, display “Game Over”.

8

Please indicate the execution result of the following three programs: e.g. for(char c=’A’; c<=’Z’; c++) System.out.print(c); System.out.print("\n");