MOOC 程序设计基础(东北大学)1206690865 最新慕课完整章节测试答案
Chapter 5. Functions
程序设计基本概念复习测验
1、单选题:
Which of the following must every C program have?
选项:
A: main
B: #include
C: /*
D: <stdio.h>
答案: 【 main】
2、单选题:
Every statement in C must end with a
选项:
A: period (.)
B: semicolon (;)
C: colon (:)
D: backslash (/)
答案: 【 semicolon (;)】
3、单选题:
Which of the following is not a valid escape sequence?
选项:
A: n
B: \
C: ~
D: ”
答案: 【 ~】
4、单选题:
Which statement about comments is false?
选项:
A: Comments begin and end with /* and */, respectively.
B: Programmers insert comments to document programs and improve program readability.
C: Comments do not cause any machine language object code to be generated.
D: Lengthy comments can cause poor execution-time performance.
答案: 【 Lengthy comments can cause poor execution-time performance.】
5、单选题:
Lines beginning with a # are processed
选项:
A: at execution time.
B: at compile time.
C: at preprocessor time.
D: at postprocessor time.
答案: 【 at preprocessor time.】
6、单选题:
Which of the following is not a valid integer value?
选项:
A: -3
B: 0
C: 2134859
D: 1.1
答案: 【 1.1】
7、单选题:
Which of the following is an invalid identifier (variable name)?
选项:
A: _Test
B: TEST
C: 5test
D: test1
答案: 【 5test】
8、单选题:
Which statement is false.
选项:
A: Variables may be defined anywhere in the body of main.
B: All variables must be defined before they are used.
C: All variable definitions must include the name and data type of each variable.
D: Several variables of the same data type may be defined in one definition.
答案: 【 Variables may be defined anywhere in the body of main.】
9、单选题:
C's if statement executes the statement inside its body if a specified __________ is __________.
选项:
A: condition, true
B: condition, false
C: equality operator, true
D: relational operator, true
答案: 【 condition, true】
10、单选题:
Which of the following is not a keyword?
选项:
A: int
B: return
C: if
D: main
答案: 【 main】
11、单选题:
Which of the following is an iteration statement?
选项:
A: if
B: if…else
C: do…while
D: switch
答案: 【 do…while】
12、单选题:
The __________ selection statement performs an action if a condition is true and skips that action if the condition is false.
选项:
A: if
B: when
C: if…else
D: switch
答案: 【 if】
13、单选题:
The __________ selection statement performs an action if a condition is true and performs a different action if the condition is false.
选项:
A: if
B: when
C: if…else
D: switch
答案: 【 if…else】
14、单选题:
The __________ selection statement performs one of many different actions, depending on the value of an expression.
选项:
A: if
B: when
C: if…else
D: switch
答案: 【 switch】
15、单选题:
The conditional operator (?:) ________.
选项:
A: is the only ternary operator in C
B: is a unary operator
C: associates from left to right
D: accepts two operands
答案: 【 is the only ternary operator in C】
16、单选题:
Having a loop within a loop is known as
选项:
A: recursion
B: doubling up
C: nesting
D: a redundancy
答案: 【 nesting】
17、单选题:
Which statement automatically handles all the details of counter-controlled iteration.
选项:
A: for
B: while
C: do …while
D: continue
答案: 【 for】
18、单选题:
If a do…while statement is used,
选项:
A: an infinite loop will not take place
B: the counter must be preincremented if it’s also the condition
C: the body of the loop will execute at least once
D: an off-by-one error wil