Set of multiple choice questions about programming with P6

  1. Question 1. What is the screen printing result of the following program:
     #include 

    void main ()

    {

    int i;

    for (i = 2;; ++) printf ('% 3d', i);

    };
    1. Infinite loop
    2. ' 2'
    3. ' twelfth'
    4. Other results
  2. Sentence 2. Which of the following commands allows to be moved to a labeled place.
    1. break.
    2. goto.
    3. tiếp tục.
    4. exit.
  3. Question 3. Which of the following commands allows to stop the control statement:
    1. break.
    2. goto.
    3. tiếp tục.
    4. All 3 answers above
  4. Question 4. In C language, declare 'int array [3] [5]' which means:
    1. The elements of the array are integers
    2. A two-dimensional array of up to 15 elements and each element is an integer
    3. array [3] [5] is an element of the array
    4. All is wrong
  5. Question 5. Find errors in the following program:
     #include 

    void main ()

    {

    int sum;

    sum = 453 + 343

    printf ('Ket la:' sum);

    };
    1. Missing semicolon (;)
    2. Missing comma (,)
    3. Missing specification character
    4. All 3 factors above
  6. Question 6. What are the results of the following program:
     #include 

    void main ()

    {

    int i, j;

    for (i = 1; i <4; i ++) j = i; printf ('% 3d', j);

    };
    1. "1 2 3 4".
    2. '4'.
    3. '3'.
    4. Other results
  7. Question 7. Priority for logical operators is:
    1. AND, NOT, OR.
    2. NOT, OR, AND.
    3. OR, NOT, AND.
    4. NOT, AND, OR.
  8. Question 8. What are the results of the following program:
     #include 

    void main ()

    {

    int a = 40, b = 4;

    while (a! = b)

    if (a> b) a = ab; else b = three; printf ('% d', a);

    };
    1. 2
    2. 4
    3. 16
    4. Other results
  9. Question 9. Suppose in the C language using the declaration of 'double a [12]', element a [7] is the second element in array a:
    1. Friday
    2. Saturday
    3. 8th
    4. 9th
  10. Question 10. What are the results of the following program:
     #include 

    void hoanvi (int * px, int * py)

    {

    int z; z = * px;

    * px = * py;

    * py = z;

    };

    void main ()

    {

    int a = 15, b = 21; Festival (a, b); printf ('% d% d', a, b);

    };
    1. '15 21 '
    2. '21 15 '
    3. Error message when executing the program
    4. Other results
  11. Question 11. What is the following program result:
     #include 

    void hoanvi (int px, int py)

    {

    int pz;

    pz = px; px = py; py = pz;

    };

    void main ()

    {

    int a = 15, b = 21; Festival (a, b);

    printf ('% d% d', a, b);

    };
    1. '21 15 '
    2. '15 21 '
    3. Error message when executing the program
    4. Other results
  12. Question 12. Which of the following statements is not a benefit of using a function:
    1. Avoid redundancy, repeat a command repeatedly
    2. Easy to maintain
    3. Ability to reuse the command
    4. All the above are wrong
  13. Question 13. Declare variables: int m, n; float x, y; Which command is wrong:
    1. n = 5
    2. x = 10
    3. y = 12.5
    4. m = 2.5
  14. Question 14. Print results to the screen of the following program:
     #include 

    void main ()

    {

    char * s;

    s = 'waving boards'; strcpy (& s [5], & s [9]); printf ('% s', s);

    };
    1. 'hello'.
    2. 'hello'.
    3. 'ban ban'.
    4. 'Welcome board'.
  15. Question 15. Print results to the screen of the following program:
     #include 

    void main ()

    {

    int a = 100, b = 6; double f;

    f = (double) a / (double) b; printf ('% 2.2f', f);

    };
    1. '16'.

    2. '16 .00 '.

    3.   '16 .67 '.

    4. Other results
4.5 ★ | 2 Vote

May be interested