④
③
②
①
第1题:
( 20 )有如下程序段
int i =0, j=1;
int & r=i ; // ①
r =j; // ②
int*p= & i ; // ③
*p= & r ; // ④
基中会产生编译错误的语句是
A ) ④
B ) ③
C ) ②
D ) ①
第2题:
有如下程序段int i=0,j=1;int &r=i; //①r=j; //②int*p=&i; //③*p=&r; //④其中会产生编译错误的语句是
A.④
B.③
C.②
D.①
第3题:
现有如下程序段,此程序段编译有错误,则程序段的错误出在
#include
main()
{ int a=30,b=40,c=50,d;
d=a >30?b:c;
switch(d){case a:printf("%d,",a);
case b:printf("%d,",b);
case c:printf("%d,",c);
default:printf("#");}}
A.default:printf("#");这个语句
B.d=a>30?b:c;这个语句
C.case a:printf("%d,",a); case b:printf("%d,",b); case c:printf("%d,",c);这三个语句
D.switch(d)这个语句
第4题:
有如下程序:
#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.程序编译时语句①和②都出错
第5题:
有如下程序段,其中会产生编译错误的语句是 inti=0,j=1; int &r=i; //① r=j; //② int * p=&i; //③ * p=&r; //④
A.④
B.③
C.②
D.①
第6题:
当程序出现编译错误时,程序可以继续执行,只是运行过程中会出错。()
第7题:
对于已经被定义过可能抛出异常的语句,在编译时()。
A.必须使用try/catch语句处理异常
B.如果程序错误,则必须使用try/catch语句处理异常
C.不使用try/catch语句会出现编译错误
D.不使用try/catch语句不会出现编译错误
第8题:
下列语句哪一个正确()
A.Java程序经编译后会产生machinecode
B.Java程序经编译后会产生bytecode
C.Java程序经编译后会产生DLL
D.以上都不正确
第9题:
有如下程序:
#include<iostream>
#include<cmath>
using std::cout;
class Point{
public:
friend double distance(const Point &p); //P距原点的距离
Point(int xx=0,int yy=0):x(xx),Y(YY){}//①
private:
int x,y;
};
double distance(const Point &p){ //②
return sqrt(P.x*P.x+P.y*P.y);
}
int main(){
Point p1(3,4);
cout<<distance(p1);
return 0; //③
}
下列叙述中正确的是
A.程序编译正确
B.程序编译时语句①出错
C.程序编译时语句②出错
D.程序编译时语句③出错
第10题:
有如下程序段: #include<stdio.h> #define Max(a,b) a>b?a:b main() { int a=5,b=6,c=4,d; d=c+Max(a,b); printf("%d",d); } 其输出结果为______。
A.10
B.5
C.6
D.编译错误