更多"[单选题] 以下代码的输出结果是()Int x = 10;X = x"的相关试题:
[单选题] 以下程序段的输出结果是( )。
1 .int x = 1, a = 0, b = 0;
2 .switch (x)
3 .{
4 .case 0:
5 . b++;
6 .case 1:
7 . a++;
8 .case 2:
9 . a++;
10 . b++;
11 .}
12 .printf("a=%d,b=%d\n",
A, b);
A.a=2,b=1
B.a=1,b=1
C.a=1,b=0
D.a=2,b=2
[单选题]以下程序的输出结果是( )。
Int f()
{ static int i=0;
int s=1;
s+=i; i++;
return s;
}
Int main()
{ int i,a=0;
for(i=0;i<5;i++)
a+=f();
cout << a << endl;
return 0;
}
A. 20
B. 24
C. 25
D. 15
[简答题]以下程序段的输出结果是 。
Int main()
{ char s[]= "abcdefg";
s[3] ='\0';
cout << s;
return 0;
}
[单选题]以下程序输出结果是()。
main()
{ int m=5;
if(m++>5) printf("%d\n",m);
esle printf("%d\n",m- -);
}
A.7
B.6
C.5
D.4
[单选题]下列代码的执行结果是:
int numbers[]=new int[6];
for(int i=1;iA.0 1 2 3 4 5
B.1 2 3 4 5 6
C.0 1 2 3 4
D.1 2 3 4 5
[单选题]以下程序的输出结果是( )。
Long fun( int n)
{ long s;
if(n==1||n==2) s=2;
else s=n-fun(n-1);
return s;
}
Int main()
{
cout << fun(3) << endl;
return 0;
}
A. 1
B. 2
C. 3
D. 4
[单选题]执行下列代码,程序的输出结果是(用下划线表示空格):( )
int a=29,b=100;
cout <A.29_100
B._29_100
C.29100
D._29100
[单选题]下列程序的输出结果是()。
main()
{ double d=3.2; int x,y;
x=1.2; y=(x+3.8)/5.0;
printf("%d \n", d*y);
}
A.3
B.3.2
C.0
D.3.07
[单选题]以下程序段运行后的输出结果是( )。
Int main()
{ char str[][9]={"hello", "student", "computer"};
cout << str[1];
return 0;
}
A. h
B. hello
C. student
D. computer
[单选题]以下程序的输出结果是()。
main()
{ int a=4,b=5,c=0,d;
d=!a&&!b||!c;
printf("%d\n",d);}
A.1
B.0
C.非0数
D.-1
[单选题]下列代码的执行结果是
public class Test
{ public int aMethod()
{ static int i=0; i++; System.out.println(i); }
public static void main(String args[])
{ Test test = new Test(); test.aMethod(); }
}
A.编译错误
B.0
C.1
D.运行成功,但不输出
[单选题]下列代码的执行结果是:
int length = "Hello".length();
System.out.println(length);
A.5
B.2
C.10
D.6
[单选题]下列程序段的输出结果是:
int data=0;
char k='a',p='f';
data=p-k;
system.out.println(data);
A.0
B.a
C.f
D.5
[单选题]下面程序段的执行结果是( )。
Int x = 3;
Do {
printf(“%d”,x--);
} while (x != 0);
A.321
B.23
C.不输出任何内容
D.死循环
[单选题]阅读如下程序段,则程序在先后输入love和china后,输出结果是( )。
Int main()
{ char a[30],b[30];
int k;
gets(a);
gets(b);
k=strcmp(a,b);
if(k>0) puts(a);
else if(k<0) puts(b);
return 0;
}
A. love
B. china
C. lovechina
D. 没有输出结果
[单选题]执行下列程序后,输出的结果是( )。
Int a = -5, b = 0;
While( ++a )
b++;
Cout << b << endl;
A. 0
B. 1
C. 4
D. 5
[单选题]下面程序的输出结果是( )
Int i=0,j=0,a=6;
If((++i>0)||(++j>0)) a++;
Printf("i=%d,j=%d,a=%d\n",i,j,A.;
A.i=0,j=0,a=6
B.i=1,j=0,a=7
C.i=1,j=1,a=6
D.i=1,j=1,a=7
[单选题]阅读以下代码,输出结果为()
class A
{
public:
virtual void a()=0;
virtual ~A(){}
};
class AA:public A
{
public:
void a()
{
cout<<"nihao 2\n";
}
~AA()
{
cout<<"delete AA \n";
}
};
class AAA:public AA
{
public:
void a()
{
cout<<"nihao 3 \n";
}
~AAA()
{
cout<<"delete AAA \n";
}
};
class B
{
public:
A *b(int kind)
{
if(kind == 1)
return new AA;
else
return new AAA;
}
~B()
{
cout<<"delete B\n";
}
};
int main()
{
B *bb = new B;
A *aa = bb->b(1);
aa->a();
aa = bb->b(2);
aa->a();
delete aa;
delete bb;
return 0;
}
A.
nihao2
nihao3
delete AA
delete AAA
delete B
B.
nihao3
nihao3
delete AAA
delete AA
delete B
C.
nihao2
nihao2
delete AAA
delete AA
delete B
D.
nihao2
nihao3
delete AAA
delete AA
delete B