2024 年度・プログラミング・期末テスト(ペーパー)解答例

学籍番号         氏名            

 

  1. (4 点)
    int main(void) {
        int i = 0, j = 0;
        while (i++ < 9) {
            if (i % 2 == 0) {
                putchar('!');
            }
        }
        if (i % 3 != 0) {
            do {
                putchar('$');
            } while(j++ < 5);
        }
        putchar('&');                
        putchar('\n');
        return 0; 
    }
    

  2. (2 × 2 点)
    (ⅰ)%d
    (ⅱ)k <= -10 || 10 <= k

  3. (2 × 2 点)
    (ⅰ)
    double foo(double x, double y) {
        return x * x - y * y;
    }
        
    (ⅱ) foo(x, 1.3)

  4. (2 × 2 点)
    (1)(A) × (B)   (C) × (D) × (E)   (F) × (G)  (H)   
    (2)(A)  (B) ×  (C) × (D)   

  5. (0.5 × 4 点)
    (ⅰ) 44 (ⅱ) 36 (ⅲ) 10 (ⅳ) 16

  6. (1 × 14 点)
    (1)A (2)B (3)C (4)B
    (5)D (6)G (7)D (8)C
    (9)C (10)B (11)A (12)D
    (13)D (14)A

2024 年度・プログラミング・期末テスト(オンライン)解答例