int x=3;
float f;d;
String S=“Hello!”;
boolean b=true;
第1题:
若各选项中所用变量已正确定义,函数 fun 中通过 return 语句返回一个函数值,以下选项中错误的程序是
A)
main()
{ …… x=fun(2,10); …… }
float fun(int a,int b){ …… }
B)
float fun(int a,int b){ …… }
main()
{ …… x=fun(i,j); …… }
C)
float fun(int,int);
main()
{ …… x=fun(2,10); …… }
float fun(int a,int b) { …… }
D)
main()
{ float fun(int i,int j);
…… x=fun(i,j); …… }
float fun(int a,int b){ …… }
第2题:
若各选项中所用变量已正确定义,fun()函数中通过return语句返回一个函数值,下列选项中错误的程序是( )。
A.main() {……x=fun(2,10);……} float fun(int a,int b){……}
B.float fun(int a,int b){……} main() {……x=fun(i,j);……}
C.float fun(int,int); main() {……x=fun(2,10);……} float fun(int a,int b){……}
D.main() {float fun(int I,intj); ……x=fun(i,j);……} float fun(int a,int b){……}
第3题:
下列定义变量的语句中错误的是
A)int _int;
B)double int_;
C)char For;
D)float US$;
答案 D
解析:C语言规定,变量的标识符只能由字母、数字或下划线 3 种字符组成,且首字母必须为字母或下划线 。 在 C 语言中大小写字母别认为是不同的字符 。 D 选项中包含有特殊字符 $ ,因此其不是合法的变量名称。
第4题:
下列的变量定义中,错误的是
A.int a;b
B.float a,b1=1.23f;
C.char ch='d';
D.public int i=100,j;
第5题:
下列变量定义中,错误的是______。
A) int x=3;
B) float f;d;
C) String s="Hello!";
D) boolean b=true;
A.
B.
C.
D.
第6题:
在C++语言中,若类C中定义了一个方法int f(int a,int b),那么方法(33)不能与该方法同时存在于类C中。
A.int f(int x,int y)
B.int f(float a,int b)
C.float f(mtx,float y)
D.int f(int x,float y)
第7题:
下面声明和赋值语句中,错误的是( )。
A.float z=6.56;
B.double d=3.1415;
C.boolean truth=true;
D.String str="bye";
第8题:
在C++语言中,若类C中定义了一个方法int f(int a,int b),那么方法___(33)___不能与该方法同时存在于类C中。
(33)A.int f(int x,int y) B.int f(float a,int b)
C.float f(int x,float y) D.int f(int x,float y)
第9题:
下列变量的定义中,错误的是()。
A.int x=3;
B.float f;d;
C.String s="Hello";
D.boolean b=true;
第10题:
下列的哪个程序段可能导致错误? ( )
A.String s="hello"; String t="good"; String k=s+t;
B.String s="hello"; String t; t=s[3]+"one";
C.String s="hello"; String standard=s.toUpperCase();
D.String s="hello"; String t=s+"good";