下列程序不能通过编译,应该在划线部分填写的语句是_______。
第1题:
应在下面程序下划线中填写的正确的语句是( )。 #include <iostream> using namespace std; class A{ public: void test(){cout<< "this is A!";} }; class B:public A{ void test(){ ______ //显示调用基类函数test() cout<< "this is B!"; } }; void main(){}
A.A::test()
B.test()
C.B::test()
D.this->test()
第2题:
为使该程序执行结果为10,那么应该在程序划线处填入的语句是( )。 #include<iostream> using namespace std; class MyClass { public: MyClass (int a) { x=a; } ___________ //取x值 private: int x; }; int main() { MyClass my(10); cout<<my.GetNum()<<end1; return 0; }
A.return x;
B.int GetNum(){ return x;}
C.intreturn x;
D.void GetNum(){return x;}
第3题:
下面程序运行结果为( )。 main() { char c='a'; if('a'<c< ='z') cout<<"LOW"; else cout<<"UP"; }
A.LOW
B.UP
C.LOWUP
D.语句错误,编译不能通过
第4题:
阅读下面程序 class Test implements Runnable { public static void main(String[] args) { Test t=new Test(); t.start(): } public void run() {} } 下列关于上述程序的叙述正确的是
A.程序不能通过编译,因为start()方法在Test类中没有定义
B.程序编译通过,但运行时出错,提示start()方法没有定义
C.程序不能通过编译,因为run()方法没有定义方法体
D.程序编译通过,且运行正常
第5题:
阅读下列代码段。 class Test implements Runnable{ public int run{ int i=0: while(true){ i++: System.OUt.println("i="+i); } } } 上述代码的编译结果是( )。
A.程序通过编译并且run方法可以正常输出递增的i值
B.程序通过编译,调用run方法将不显示任何输出
C.程序不能通过编译,因为while的循环控制条件不能为“true”
D.程序不能通过编译,因为run方法的返回值类型不是void
第6题:
阅读下列代码段。上述代码的编译结果是( )。
A.程序通过编译并且run( )方法可以正常输出递增的i值
B.程序通过编译,调用run( )方法将不显示任何输出
C.程序不能通过编译,因为while的循环控制条件不能为“true”
D.程序不能通过编译,因为run( )方法的返回值类型不是void
第7题:
【 】SQI语句是指在程序编译时尚未确定,其中有些部分需要在程序的执行过程中临时生成的sQL语句。
第8题:
下列哪一条叙述是正确的()?
第9题:
在java中,下列()语句不能通过编译。
第10题:
注释行是非执行语句,不是程序的一部分
一个语句太长,可写在下一行
执行语句是使程序运行时让编译系统作相应处理的语句
一个程序块中,各类语句的位置是有规定的
第11题:
程序不能通过编译,因为没有import语句将Thread类引入
程序不能通过编译,因为Test类没有实现Runnable接口
程序通过编译,且运行正常,没有任何输出
程序通过编译,且运行正常,打印出一个"Hello"
第12题:
inti=32
floatf=45.0
doubled=45.0
chara=‘c’
第13题:
阅读下面代码 class Test implements Runnable { public int run() { int i=0; while(true) { i++; System.out.println("i="+i); } } } 上述代码的编译结果是
A.程序通过编译,并且run()方法可以正常输出递增的i值
B.程序通过编译,调用run()方法将不显示任何输出
C.程序不能通过编译,因为while的循环控制条件不能为true
D.程序不能通过编译,因为run()方法的返回值类型不是void
第14题:
有如下程序:
#include<iostream>
using namespace std;
class Music{
public:
void setTitle(char*str){strcpy(title,str);}
protected:
char type[10];
private:
char title[20];
};
class Jazz:public Music{
public:
void set(char*str){
strcpy(type,”Jazz”); //①
strcpy(title,str); //②
}
};
下列叙述中正确的是
A.程序编译正确
B.程序编译时语句①出错
C.程序编译时语句②出错
D.程序编译时语句①和②都出错
第15题:
动态SQL语句是指在SQL程序编译时其中有些部分尚未确定,需要在程序的【 】过程中临时生成的SQL语句。
第16题:
下列程序不能通过编译,应该在划线部分填写的语句是【 】。
include<iostream. h>
include<stdlib. h>
double Fune(int a, int b, char ch)
{
double x;
switch(ch)
{
case '+':
x=double(a) +b;
break;
case '--':
x= double(a) --b;
break;
case '/':
x=double(a) * b;
break;
case '/':
if(B) x=double(a) /b;
else
exit(1)
break
default:
exit(1);
}
______
}
void main()
{
cout<<Func(32 , 6 ,'--')<< ",";
cout<<Func(32, 6 ,'*') <<",";
cout<<Func(32, 6 ,'/') <<end1;
}
第17题:
给定如下JAVA程序片断下述程序将()。
A.不能通过编译
B.通过编译,输出为:AB
C.通过编译,输出为:B
D.通过编译,输出为:A
第18题:
下列程序编译错误,是由于划线处缺少某个语句,该语句是______。
include<iostream.h>
class A
{
private:
int numl;
public:
A( ):numl(0){}
A(int i):numl(i){}
};
class B
{
private:
int num2;
public:
B( ):num2(0){}
B(int i):num2(i){}
int my_math(A obj1, B obj2);
};
int B::my_math(A obj1,B obj2)
{
return(obj1.numl+obj2.num2);
}
void main(void)
{
A objl(4);
B obj,obj2(5);
cout<<"obj1+obj2:"<<obj.my_math(obj1,obj2);
}
第19题:
下列哪些是不能通过编译的语句()
第20题:
阅读以下程序:inta=5,b=0,c=0;if(a==b+c)printf(“***/n”);elseprintf(“$$$/n”);以上程序()。
第21题:
下列语句哪一个正确()
第22题:
第23题:
Strings=john+was+here;
Strings=john+3;
floatf=5+5.5;
inta=3+5;