int [] my_Array; my_Array = new int[5]; for(int count = 0; count <= 5; count++) System.out.println(my_Array[count]); 结果是()
第1题:
下面程序的运行结果是【 】。
inChlde<iOStream>
using namespace std;
class count
{
static int n;
public:
count()
{
n++;
}
static int test()
{
for(int i=0:i<4;i++)
n++;
return n;
}
};
int count::n=0;
int main()
{
cout<<COUnt::test()<<" ";
count c1, c2;
cout<<count::test()<<end1;
return 0;
}
第2题:
下面程序的正确输出是( )。 public class Hello { public static void main(String args[]) { int count, xPos=25; for ( count=1; count<=10; count++ ) { if ( count==5 ) break; System.out.println(count ); xPos += 10; } } }
A.1 2 3 4
B.1 3 4
C.编译错误
D.以上都不是
第3题:
下面C程序中,设变量count的地址为20000。则该段程序执行后,屏幕上的显示结果应为(53)。 # include <stdio.h> main(void) { int count, q; int *m; count = 100; m = &count; q = *m; printf("q=%d; \n", q); return 0; }
A.q=2000;
B.q=2000
C.q=100;
D.q=100
第4题:
有如下程序: #include using name space std; classB{ public: B(int xx):x(xx){++count;x+=10;} virtual void show()const {cout<<count<<'_'<<x<<endl;} protected: static int count; private: intx; }; class D:publicB{ public: D(int xx,int yy):B(xx),y(yy){++count;y+=100;} virtual void show()const {cout<<count<<'_'<<y<endl}; pnvate: inty; }; int B::count=0; intmain(){ B*ptr=new D(10,20); ptr->show(); delete ptr; return 0; } 运行时的输出结果是( )。
A.1_120
B.2_120
C.1_20
D.2_20
第5题:
A.int count = args.length;
B.int count = args.length-1;
C.int count=0; while(args[count]!=null) count++;
D.int count=0;while (!(args[count].equals(“”))) count++;
第6题:
有如下程序: #include<lostreanl> using namespace std; elass MyClass{ public: MyClass( ){++count;} ~MyClass( ){--count;} static int getCount( ){return count;} private: static int count; }; int MyClass::count=0; int main( ){ MyClass obj; cout<<obj.getCount( ); MyClass*ptr=new MyClass; cout<<MyClass::getCount( ); delete ptr; cout<<MyCiass::getCount( ); return 0; } 程序的输出结果是
A.121
B.232
C.221
D.122
第7题:
有以下程序: #include <iostream> using namespace std; class count { static int n; public: count ( ) { n++; } static int test() { for (int i = 0; i < 4; i++ ) n++; return n; } }; int count :: n = 0; int main() { cout<<count :: test()<<" "; count c1, c2; cout<<count :: test()<<end1; return 0; } 执行后的输出结果是( )。
A.4 10
B.1 2
C.22
D.24
第8题:
有如下程序: #include<iostream> using namespace std; class Toy{ public: Toy(char*_n){strcpy(name,_n);count++;} ~Toy(){count--;} char*GetName( ){return name;} static int getCount( ){return count;} private: char name[10]; static int count; }; int Toy::count=0: int main( ){ Toy tl("Snoopy"),t2("Mickey"),t3("Barbie"); cout<<t1.getCount( )<<endl; return 0; } 程序的输出结果是
A.1
B.2
C.3
D.运行时出错
第9题:
int [] my_Array; My_Array=new int [5]; For(int count = 0 ; count <=5; count ++) System.out.pringtln(my_Array[count]); 以上Java代码运行的结果是()
第10题:
You need to create a JSP that generates some JavaScript code to populate an array of strings used on theclient-side. Which JSP code snippet will create this array?()
第11题:
编译如下Java程序片断: class test{ int count = 9; public void a(){ int count=10; System.out.println("count 1 =" + count); } public void count(){ System.out.println("count 2 =" + count); } public static void main(String args[]){ test t=new test(); t.a(); t.count(); } } 结果将()。
第12题:
不能通过编译
输出: count 1 = 10 count 2 = 9
输出: count 1 = 9 count 2 = 9
第13题:
( 27 )有如下程序:
#include<iostream>
using namespace std;
class MyClass{
public:
MyClass(){++count;}
~MyClass(){--count;}
static int getCount(){return count;}
private:
static int count;
};
int MyClass::count=0;
int main(){
MyClass obj;
cout<<obj.getCount();
MyClass*ptr=new MyClass;
cout<<MyClass::getCount();
delete ptr;
cout<<MyClass::getCount();
return 0;
}
程序的输出结果是
A ) 121
B ) 232
C ) 221
D ) 122
第14题:
( 27 )有如下程序:
#include <iostream>
using namespace std;
class Toy{
public:
Toy(char* _n) { strcpy (name,_n); count++;}
~Toy(){ count--; }
char* GetName(){ return name; }
static int getCount(){ return count; }
private:
char name[10];
static int count;
};
int Toy::count=0;
int mail(){
Toy t1("Snoopy"),t2("Mickey"),t3("Barbie");
cout<<t1.getCount()<<endl;
return 0;
}
运行时的输出结果是
A ) 1
B ) 2
C ) 3
D )运行时出错

第15题:
有如下程序: #include <iostream> using namespace std; class MyClass { public: MyClass() { ++count; } ~MyClass() { --count; } static int getCount() { return count; } private: static int count; }; int MyClass::count=0; int main() { MyClass obj; cout<<obj.getCount(); MyClass *ptr=new MyClass; cout<<MyClass::getCount(); delete ptr; cout<<MyClass::getCount(); return 0; }程序的输出结果是
A.121
B.232
C.221
D.122
第16题:
下面程序的运行结果是【 】。
include <iostream>
using namespace std;
class count
{
static int n;
public:
count()
{
n++;
}
static int test()
{
for(int i=0;i<4;i++)
n++;
return n;
}
};
int count::n = O;
int main()
{
cout<<count:: test()<<" ";
count c1, c2;
cout<<count:: test()<<endl;
return 0;
}
第17题:
有如下程序:
include<iostream>
using namespace std;
class pumpkin{
public:
pumpkin(){++count;}
~pumpkin(){--count;}
static void total_count(){
cout<<count<<"pumpkin(s)"<<end1;
}
private:
static int count;
};
int pumpkin::count=0;
int main(){
pumpkin p1[10];
pumpkin::total_count();
return 0;
}
这个程序的输出结果是______。
第18题:
有如下程序:
#include<iostream>
using namespace std;
class Toy{
public:
Toy(char*_n){strcpy(name,_n);count++;}
~Toy()}count--;}
char*GetName(){return name;}
static int getCount(){return count;}
private:
char name[10];
static int count;
};
int Toy::count=O:
int main(){
Toy tl(“Snoopy”),t2(“Mickey”),t3(“Barbie”);
cout<<t1.getCount()<<endl;
return O:
}
运行时的输出结果是
A.1
B.2
C.3
D.运行时出错
第19题:
int Calc(unsigned int x)
{
int count=0;
while(x)
{
printf("x=%i\n",x);
count++;
x=x&(x-1);
}
return count;
}
问 Calc(9999)的值是多少。
第20题:
有如下程序: #inClude<iostream> using namespaCe耐: Class MyClass{ publiC: MyClass{++Count;} ~MyClass{--Count;} statiC int getCount{retum Count;} private: statiC int Count; }; ‘ int MyClass::Count=0; int main { MyClass obj; Cout<<obj.getCount; MyClass+ptr=new MyClass: Cout<<MyClass::9etCount; ’delete ptr; Cout<<MyClass::9etCount; return 0; } 执行这个程序的输出结果是( )。
A.121
B.232
C.221
D.122
第21题:
编译如下的Java程序片段: Class test{ Int count=9; Public void a(){ Int count=10; System.out,println(“count 1=” + count); } Public void count(){ System.out.println(“count 2 =”+ count); } Public static void main(String args[] ){ Test t=new Test(); t.a(); t.count(); } } 结果是()
第22题:
For debugging purposes, you need to record how many times a given JSP is invoked before the user’ssession has been created. The JSP’s destroy method stores this information to a database. Which JSPcode snippet keeps track of this count for the lifetime of the JSP page?()
第23题:
MY_ARRAY = new Array();<% for ( int i = 0; i < serverArray.length; i++ ) { MY_ARRAY[<%= i %>] = ’<%= serverArray[i] %>’;} %>
MY_ARRAY = new Array();. <% for ( int i = 0; i < serverArray.length; i++ ) { . MY_ARRAY[${i}] = ’${serverArray[i]}’;. } %>
MY_ARRAY = new Array();. <% for ( int i = 0; i < serverArray.length; i++ ) { %> . MY_ARRAY[<%= i %>] = ’<%= serverArray[i] %>’;. <% } %>
MY_ARRAY = new Array();<% for ( int i = 0; i < serverArray.length; i++ ) { %> . MY_ARRAY[${i}] = ’${serverArray[i]}’;. <% } %>