下面程序输出的结果是 a = 1 b = 2 if a > 1 else 3 print (a + b)A.1B.2C.3D.4

下面程序输出的结果是 a = 1 b = 2 if a > 1 else 3 print (a + b)

A.1

B.2

C.3

D.4


参考答案和解析
B 此程序是统计一周七天中英文名称首字母为”T”的个数,P[i][0]是字符串的首字符,一共有两个”T.因此n=2.

相关考题:

( 7 )有以下程序#include stdio.hmain (){ int a=1,b=2,c=3,d=0;if ( a==1 )if ( b!=2 )if ( c==3 ) d=1;else d=2;else if ( c!=3 ) d=3;else d=4;else d=5;printf ( " %d\n " ,d ) ;}程序运行后的输出结果是 【 7 】 。

以下程序运行后的输出结果是( )。main(){int a=2,b=3,c; c=a; if(ab)c=1; else if(a==b)c=0; else c=-1; printf("%d\n",c);}A.1 B.3 C.-1 D.0

以下程序的输出结果是()。includelong fun(int n){long s;if(n==1||n==2)s=2;else s 以下程序的输出结果是( )。 #include<iostream.h> long fun(int n) {long s; if(n==1||n==2)s=2; else s=n-fun(n-1); return s; } voidmain(){cout<<fun(3);}A.1B.2C.3D.4

下列程序的输出结果是() include main() {int a=3,b=2,c=1; if(a 下列程序的输出结果是( )#include<stdio.h>main(){int a=3,b=2,c=1;if(a<b)if(b<0) c=0;else c++;printf("%d\n",c);}A.0B.2C.1D.3

下列程序的输出结果是()。 include main() {int a=2,b=3,p; p=f(a,B) ; pdntf("%d",p); 下列程序的输出结果是( )。#include<stdio.h>main(){ int a=2,b=3,p;p=f(a,B) ;pdntf("%d",p);}int f(a,B){ int c;if(a>B) c=1;else if(a==B) c=0;elSe c=-1;return(C) ;}A.-1B.0C.1D.2

下面程序的输出结果是()。includemain(){int a[]={1,2,3,4,5,6,7,8,7,10},*p;p=a;print 下面程序的输出结果是( )。 #include<stdio.h> main() {int a[]={1,2,3,4,5,6,7,8,7,10},*p; p=a; printf("%d\n",*p+8); }A.0B.1C.10D.9

有以下程序:#includestdio.hmain( ){ int a=1,b=0;if(--a)b++;else if(a==0)b+=2;else b+=3:print[(%d\n,b);}程序运行后的输出结果是( )。A.0B.1C.2D.3

以下程序的输出结果是includelong fun(int n){ long s;if(n==1||1n==2) s=2;else s 以下程序的输出结果是 #include<iostream.h> long fun(int n) { long s; if(n==1 | | 1n==2) s=2; else s=n-fun(n-1) ; return s; } void main( ) {cout < < fun(3) ;}A.1B.2C.3D.4

运行下面程序后,正确的输出结果是 ______。Private Sub Command1_ Click() x = 6 if x >6 then Print "x>6": Else if x <8 then Print "x<8"; Else if x = 6 then Print "x=6": End if End if End ifEnd SubA.x<8 x=6B.x<8C.x=6D.x<8或x=6

以下程序的输出结果是 include long fun(int n) {long s;if(n=1||n=2)s=2; else s= 以下程序的输出结果是 #include<iostream.h> long fun(int n) { long s; if(n=1||n=2)s=2; else s=n-fun(n-1); return s; } void main( ) { cout<<fun(3);}A.1B.2C.3D.4

下面程序的输出结果是()。includeusing namespace std;int main(){ int a=2,b=-1,c=2; 下面程序的输出结果是( )。 #include<iostream> using namespace std; int main() { int a=2,b=-1,c=2; if(a<b) if(b<0) c=0; else c+=1; cout<<c<<end1; return 0; }A.0B.1C.2D.3

有以下程序inculde stdio.hmain(){ int a=1,B=2,c=3,d=0;iF(a==1)iF(B!=2)iF(c==3) d=1;else d=2;else iF(c!=3) d=3;else d=4;else d=5;printF(“%d\n”,d);}程序远行后的输出结果是【 】。

下面程序的输出结果是()。includeClass example{int a;public:example(int B.{a=b++ 下面程序的输出结果是( )。 #include<iostream.h> Class example {int a; public: example(int B.{a=b++;} void print(){a=a+1 cout<<a<<““;} void print()const{cout<<a<<““;} }; void main() {example x(3); Const example y(2); x.print();A.2 2B.4 3C.4 2D.3 2

下面程序的输出结果是 include class example {int a; public: example(int b) {a= 下面程序的输出结果是#include<iostream.h>class example{int a;public:example(int b) {a=b++;}void pnnt( ) {a=a+1;cout < < a < <" ";}void print( ) const{cout < < a < <" ";}};void main( ){example x(3) ;const example y(2) ;x.print( ) ;y.print( ) ;}A.2 2B.4 3C.4 2D.3 2

下列程序的输出结果是【】。 include void main() { int i(1),j(2),k(3),a(10); if(!i 下列程序的输出结果是【 】。include<iostream.h>void main(){int i(1),j(2),k(3),a(10);if(!i)a--;else if(j)if(k)a=5;elsea=6;a++;cout<<a<<endl;if(i<j)if(i!=3)if(!k)a=1;else if(k)a=5;6+=2;cout<<a<<endl;

下面程序的输出结果是includeclass example{ int a;public: example(int b) {a=b++ 下面程序的输出结果是 #include<iostream,h> class example { int a; public: example(int b) {a=b++;} void print( ){a=a+1;cout<<a<<"";} void print( )const{cout<<a<<"";} }; void main( ) { example X(3);A.22B.43C.42D.32

执行下面这段程序后,单击命令按钮,窗体中输出结果是 ______。 Private Sub Command1_Click() a=1 : b=4 : c = 9 : d = 5 If a < b Then If c<d Then x=True Else If a<c Then x=False Else x=True End If End If End If Print Val(x) End SubA.TrueB.FalseC.0D.1

下列程序段,运行后输出的内容是 a=2 c=1 c=c+a If c<10 Then Print c Else Print a End IfA.3B.7C.9D.6

下列程序的输出结果是( )。 include int fun(int x) {int p;if(x==0‖x==1) return 3;el 下列程序的输出结果是( )。 #include<stdio.h> int fun(int x) { int p; if(x==0‖x==1) return 3; else p=x-fun(x-2); return p; } void main() { print f("\n%d", fun(5)); }A.5B.3C.7D.1

有以下程序#includestdio.hmain(){ int a=1,b=0;if(--a)b++;else if(a==0) b+=2;else b+=3:printf("%d\n",b);}程序运行后的输出结果是A.0B.1C.2D.3

下面程序的输出结果是( )。 #includeiostreanl.h class example { int a; public: example(int B.{a=b++;} void print{a=a+1;eouta””;} void printconst{couta””;} }; void main { example x(3); const example Y(2); A print; B print; }A.2 2B.4 3C.4 2D.3 2

下面程序的输出结果是includeclass example{ int a;public: example(int b){a=b++; 下面程序的输出结果是 #include<iostream.h> class example { int a; public: example(int b){a=b++;} void print(){a=a+1; cout<<a<<" ";} void print()const{cout<<a<<" ";} }; void main() { example x(3); const example y(2); x.print(); y.print(); }A.2 2B.4 3C.4 2D.3 2

试题18有以下程序#include stdio.hmain(){ int a=1,b=0;if(- -a) b++;else if(a= =0) b+=2;else b==3;printf(“%d\n”, b);}程序运行后的输出结果是()A.0B.1C.2D.3

下面程序的输出结果是#includeclass example{int a:public:example(intB.{a=n++;}void print(){a=a+1;cout a ” ”;}void print()const{cout;}}void main(){example x t(3);const example y(2);x.print();y.print();}A.2 2B.4 3C.4 2D.3 2

c=[1]deffore():c.append(2)fore()print(c)输出结果是()A、[1,2]B、[1,2,3]C、[1,2,3,4]D、程序异常

下面程序段运行后,显示结果是()。DimxIf x Then Print x Else Print x+1A、0B、1C、-1D、显示出错信息

单选题下面程序段运行后,显示结果是()。Dim xIf x Then Print x Else Print x+1A0B1C-1D显示出错信息

单选题下面程序段运行后,显示结果是()。DimxIf x Then Print x Else Print x+1A0B1C-1D显示出错信息