wujr5/c-and-cpp-language-learning

软件:week4 理论作业(2015-10-19 实验课结束后提交)

ghostbody opened this issue · 5 comments

Attention:

作业写在纸上,写上姓名学号,在实验课结束后提交。

对于每一道题目,写上答案,并且写上解题思路,为什么选这个?(根据什么?)

英文答题

😄 😄 😄

答题例子:
// example

  1. C99 standard guarantees uniqueness of ____ characters for internal names.
    a) 31
    b) 63
    c) 12
    d) 14
    View Answer
    Answer:b
    Explanation:ISO C99 compiler may consider only first 63 characters for internal.
    // end example

正式题目:

  1. Which of the following is not a valid variable name declaration?
    a) int __a3;
    b) int __3a;
    c) int __A3;
    d) None of the mentioned
  2. Which of the following is not a valid variable name declaration?
    a) int _a3;
    b) int a_3;
    c) int 3_a;
    d) int _3a
  3. Variable names beginning with underscore is not encouraged. Why?
    a) It is not standardized
    b) To avoid conflicts since assemblers and loaders use such names
    c) To avoid conflicts since library routines use such names
    d) To avoid conflicts with environment variables of an operating system
  4. All keywords in C are in
    a) LowerCase letters
    b) UpperCase letters
    c) CamelCase letters
    d) None
  5. Which of the following is not a valid C variable name?
    a) int number;
    b) float rate;
    c) int variable_count;
    d) int $main;
  6. Which of the following is true for variable names in C?
    a) They can contain alphanumeric characters as well as special characters
    b) It is not an error to declare a variable to be one of the keywords(like goto, static)
    c) Variable names cannot start with a digit
    d) Variable can be of any length
  7. The value of expression 3.6-5/2+1.2+5%2 is .
    (A) 4.3
    (B) 4.8
    (C) 3.3
    (D) 3.8
  8. _______ translates high-level language program into machine language program.
    (A)CPU
    (B) A compiler
    (C) An assembler
    (D) The operating system
  9. Which of the followings cannot be used as an identifier?
    (A) _1234
    (B) 1_2
    (C) int_2

    (D) 2_int
  10. If x = 2 and y = 3, what is the value of y for y += x > y ? x *x : y * y.
    (A) 12
    (B) 9
    (C) 7
    (D) none of the above
  11. Suppose int i=1,which of the following statements cannot increase variable i by 1?
    (A)i=i+1;
    (B)i+=1;
    (C)i++;
    (D)i=1;
  12. Which of the followings cannot be used as an identifier?
    (A) true
    (B) INT
    (C) CHINA
    (D) end
  13. The value of expression 4-5/2.0+5%2 is .
    (A) 2.5
    (B) 3
    (C) 4
    (D) none of the above

例题我就看不懂了

是实验课上写吗

实验课后交

收到

答案:

  1. Which of the following is not a valid variable name declaration?
    Answer:d
    Explanation:None.
  2. Which of the following is not a valid variable name declaration?
    Answer:c
    Explanation:Variable name cannot start with a digit.
  3. Variable names beginning with underscore is not encouraged. Why?
    Answer:c
    Explanation:None.
  4. All keywords in C are in
    Answer:a
    Explanation:None.
  5. Which of the following is not a valid C variable name?
    Answer:d
    Explanation:Since only underscore and no other special character is allowed in a variable name, it results in an error.
  6. Which of the following is true for variable names in C?
    Answer:c
    Explanation:According to the syntax for C variable name, it cannot start with a digit.
  7. The value of expression 3.6-5/2+1.2+5%2 is .
    答案:D
  8. _______ translates high-level language program into machine language program.
    答案:B
  9. Which of the followings cannot be used as an identifier?
    答案:D
  10. If x = 2 and y = 3, what is the value of y for y += x > y ? x *x : y * y.
    答案:A
  11. Suppose int i=1,which of the following statements cannot increase variable i by 1?
    答案: D
  12. Which of the followings cannot be used as an identifier?
    答案: A
  13. The value of expression 4-5/2.0+5%2 is .
    答案: A