第1周——初识C语言从认识变量和常量开始

codeblocks介绍——从HelloWorld开始

1、单选题:
‌#include <stdio.h>是‎
选项:
A: 编译预处理指令
B: 语句
C: 函数
D: 程序入口
答案: 【 编译预处理指令

debug

1、单选题:
‍codeblocks中运行到下一步(next line)的快捷键是‎
选项:
A: F7
B: F5
C: F8
D: F11
答案: 【 F7

变量在内存中所占的字节数

1、单选题:
‏C语言用sizeof计算变量在内存中的字节数,其中sizeof是()‍
选项:
A: 函数
B: 运算符
C: 标识符
D: 语句
答案: 【 运算符

宏常量与const常量

1、单选题:
‍宏定义是()‍
选项:
A: 一条语句
B: 一种编译预处理指令
C: 一个标识符
D: 一个变量
答案: 【 一种编译预处理指令

2、判断题:
‌const常量有数据类型。‍
选项:
A: 正确
B: 错误
答案: 【 正确

第2周——数字间的那些事儿做点计算哈

不同类型数据的运算

1、判断题:
​通常情况下,不同类型数据的运算结果的类型是取值范围较大的那种类型。‏
选项:
A: 正确
B: 错误
答案: 【 正确

在定义变量的时候对变量进行初始化

1、单选题:
​下列语句中错误的是()。‏
选项:
A: int a, b, c;a=b=c=0;
B: int a, b, c;a=0;b=0;c=0;
C: int a=0;int b=0;int c=0;
D: int a=b=c=0;
答案: 【 int a=b=c=0;

强制类型转换

1、判断题:
‍强制类型转换运算符就是强制改变一个变量原有的数据类型。‌
选项:
A: 正确
B: 错误
答案: 【 错误

运算符的优先级和结合性

1、判断题:
‎二元的算术运算符的结合性都是左结合。‍
选项:
A: 正确
B: 错误
答案: 【 正确

第3周——从键盘中来到键盘中去开始输入和输出啦

%c格式转换说明

1、判断题:
‎用c格式符输入字符型数据的时候,为了避免将输入缓冲区中的空白字符(空格、回车换行符、Tab键)作为有效字符读入,可以在%c前面加一个空格。‌
选项:
A: 正确
B: 错误
答案: 【 正确

单个字符的输入输出

1、判断题:
​单个字符既可以以c格式符也可以以d格式符输出,前者是输出这个字符,后者是输出这个字符的ASCII码值。‎
选项:
A: 正确
B: 错误
答案: 【 正确

格式字符

1、判断题:
‍在调用printf函数输出数据时,当数据的实际位宽大于printf函数中的指定位宽时,将按照数据的实际位宽输出数据。‍
选项:
A: 正确
B: 错误
答案: 【 正确

第一次课单元测试-单选题

1、单选题:
‎Which one is an invalid identifier as follows ().‏
选项:
A: abc123
B: No.1
C: _123_
D: OK
答案: 【 No.1

2、单选题:
‍Which one is a valid identifier as follows ( ). ‍‎
选项:
A: _buy_2
B: 2_buy
C: ? _buy
D: buy?
答案: 【 _buy_2

3、单选题:
‍Which one is a valid identifier as follows (). ‍‏
选项:
A: int    Define      WORD
B: a3_b3   _123     IF
C: For    -ABC     Case
D: 2a     do       sizeof
答案: 【 a3_b3   _123     IF

4、单选题:
‎Which one is not the keyword in C language () .‌
选项:
A: int
B: break
C: while
D: character
答案: 【 character

5、单选题:
‌Which one is the keyword in C language ().     ‍​
选项:
A: Float
B: signed
C: integer
D: Char
答案: 【 signed

6、单选题:
‍Which one is right as follows (). ‍‏
选项:
A: A c program is consisted of a main program and a number of sub-programs.
B: A c program is consisted of one or more functions.
C: A c program is consisted of a number of processes.
D: A c program several sub-programs.
答案: 【 A c program is consisted of one or more functions.

7、单选题:
‏What is the unit of C program (). ‍‌
选项:
A: Program Line
B: Statement
C: function
D: Character
答案: 【 function

8、单选题:
​Which one is wrong as
follows (). ‍‎
选项:
A: Only one statement
can be written on a line.
B: Each function has a
function header and a function body, and the main function is no exception.
C: The main function can only call user
functions or system functions, and user functions may call each other. ‍
D: A program is made up of several functions, but there must be, and only one, a main function.     
答案: 【 Only one statement
can be written on a line.

9、单选题:
‎Which one is right as
follows (). ‍‎
选项:
A: A c language program always starts with
the first defined function.
B: The function to be called must be
defined in the main function.
C: A c language program
always starts with the main function.
D: The main function in the C language program must be placed at the beginning of the program. 
答案: 【 A c language program
always starts with the main function.

10、单选题:
‏What is the C
compiler (). ‍‍
选项:
A: It is a machine
language version.
B: It is a set of
machine language instruction.
C: It is used to compile
the C source program into the target program.
D: It is a set of application software
provided by manufacturers.
答案: 【 It is used to compile
the C source program into the target program.

11、单选题:
​The ASCII code value of uppercase ‘A’ is 65, and the lowercase ‘a’ is 97, What is the value of character constant ' 101 ' ( ).  ‍‎
选项:
A: A
B: a
C: c
D: Illegal constants
答案: 【 A

12、单选题:
​Which one is correct escape character ( ). // escape character 转义字符‍‏
选项:
A: ' \  '
B: ' 018 '
C:  ' xab '
D: ' abc '
答案: 【 ' abc '

13、单选题:
‌​Which
one is the correct character constant (). ​‌​‌‍​
选项:
A: "F"
B: ' \ ' '
C: ' W '
D:   ''
答案: 【 ' W '

14、单选题:
‏Which expression is
correct as follows ().‍‏int m=8,n, a, b;  unsigned long w=10; double x=3.14, y=0.12;‍‏‍‍
选项:
A: a+=a-= (b=2) * (a=8)
B: n=n*3=18
C: x%3
D: y=float (m)
答案: 【 a+=a-= (b=2) * (a=8)

15、单选题:
‌Which one is a
correct assignment expression as follows (). ‍​
选项:
A: a=9+b+c=d+9
B: a= (9+b, c=d+9)
C: a=9+b, b++, c+9
D: a=9+b++=c+9
答案: 【 a= (9+b, c=d+9)

16、单选题:
​If the ASCII code of
letter A is decimal number 65 and s is a character type,
What is the value of s, after the statement s= ' A ' + ' 6 '-' 3 ' is executed().‍‌
选项:
A:  'd'
B: 68
C: The indeterminate value     
D: 'D'
答案: 【 'D'

17、单选题:
​In C language, which
operator need the operation’s data type must be integer(). ‍‌
选项:
A: /          
B: + +
C: *=
D: %
答案: 【 %

18、单选题:
‌Given: char s= ' /72
'; which is right as follows (). ‍​
选项:
A: s contains a
character
B: s contains two
characters
C: s contains three
characters
D: The description is invalid,
the value of s is uncertain
答案: 【 s contains a
character

19、单选题:
‌Given: int m=7; float
x=2.5, y=4.7; what is the value of the expression of x+m%3* (int) (x+y)%2/4 ().‍‌
选项:
A: 2.500000
B: 2.750000
C: 3.500000
D: 0.000000
答案: 【 2.500000

20、单选题:
‌Given float x; int m; the following can be implemented to retain the value in x two bits after the decimal point, and the third bit is the expression of the rounding operation is (). ​‌设变量x为float类型,m为int类型,则以下能实现将x中的数值保留小数点后两位,第三位进行四舍五入运算的表达式是​‌‍​
选项:
A: x= (x*100+0.5)/100.0
B: m=x*100+0.5, x=m/100.0
C: x=x*100+0.5/100.0
D: x= (x/100+0.5) *100.0
答案: 【 m=x*100+0.5, x=m/100.0

21、单选题:
‍What is the data type of the expression ‍13/3*sqrt (16.0)/8 (). sqrt(x)用来对x开平方‎
选项:
A: int
B: float
C: double
D: Not sure
答案: 【 double

22、单选题:
‍Assuming that all
variables are integer, which one is not 7 as the following expression (). ‍‍
选项:
A: (m=n=6, m+n, m+1)
B: (m=n=6, m+n, n+1)
C: (m=6, m+1, n=6, m+n)
D: (m=6, m+1, n=m, n+1)
答案: 【 (m=6, m+1, n=6, m+n)

23、单选题:
‍Assuming that all variables are integer, what is the value of the expression (x=2, y=5, y++, x+y) (). ‌
选项:
A: 7
B: 8
C: 6
D: 2
答案: 【 8

24、单选题:
​What are the correct assignment statements as follows ().  ​​int x,y;  float z; ​​‍​
选项:
A: x=1,y=2;
B: x=y=100;
C: x++;    
D: x=int (z);
答案: 【 x=y=100;

25、单选题:
‎Given float x,y ; Which
one is the incorrect assignment statement (). ‍‏
选项:
A: ++x;
B: x*=y-2;
C: y= (x%3)/10;
D: x=y=0;
答案: 【 y= (x%3)/10;

26、单选题:
‌Which is the correct statement as follows (). ‌‌‌
选项:
A: a=7+b+c=a+7;   
B: a=7+b++=a+7;    
C:  a=7+b,b++,a+7
D:  a=7+b,c=a+7;
答案: 【  a=7+b,c=a+7;

27、单选题:
‏What will be output to the screen of the function putchar().‏‏‏
选项:
A: Integer variable expression value.
B: String
C: The real variable value.
D: Character
答案: 【 Character

28、单选题:
‎What is correct output as follows (). ‍‎int a=12345;  printf ("%2dn", a); ‍‍‎‍
选项:
A: 12
B: 34
C: 12345
D: Prompt for error, no result
答案: 【 12345

29、单选题:
‌According the statements as follows, given 10.0, 22.0 and 33.0 to variable a, b and c respectively, what are the incorrect input as follows ().  ‏‌float a,b,c;  scanf ("%f%f%f", &a, &b, &c); ‏‌‍‏
选项:
A: 102030
B: 10.0, 22.0, 33.0   
C: 10.0 22.0 33.0
D: 10  22 33
答案: 【 10.0, 22.0, 33.0   

30、单选题:
‍When input the data as: 12, 34, what will be output ().‍#include "stdio.h"‍main ()‍{ int a,b;‍  scanf ("%d%d", &a,&b);‍printf ("a+b=%dn", a+b);‍} ‍‍‍‍
选项:
A:  a+b=46
B: There are syntax
errors
C:  a+b=12
D: Indeterminate value
答案: 【 Indeterminate value

第4周——无处不在的抉择

判断ch是英文字母大写或者小写

1、判断题:
‍下面判断ch是大写或者小写英文字母的表达式是否正确?‌‍ch >= 'A' &&  ch <= 'Z' || ch >= 'a'  &&  ch <= 'z'‌
选项:
A: 正确
B: 错误
答案: 【 正确

条件运算符

1、单选题:
​下列关于if-else语句的说法中哪个是正确的。‍
选项:
A: else总是和离它最近的if配对
B: else总是和前面离它最近的且还未和其他else匹配的在同一语句块内同一层次的if配对
C: else总是和前面离它最近的且位于花括号内的if配对
D: else可以和它前面的尚未与其他else匹配的任何一个if配对
答案: 【 else总是和前面离它最近的且还未和其他else匹配的在同一语句块内同一层次的if配对

2、判断题:
‍条件运算符是C语言中唯一的一个三元运算符.‎
选项:
A: 正确
B: 错误
答案: 【 正确

浮点数的表数精度

1、单选题:
‍下列说法错误的是()。​
选项:
A: 浮点数并非真正意义上的实数,只是其在某种范围内的近似。
B: 浮点数能精确表示的数字位数取决于这种类型的浮点数的有效数字位数。
C: 使用更多的位来存储阶码,将会扩大浮点数的表数精度。
D: 受浮点数表数精度的限制,因此对于浮点数不能直接比较其是否相等,应该比较其是否近似相等。
答案: 【 使用更多的位来存储阶码,将会扩大浮点数的表数精度。

程序测试

1、单选题:
‍下列说法错误的是()。​
选项:
A: 软件测试的目的就是证明程序的正确性,即给定特定的输入,通过运行被测程序,检查程序的输出是否与预期结果一致,进而验证程序的正确性。
B: 白盒测试就是在完全了解程序的结构和处理过程的情况下,按照程序内部的逻辑测试程序,检验程序中的每条逻辑路径是否都能按预定要求正确工作。黑盒测试就是把系统看成一个黑盒子,不考虑程序内部的逻辑结构和处理过程,只根据需求规格说明书的要求,设计测试用例,检查程序的功能是否符合它的功能说明。
C: 在选择测试用例时,不仅要选取合理的输入数据,还要选取一些不合理的输入数据,以及某些极端的边界点或临界点等,对程序进行测试
D: 由于修复了旧的bug的同时,往往又会产生新的bug,因此往往还需要对所有出现过的bug重新测试一遍,看其是否会重新出现,并给确认代码修改后没有引入新的bug,即修改代码后需要进行回归测试。
答案: 【 软件测试的目的就是证明程序的正确性,即给定特定的输入,通过运行被测程序,检查程序的输出是否与预期结果一致,进而验证程序的正确性。

第二次课单元测试-单选题

1、单选题:
Defined: int x=3, y=4, z=5; The value of the expression!(x+y) +z-1 && y+z/2 is().‌‎‌
选项:
A: 6
B: 0
C: 2
D: 1
答案: 【 1

2、单选题:
Set a=5,b=6,c=7,d=8,m=2,n=2; after execution (m=a>b) && (n=c>d), the value of n is ( ). ‎‌‎
选项:
A: 1
B: 2
C: 3
D: 4
答案: 【 2

3、单选题:
‏Set int x=3, y=4, z=5;
the value of which expression as follows is 0 ( ).‍‎
选项:
A:  ' x ' && '
y '
B: x<=y
C: x||y+z && y-z
D: !((x
<y)&&!z||1)
答案: 【 !((x
<y)&&!z||1)

4、单选题:
To avoid the two semantics of nested if-else statements, the C language specifies that else always forms a pairing relationship with ( ).‏‍‍‏
选项:
A: the if that the indentation position is the same //缩进‍
B: the
if that not paired before
C: the most recent if that
not paired before
D: the if that is on the
same line
答案: 【 the most recent if that
not paired before

5、单选题:
The Data types of operation objects on both sides of logical operators are ( )‎‎‍‎
选项:
A: Only
0 or 1
B: Can only be zero or non-zero positive numbers
C: Integer or character
data only
D: Can be any type of
data
答案: 【 Can be any type of
data

6、单选题:
The following description of operator priority is correct (  ).​‎‍​
选项:
A: relational operator
< arithmetic operator < assignment operator < logic operator
B: logic operator <
relational operator < arithmetic operator < assignment operator
C: assignment operator
< logic operator < relational operator < arithmetic operator
D: arithmetic operator
< relational operator < assignment operator < logic operator
答案: 【 assignment operator
< logic operator < relational operator < arithmetic operator

7、单选题:
The highest priority of the following operators is ( ).​‏‍​
选项:
A: <‍
B: &
C: +
D: !=
答案: 【 +

8、单选题:
Which one as follows is use to express "the value is true when the x is in the range [-58,-40] and [40, 58], otherwise false" ( ). ‍‍‍‍
选项:
A: (x>= -58)
&& (x<= -40) && (x>=40) && (x<=58)
B: (x>=
-58) || (x<= -40) || (x>=40) || (x<=58)
C: (x>=
-58) && (x<= -40) || (x>=40) && (x<=58)
D: (x>=
-58) | |(x<= -40) && (x>=40) || (x<=58)
答案: 【 (x>=
-58) && (x<= -40) || (x>=40) && (x<=58)

9、单选题:
The correct expression to determine whether the char variable s is a lowercase letter is ( ).‌​‍‌
选项:
A: ’a’ <= s<=’z’                   
B: (s>=’a’)
& (s<=’z’)
C: (s>=’a’) && (s<=’z’)             
D: (’a’<=s) and
(’z’>=s)
答案: 【 (s>=’a’) && (s<=’z’)             

10、单选题:
Which one as follows does not mean “If x is odd, the value of the expression is true, else the value is false” ().​‍‍​
选项:
A: x%2==1                             
B: !(x%2==0)
C: !(x%2)                              
D: x%2
答案: 【 !(x%2)                              

11、单选题:
Set int a=1,b=2,c=3; after the following statement is executed, the value of a,b,c is (  ).   ‏if (a>b)  c=a; a=b; b=c;‏‌‍‏
选项:
A: a=1, b=2, c=3                      
B: a=2, b=3, c=3
C: a=2, b=3, c=1                      
D: a=2, b=3, c=2
答案: 【 a=2, b=3, c=3

12、单选题:
Please read the following codes: which answer is right (  ). ‏#include <stdio.h>‏main()‏{        int x=-10, y=5, z=0;‏if (x=y+z) printf("***n" );‏else      printf("$$$n");‏}‏​‍‏
选项:
A: Grammatical errors cannot be compiled         
B: Output ***
C: Can be compiled but not connected             ‍
D: Output
$$$
答案: 【 Output ***

13、单选题:
Please read the following codes: which answer is right (  ).‏#include ”stdio.h”‏main()‏{  int a=1; ‏if (a++>1) printf(“%dn”, a);‏else      printf(“%dn”, a--);‏}‏‍‏
选项:
A: 0
B: 1
C: 2
D: 3
答案: 【 2

14、单选题:
Set int a = 1, b = 2, c = 4, d = 3, x; after executing the following program, the value of x is ( ).‍if (a<b)‍if (c<d) x=1;‍else‍    if (a<c)‍      if (b<d) x=2;‍      else x=3;‍else x=4;‍else x=5;‍‎‍
选项:
A: 1
B: 2
C: 3
D: 4
答案: 【 2

15、单选题:
After executing the following program segments, the values of variables x, y and z respectively are ().​    int a=1,b=0, x, y, z;    x=(--a==b++)?--a:++b;   y=a++;  z=b;​‍‍​
选项:
A: x=0,y=0,z=0                      
B: x= -1,y= -1,z= 1
C: x=0,y=1,z=0                     
D: x= -1, y= 2, z= 1
答案: 【 x= -1,y= -1,z= 1

16、单选题:
Set int a=1, b=2, c=3, d=4, w; after executing the following statement, the value of w is ().‏w=(a<b)?a :b;‏w=(w<c)?w:c;‏w=(w<d)?w:d;‏‌‏
选项:
A: 1
B: 2
C: 3
D: 4
答案: 【 1

17、单选题:
The output of the following program is ().‌#include <stdio.h>‌main()‌{‌int a=5, b=4, c=6, d;      ‌          printf(”%dn”, d=a>b? a>c?a:c :b);‌}‌​‌
选项:
A: 5
B: 4
C: 6
D: Uncertain
答案: 【 6

18、单选题:
Set int a, b, c1, c2, x, y, which statement as follows is right ().‎‏‍‎
选项:
A: switch (a+b);                    { case 1: y=a+b; break;               case 0: y=a-b; break;                  }
B: switch a{  case c1: y=a-b; break;case c2: x=a*d; break;default:
x=a+b;}
C: switch (a*a+b*b)                 { case 3:                          case 1: y=a+b; break;                 case 3: y=b-a; break;                 }
D: switch(a-b){  default: y=a*b; break;case 3: x=a+b; break;case 10: case 11:
y=a-b; break;}
答案: 【 switch(a-b){  default: y=a*b; break;case 3: x=a+b; break;case 10: case 11:
y=a-b; break;}

19、单选题:
The result of the following program is ().‏#include <stdio.h>‏main()‏{ ‏float x=2.0, y;           ‏          if (x<0.0) y=0.0;‏else if (x<10.0) y=1.0/x;‏else y=1.0;‏printf(“%fn”,y);‏‎‍‏
选项:
A: 0

剩余75%内容付费后可查看

发表评论

电子邮件地址不会被公开。 必填项已用*标注