更多"[单选题]下列程序运行后的输出结果是( )。#include <"的相关试题:
[单选题]以下程序运行后输出结果是( )
#include
Using namespace std;
Int
A,b;
Void f()
{ int x=20,y=25;
a=a+x+y;
b=b+x-y;
}
Int main()
{ int x=9,y=7;
a=x+y;b=x-y;
f();
cout << a << "," << b << endl;
return 0;
}
A. 61,-3
B. 16,2
C. 25,-5
D. 以上都不正确
[单选题]运行如下程序,输出结果是( )。
#include
Using namespace std;
Int main(){
int a=2,b=-1,c=2;
if(a if(b<0) c=0;
else c+=1;
cout << c << endl;
return 0;
}
A. 0
B. 1
C. 2
D. 3
[单选题]执行下列程序后,屏幕的输出是( )。
#include
Using namespace std;
Void swap(int
A,int b)
{
int temp=a;
a=b;
b=temp;
cout<<"a="<}
Int main()
{
int a=3,b=2;
swap(a,b);
cout<<"a="< return 0;
}
A. a=2,b=3
A=3,b=2
B. a=3,b=2
A=3,b=2
C. a=2,b=3
A=2,b=3
D. a=3,b=2
A=2,b=3
[单选题]执行下列程序时输入123<空格>456<空格>789<回车> 输出结果是 ()。
main()
{ char s[100]; int c, i;
scanf("%c",&c); scanf("%d",&i); scanf("%s",s);
printf("%c,%d,%s\n",c,i,s);
}
A.123456789
B.1456789
C.1,23,456,789
D.1,23,456
[单选题]执+264:291行下列代码,程序的输出结果是:( )
cout <<″Hex:″<< hex << 255;
A.
ff
B.hex:ff
C.Hex:ff
D.
f
[单选题]下面程序的输出结果是( )
#include
Void main( )
{ int x=10,y=10,i;
For(i=0;x>8;y=++i)
Printf("%d %d ",x--,y);
}
A. 10 1 9 2
B. 9 8 7 6
C. 10 9 9 0
D. 10 10 9 1
[单选题]以下程序的输出结果是( )。
#include
Using namespace std;
Int main() {
int a=0, i;
for (i=0;i<5;i++)
{
switch (i)
{
case 0:
case 3:a+=2;break;
case 1:
case 2:a+=3;
default:a+=5;
}
}
cout << a < return 0;
}
A. 10
B. 20
C. 25
D. 30
[单选题]
执行以下语句输出的结果是( )
i=0
while i<5:
i+=1
if i==4:
continue
else:
print(i)
A.
0,1,2,3,4
B.
1,2,3,4,5
C.
0,1,2,3
D.
1,2,3,5
[单选题]
执行以下语句输出的结果是( )
a=True
b=False
if a or b and a:
print('yes')
else:
print('no')
A.
yes
B.
no
C.
True
D.
False
[单选题]执行下列语句后,程序的输出结果是( )。
#include
Using namespace std;
Int main( )
{
int n=10;
while(n>7){
n--;
cout< }
cout<}
A. 10,9,8
B. 9,8,7
C. 10,9,8,7
D. 9,8,7,6
[单选题]执行下列程序后,输出结果是( )。
#include
Using namespace std;
Void f(int x)
{
if(x)
{
cout.put(‘0’+x%10);
f(x/10);
}
}
Int main()
{
f(11001);
return 0;
}
A. 11001
B. 10001
C. 11100
D. 10011
[单选题]若执行下面的程序从键盘上输入9,则输出结果是( )
#include
Void main( )
{int n;
Scanf("%d",&n);
If (n++<10) printf("%d\n",n);
Else printf("%d\n",n--);}
A. 11
B. 10
C. 9
D. 8
[单选题]下列程序执行后的输出结果是( )。
#include
#include
Using namespace std;
Int main()
{ char arr[2][4];
strcpy(arr[0],"you");
strcpy(arr[1],"me");
arr[0][3]=′&′;
cout << arr[0]; //因第一行无\0,故第二行接着输出
return 0;
}
A. you&me
B. you
C. me
D. err
[填空题]以下程序的输出结果是__()____。
#include
Using namespace std;
Int main(
{
int s,i;
for ( s=0,i=1; i<4; i++,s+=i );
cout << s << endl;
return 0;
}
[单选题]
执行以下语句,用户输入整数5,输出的结果是( )
n=int(input())
d={}
for i in range (1,n+1):
d[i]=i*i
print(d)
A.
{1: 1, 2: 4, 3: 9, 4: 16, 5: 25}
B.
[1,4,9,16,25]
C.
{1: 1, 2: 4, 3: 9, 4: 16, 5: 25,6:36}
D.
[1,4,9,16,25,36]
[单选题]
下面代码的输出结果是:
s=[“seashell”,“gold”,“pink”,“brown”,“purple”,“tomato”]
print(s[1:4:2])
A.
[‘gold’, ‘pink’, ‘brown’]
B.
[‘gold’, ‘pink’]
C.
[‘gold’, ‘pink’, ‘brown’, ‘purple’, ‘tomato’]
D.
[‘gold’, ‘brown’]