举一反三
- set1 = {x for x in range(10)} print(set1) 以上代码的运行结果为? A: {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} B: {0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10} C: {1, 2, 3, 4, 5, 6, 7, 8, 9} D: {1, 2, 3, 4, 5, 6, 7, 8, 9,10}
- >>>x= [10, 6, 0, 1, 7, 4, 3, 2, 8, 5, 9]>>>print(x.sort()) 语句运行结果正确的是( )。 A: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] B: [10, 6, 0, 1, 7, 4, 3, 2, 8, 5, 9] C: [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0] D: ['2', '4', '0', '6', '10', '7', '8', '3', '9', '1', '5']
- 【计算题】5 ×8= 6×4= 7×7= 9×5= 2×3= 9 ×2= 8×9= 7×8= 5×5= 4×3= 5+8= 6 ×6= 3×7= 4×8= 9×3= 1 ×2= 9×9= 6×8= 8×0= 4×7=
- 以下程序段实现的输出是()。for(i=0;i<;=9;i++)s[i]=i;for(i=9;i>;=0;i--)printf("%2d",s[i]);[/i][/i] A: 9 7 5 3 1 B: 1 3 5 7 9 C: 9 8 7 6 5 4 3 2 1 0 D: 0 1 2 3 4 5 6 7 8 9
- 【单选题】Which of the following matrices does not have the same determinant of matrix B: [1, 3, 0, 2; -2, -5, 7, 4; 3, 5, 2, 1; -1, 0, -9,-5] A. [1, 3, 0, 2; -2, -5, 7, 4; 0, 0, 0, 0; -1, 0, -9, -5] B. [1, 3, 0, 2; -2, -5, 7, 4; 1, 0, 9, 5; -1, 0, -9, -5] C. [1, 3, 0, 2; -2, -5, 7, 4; 3, 5, 2, 1; -3, -5, -2, -1] D. [1, 3, 0, 2; -2, -5, 7, 4; 0, 0, 0, 1; -1, 0, -9, -5]
内容
- 0
下面说法错误的是( )。知识点:列表推导式 A: dict([(x, x**2) for x in range(6)]) 创建的字典是{0: 0, 1: 1, 2: 4, 3: 9, 4: 16, 5: 25} B: [[x*3+y for y in range(1,4)] for x in range(3)] 创建的是二维列表 [[1, 2, 3], [4, 5, 6], [7, 8, 9]] C: number = [-2, 4, 6, -5]string = 'ab'z = [(i, j) if i>0 else (-i, j) for i in number for j in string]这段代码创建的列表为[(2, 'a'), (2, 'b'), (4, 'a'), (4, 'b'), (6, 'a'), (6, 'b'), (5, 'a'), (5, 'b')] D: ' '.join([i for i in range(1,11)])的运算结果为字符串'1 2 3 4 5 6 7 8 9 10'
- 1
当执行下面的语句定义一维数组a后,此数组的所有元素为 ( ) inta[10]; A.a[1],a[2],a[3],a[4],a[5],a[6],a[8],a[9],a[10],a[10] B.a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9] C.a[0],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10] D.a[1],a[2],a [3],a[4],a [5],a [9],a [7],a [8],a [9],a [10],a [11]
- 2
下面语句的输出结果是?range(len('HelloWorld')) A: [1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11] B: 11 C: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] D: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
- 3
for (int i = 1; i <= 10; i++){ if (i % 5 != 0) continue; Console.WriteLine("{0}", i); }该段程序执行后输出_____。 A: 5 10 B: 1 2 3 4 6 7 8 9 C: 5 D: 1 2 3 4 5 6 7 8 9 10
- 4
输出九九乘法表。 1 2 3 4 5 6 7 8 9 --------------------------------------------------------------------- 1*1=1 2*1=2 2*2=4 3*1=3 3*2=6 3*3=9 4*1=4 4*2=8 4*3=12 4*4=16 5*1=5 5*2=10 5*3=15 5*4=20 5*5=25 6*1=6 6*2=12 6*3=18 6*4=24 6*5=30 6*6=36 7*1=7 7*2=14 7*3=21 7*4=28 7*5=35 7*6=42 7*7=49 8*1=8 8*2=16 8*3=24 8*4=32 8*5=40 8*6=48 8*7=56 8*8=64 9*1=9 9*2=18 9*3=27 9*4=36 9*5=45 9*6=54 9*7=63 9*8=72 9*9=81