编写如下程序: Private Sub Command1_Click() Dim i As Integer, j As Integer n = InputBox( "输入一个大于1的正整数" ) For i = 2 To n For j = 2 To Sqr(i) If i Mod j = 0 Then Exit For Next j If j > Sqr(i) Then Print i Next i End Sub 该程序的功能是( )。
A) 判断n是否为素数
B) 输出n以内所有的奇数
C) 输出n以内所有的偶数
D) 输出n以内所有的素数
Today is the anniversary of that afternoon in April a year ago that I first saw the strange and appealing doll (玩具娃娃) in the window of Abe Sheftel’’s toy shop on Third Avenue near Fifteenth Street, just around the corner from my office, where the plate on the door reads: Dr. Samuel Amory. I remember just how it was that day: the first hint of spring floated across the East River, mixing with the soft-coal: smoke from the factories and the street smells of the poor neighborhood. As I turned the corner on my way to work and came to Sheftel’’s, I was made once more aware of the poor collection of toys in the dusty window, and I remembered the approaching birthday of a small niece of mine in Cleveland, to whom I was in the habit of sending modest gifts. Therefore, I stopped and examined the window to see if there might be anything suitable, and looked at the confusing collection of unappealing objects—a red toy fire engine, some lead soldiers, cheap baseballs, bottles of ink, pens, yellowed envelopes, and advertisements for soft-drinks; And thus it was that my eyes eventually came to rest upon the doll stored away in one corner, a doll with the strangest, most charming expression on her face. I could not wholly make her out, due to the shadows and the film of dust through which I was looking, but I was aware that a tremendous impression had been made upon me as though I had run into a person, as one does sometimes with a stranger, with whose personality one is deeply impressed. Why did the author go past Sheftel’s
A. He was on his way to work.
B. He was looking for a present for his niece.
C. He wanted to buy some envelopes.
D. He liked to look in the shop windows.
窗体上有一个名称为Command1的命令按钮,一个名称为Text1的文本框。编写如下程序: Private Sub Command1_Click() Dim x As Integer x = Val( InputBox ("输入数据") ) Text1 = Str( x + fun(x) + fun(x) ) End Sub Private Function fun(ByRef n As Integer) If n Mod 3 = 0 Then n=n+n Else n=n*n End If fun=n End Function 对于上述程序,以下叙述中错误的是( )。
A) 语句fun=n有错,因为n是整型,fun没有定义类型
B) 运行程序,输入值为5时,文本框中显示655
C) 运行程序,输入值为6时,文本框中显示42
D) ByRef表示参数按址传递