int x = 3; int y = 1; if (x = y) { System.out.println(“x = “ + x); } What is the result? ()
第1题:
以下程序的输出结果是______。
include<iostream.h>
int add(int x, int y)
{
return x+y;
}
double add(double x, double y)
{
return x+y;
}
void main()
{
int a=3, b=3;
double c=6.5, d=1.5;
cout<<add(a, b)<<","<<add(c, d)<<end1;
}
第2题:
以下数组定义中错误的是
A.int x[][3]={0};
B.int x[2][3]={{l,2},{3,4},{5,6}};
C.int x[][3]={{l,2,3},{4,5,6}};
D.int x[2][3]={l,2,3,4,5,6};
第3题:
以下错误的定义语句是
A)int x[][3]={{0},{1},{1,2,3}};
B)int x[4][3]={{1,2,3},{1,2,3},{1,2,3},{1,2,3}};
C)int x[4][]={{1,2,3},{1,2,3},{1,2,3},{1,2,3}};
D)int x[][3]={1,2,3,4};
第4题:
下面程序的运行结果是( )。 #include<iostream.h> int x=5; int fun(int a) { int c; C=X*a; retum c; } void main() { int x=3,a=4; x=x+fun(a); cout<<"x"”<<X<<endl; }
A.x=15
B.x=17
C.x=23
D.x=25
第5题:
A.x := []int{1, 2, 3,4, 5, 6,}
B.x := []int{1, 2, 3,4, 5, 6}
C.x := []int{1, 2, 3,4, 5, 6}
D.x := []int{1, 2, 3, 4, 5, 6,}
第6题:
有以下程序: #include<stdio.h> int f(int x) {int y; if(x==0||x==1)return(3); y=x*x-f(x-2); return y; } main() {int z; z=f(3);printf("%d\n",z); } 程序的运行结果是( )。
A.0
B.9
C.6
D.8
第7题:
下列程序的输出结果是( )。
#include<stdio.h>
voidp(int*x)
{printf("%d",++*x);
}
voidmain()
{int y=3;
p(&y);
}
A.3
B.4
C.2
D.5
第8题:
以下数组定义中错误的是
A)int x[][3]={0};
B)int x[2][3]={{l,2},{3,4},{5,6}};
C)int x[][3]={{l,2,3},{4,5,6}};
D)int x[2][3]={l,2,3,4,5,6};
第9题:
下面程序的结果【 】。
include<iostream.h>
int f(int);
void main() {
int x=1, i;
for (i=0; i<3; i++)
cout<<f(x)<<‘ ’ ;
cout<<end1;
}
int f(int x){
int y=1;
static int z=3
y++;
z++;
return (x+y+z);
}
第10题:
执行下列语句: #include<iostream> using namespace std; int main() { int x=3; if(x=5) cout<<x++<<end1; else cout<<x<<end1; return 0; } 程序的输出是( )。
A.3
B.4
C.5
D.6