设有变量定义:x=(10,20,30)和y=[10,20,30],以下正确的赋值语句是_______。
A: x(2)=40
B: x[2]=40
C: y(2)=40
D: y[2]=40
A: x(2)=40
B: x[2]=40
C: y(2)=40
D: y[2]=40
举一反三
- 设有变量定义:int x=10,y=20,z=30;则以下语句执行后x,y,z的值是______。 A: x=20,y=30,z=20 B: x=10,y=20,z=30 C: x=20,y=10,z=10 D: x=20,y=10,z=0
- 下列程序的输出结果是___________。a=[10,20,30]print(a*2) A: [10, 20, 30, 10, 20, 30] B: [20, 40, 60] C: [11, 22, 33] D: [10, 20, 30]
- 已知程序如下,若X=10, Y=20, Z=30,该程序执行完成后,X的值为_____。X = Z + Y; If Y [ Z { X = X – Y; } Else{ X= X – Z; } X = X – Y; If X < Z { X = Y +20; } X = X – Z; If X ] Y { X = X – Y; } A: 10 B: 20 C: 30 D: 40
- 【单选题】#include <stdio.h> int x1 = 30, x2 = 40; void sub(int x, int y) { x1 = x; x = y; y = x1; } int main() { int x3 = 10, x4 = 20; sub(x3, x4); sub(x2, x1); printf(" %d, %d, %d, %d ", x3, x4, x1, x2); return 0; } A. 10, 20, 40, 40 B. 10,40, 40, 40 C. 20, 20, 40, 40 D. 10, 10, 40, 40
- 以下能正确地定义整型变量x和y,并为其赋值为2的语句是? A: int x=y=2; B: int x=2,y=2; C: int x,y=2; D: x=y=2;