网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

已知程序如下,当程序行(60)执行了3次以后,Product和Counter的值分别为_____。 (10) main() (20) { int counter; (30) ... //输入N值的语句,略 (40) long product = 1; (50) for counter = 1 to N step 2 (60) { product = product * counter; } (70) return product; (80) }

A.15,5

B.105,5

C.15,7

D.105,7


参考答案和解析
15 , 5
更多 “已知程序如下,当程序行(60)执行了3次以后,Product和Counter的值分别为_____。 (10) main() (20) { int counter; (30) ... //输入N值的语句,略 (40) long product = 1; (50) for counter = 1 to N step 2 (60) { product = product * counter; } (70) return product; (80) }A.15,5B.105,5C.15,7D.105,7” 相关考题
考题 在窗体上面画一个命令按钮和一个标签,其名称分别为 Command1和 Label1,然后编写如下事件过程:Private Sub Commandl_Click()Counter=0For i=1 To 4For j=6 To 1 Step -2Counter=Counter+1Next jNext iLabel1.Caption=Str(Counter)End Sub程序运行后,单击命令按钮,标签中显示的内容是( )。 A.11B.12C.16D.20

考题 有如下程序:includeusing namespace std;long fun(int n){if(n>2)return(fun(n-1)+fu 有如下程序: #include<iostream> using namespace std; long fun(int n) { if(n>2) return(fun(n-1)+fun (n-2)); else return 2; } int main() { cout<<fun(3)<<end1; return 0; } 则该程序的输出结果应该是 ( )。A.2B.3C.4D.5

考题 有如下程序段,该程序段执行完后,执行循环的次数是total=0Counter=1DoPrint Countertotal=total + CounterPrint totalCounter=Counter + 1If total 10 ThenExit DoEnd IfLoop While Counter =10( )。A.5B.10C.15D.20

考题 阅读下面的程序:Private Sub Form_Click()Dim Check As Boolean, Counter As IntegerCheck = TrueCounter = 5DoDo While Counter 20Counter = Counter + 1If Counter = 10 ThenCheck = FalseExit DoEnd IfLoopLoop Until Check = FalsePrint CounterEnd Sub程序运行后,单击窗体,输出结果为______。

考题 (22)在窗体上画一个命令按钮和一个标签,其名称分别为 Command1 和 Labcl1,然后编写如下事件过程:Private Sub Command1_Click( )Counter=0For i=1 To 4For j=6 To 1 Step -2Counter=Counter+1Next jNext iLabel1.Caption=Str(Counter)End Sub程序运行后,单击命令按钮,标签中显示的内容是( )。A)11B)12C)16D)20

考题 在窗体上画一个命令按钮和一个标签,其名称分别为Command1和Labell,然后编写如下事件过程: Private Sub Command1_Click() Counter=0 For i=1 To 4 For j=6 To 1 Step -2 Counter=Counter+1 Next j Next i Labell.Captidn=Str(Counter) End Sub 程序运行后,单击命令按钮,标签中显示的内容是______。A.11B.12C.16D.20

考题 有如下程序:Private Sub Form_Click()Dim Check, CounterCheck = TrueCounter = 0DoDo While Counter 20Counter = Counter + 1If Counter = 10 ThenCheck = FalseExit DoEnd IfLoopLoop Until Check = FalsePrint Counter, CheckEnd Sub程序运行后,单击窗体,输出结果为( )。A.15 0B.20 -1C.10 TrueD.10 False

考题 有如下程序: Private Sub Form Click() Dim Check,Counter Check=True Counter=0 Do Do While Counter<20 Counter=Counter+1 If Counter=10 Then Check=False Exit Do End If Loop Loop Until Check=False Print Counter,Check End Sub 程序运行后,单击窗体,输出结果为A.15 0B.20 -1C.10 TreeD.10 False

考题 ClicktheExhibitbutton.GiventheJSPcode:1.%2.pageContext.setAttribute(product%2.pageContext.setAttribute(product,3.newcom.example.Product(Pizza,0.99));4.%5.%--insertcodehere--%Whichtwo,insertedatline5,outputthenameoftheproductintheresponse?()A.%=product.getName()%B.jsp:useBeanid=productclass=com.example.Product/%=product.getName()%C.jsp:useBeanid=com.example.Productscope=page%=product.getName()%/jspuseBeanD.jsp:useBeanid=producttype=com.example.Productscope=page/%=product.getName()%

考题 阅读下面的程序:PriVate Sub Form_C1ick()Dim Check As Booleau,Counter As IntegerCheck=TrueCounter=5DoDo While Counter<20Counter=Counter+1If Counter=10 ThenCheck=FalSeEXit Do

考题 在窗体上画一个命令按钮和一个标签,其名称分别为Commandl和Labell,然后编写如下事件过程:Private Sub Command1_Click()Counter=0Fori=1 T04Forj=6 To 1 Step一2Counter=Counter+1Next jNextiLabell.Caption=Str(Counter)End Sub程序运行后,单击命令按钮,标签中显示的内容是A.11B.12C.16D.20

考题 有以下程序:includeusing namespace std;int n[][3]={10,20,30,40,50,60};int main() 有以下程序: #include<iostream> using namespace std; int n[][3]={10,20,30,40,50,60}; int main() { int (*p)[3]; p=n; cout<<p[0] [0]<<","<<*(p[0]+1)<<","<<(*p) [2]<<end1; return 0; } 上述程序执行后的输出结果是( )。A.10,20,30B.20,30,40C.10,30,50D.10,40,60

考题 阅读下面的程序: Private Sub Form_Click() Dim Check, Counter Check=True Counter=0 Do Do While Counter < 20 Counter=Counter + 1 If Counter=10 Then Check = False Exit Do End If Loop Loop Until Check = False Print Counter, Check End Sub 程序运行后,单击窗体,输出的结果为A.15 0B.20 -1C.10 TrueD.10 False

考题 有如下的程序段,该程序段执行完后,共执行的循环次数是 total=0 Counter=1 Do Print Counter total=total * Counter + 1 Print total Counter=Counter +1 If total > 10 Then Exit Do End If Loop While Counter<=10A.4B.10C.15D.20

考题 有如下程序段,该程序段执行完后,执行循环的次数是 total=0 Counter=1 Do Print Counter total=total + Counter Print total Counter=Counter+1 If total>10 Then Exit Do End If Loop While Counter <=10A.5B.10C.15D.20

考题 有如下的程序段,该程序段的执行完后,共执行循环的次数是 Private Sub Command1_Click() total=0 Counter=l Do Print Counter total=total+Counter Print total Counter=Counter+1 If total>=10 Then Exit Do End If Loop While Counter<=10 End SubA.5B.10C.12D.20

考题 给出下面的程序:Private Sub Command1_ Click() Dim Check, Counter Check= True: Counter = 0 do do while Counter < 20 Counter = Counter +1 if Counter = 10 then Check=False exit do End if Loop Loop until Check=False MsgBox CounterEnd Sub 程序最后弹出的消息对话框的内容是______。A.TrueB.FalseC.20D.10

考题 有如下程序: Private Sub Form_C1ick() Dim CheCk,Counter CheCk=True Counter=0 Do Do While Counter<20 Counter=Counter+1 If Counter=10 Then Check=False Exit Do End If Loop Loop Until Check=False Ptint Counter,Check End Sub 程序运行后,单击窗体,输出结果为______。A. 15 0B.20 -1C.10 TreeD.10 False

考题 在窗体上画一个命令按钮和一个标签,其名称分别为Commandl和Label1,然后编写如下事件过程:Private Sub Command1_Click()Counter=0For i=1 T0 4For j=6 T0 1 Step -2Counter=Counter+1Next jNext iLabel1.Caption=Str(Counter)End Sub程序运行后,单击命令按钮,标签中显示的内容是______。

考题 What will be the output of the follow C code?#define product(x) (x*x)main(){int i = 3, j, k;j = product(i++);k = product(++i);printf("%d %d",j,k);}

考题 有如下程序段,该程序段执行完后,共执行循环的次数是 Private Sub Command1_Click( ) Tota1=0 Counter=1 Do Print Counter Tota1=tota1+Counter Print total Counter=Counter+1 If total=10 Then Exit Do End lf Loop While Counter<=10 End SubA.5B.10C.12D.20

考题 有如下程序:includeusing namespace std;long fib(int n){ if(n>2) return(fib(n-1)+ 有如下程序: #include<iostream> using namespace std; long fib(int n) { if(n>2) return(fib(n-1)+fib(n-2)); else return(n); } void main() { int i; cout<<"请输入一个整数:"; cin>>i;cout<<endl; cout<<fib(i)<<endl; { 当输入4、2时,该程序的输出结果是( )。A.5B.4C.5D.6 1 2 2 2

考题 阅读下列说明和 C++代码,将应填入(n)处的字句写在答题纸的对应栏内。 【说明】 生成器( Builder)模式的意图是将一个复杂对象的构建与它的表示分离,使得同样的构建过程可以创建不同的表示。图 5-1 所示为其类图。 【C++代码】 #include #include using namespace std; class Product { private:? ?? string partA, partB; public: Product() {?? } ? ? ?void setPartA(const string} ???? void setPartB(const string} //? 其余代码省略 }; class Builder { public: ??????? (1)?? ; virtual void buildPartB()=0; ??????? (2)?? ; }; class ConcreteBuilder1 : public Builder { private: Product*?? product; public: ConcreteBuilder1() {product = new Product();???? } ??? void buildPartA() {????? (3)???? ("Component A"); } ??? void buildPartB() {????? (4)???? ("Component B"); } Product* getResult() { return product; } //? 其余代码省略 }; class ConcreteBuilder2 : public Builder {? ?? /*??? 代码省略??? */ }; class Director { private:? Builder* builder; public:? ? Director(Builder* pBuilder) { builder= pBuilder;} ???? void construct() { ? ? ? ? ? ? ? (5)???? ;? ? ? //? 其余代码省略 ????? } //? 其余代码省略 }; int main() { Director* director1 = new Director(new ConcreteBuilder1());? director1->construct();? ? delete director1;? ?? return 0;

考题 阅读下列说明和 Java 代码,将应填入(n)处的字句写在答题纸的对应栏内。 【说明】 生成器( Builder)模式的意图是将一个复杂对象的构建与它的表示分离,使得同样的构建过程可以创建不同的表示。图 6-1 所示为其类图。 阅读下列说明和C++代码,将应填入(n)处的字句写在答题纸的对应栏内。 【说明】 ???? 生成器(Builder)模式的意图是将一个复杂对象的构建与它的表示分离,使得同样的构建过程可以创建不同的表示。图5-1所示为其类图。 ? 【C++代码】 #include #include using namespace std; class Product { private:? string partA, partB; public:? Product() {?? }? ? void setPartA(const string} ???? void setPartB(const string}? ? //? 其余代码省略 }; class Builder { public:? ? ?? (1)?? ;? virtual void buildPartB()=0;? ? ? (2)?? ; }; class ConcreteBuilder1 : public Builder { private:? Product*?? product; public: ConcreteBuilder1() {product = new Product();???? } void buildPartA() {????? (3)???? ("Component A"); }? void buildPartB() {????? (4)???? ("Component B"); }?? Product* getResult() { return product; } //? 其余代码省略 }; class ConcreteBuilder2 : public Builder {? ??? ? ? ? /*??? 代码省略??? */ }; class Director { private:? ?? Builder* builder; public:?? Director(Builder* pBuilder) { builder= pBuilder;}? ?? void construct() { ????????????????? (5)???? ; ?????????????? //? 其余代码省略? ? }?? //? 其余代码省略 }; int main() {? ? ?? Director* director1 = new Director(new ConcreteBuilder1());? ? director1->construct();? ? ?? delete director1;? ? ? return 0; 【Java代码】 import jav(6)A.util.*; class Product {? ? ? ? private String partA;? ? ? ? private String partB;? ? ? ?? public Product() {}? ? ?? public void setPartA(String s) { partA = s; }? ? ? ? public void setPartB(String s) { partB = s; } } interface Builder {? ? public?????? (1)???? ;? ?? public void buildPartB();? ? ?? public?????? (2)???? ; } class ConcreteBuilder1 implements Builder {? ? ? ? private Product product;? ? ? ? public ConcreteBuilder1() { product = new Product();?? }? ? ? ?? public void buildPartA() {???????? (3)?? ("Component A"); } public void buildPartB() {???? ????(4)?? ("Component B"); }? ? ?? public Product getResult() { return product;} } class ConcreteBuilder2 implements Builder {?? ? ? ? ? //? 代码省略 } class Director {? ? ? ? private Builder builder;? ? ? ? public Director(Builder builder) {this.builder = builder; } public void construct() { ? ? ? ? ? ? ? ? ? (5)???? ; ? ? ? ? ? ? ? //? 代码省略? ? ?? } } class Test {? ? ?? public static void main(String[] args) { ???????????????? Director director1 = new Director(new ConcreteBuilder1()); ???????????????? director1.construct();? ? ? ?? }

考题 What will be the result of attempting to compile and run the following program?()   public class Q28fd {   public static void main(String args[]) {   int counter = 0;   l1:   for (int i=10; i0; i--) {   l2:  int j = 0;   while (j  10) {   if (j  i) break l2;   if (i == j) {   counter++;   continue l1;   }   }   counter--;   }   System.out.println(counter);  }   }   A、The program will fail to compile.B、The program will not terminate normally.C、The program will write 10 to the standard output.D、The program will write 0 to the standard output.E、The program will write 9 to the standard output.

考题 单选题Which line contains a constructor in this class definition?()   public class Counter { // (1)   int current, step;   public Counter(int startValue, int stepValue) { // (2)   set(startValue);   setStepValue(stepValue);  }   public int get() { return current; } // (3)   public void set(int value) { current = value; } // (4)   public void setStepValue(int stepValue) { step = stepValue; } // (5)  }A Code marked with (1) is a constructorB Code marked with (2) is a constructorC Code marked with (3) is a constructorD Code marked with (4) is a constructorE Code marked with (5) is a Constructor

考题 填空题下列程序的运行结果是()。  Program test      Implicit none      Integer,parameter:: limit=10      Integer counter      Integer:: ans=0      Counter=2     do while(counter=limit)      ans=ans+counter      counter=counter+2   end do Wrte(*,*)ans end

考题 单选题“the product in question” in Line 5 Paragraph 2 means _____ .A “the product in the previous question”B “the product under discussion”C “the product on sale”D “the product in doubt”